Skip to content

Instantly share code, notes, and snippets.

@dedmen
Created March 7, 2019 09:42
Show Gist options
  • Save dedmen/ab17fe25dec0b9f005ebc9f3b2d8503c to your computer and use it in GitHub Desktop.
Save dedmen/ab17fe25dec0b9f005ebc9f3b2d8503c to your computer and use it in GitHub Desktop.
//Arma #scripting 03.03.2019 10:41
[] spawn {
private _Crates = nearestObjects [SearchObj, ["plp_ct_LockerBig"], 100];
private _weaponsArray = [];
private _magazineArray = [];
private _itemArray = [];
{
private _WeaponCargo = getWeaponCargo _x;
private _MagazineCargo = getMagazineCargo _x;
private _ItemCargo = getItemCargo _x;
_weaponsArray append ((_WeaponCargo select 0) apply {[_x,(_WeaponCargo select 1 select _forEachIndex)]});
_magazineArray append ((_MagazineCargo select 0) apply {[_x,(_MagazineCargo select 1 select _forEachIndex)]});
_itemArray append ((_ItemCargo select 0) apply {[_x,(_ItemCargo select 1 select _forEachIndex)]});
} forEach _Crates;
[_weaponsArray, _magazineArray, _itemArray] spawn {
params ["_weaponsArray", "_magazineArray", "_itemArray"];
private _Crates = nearestObjects [SearchObj, ["plp_ct_LockerBig"], 100];
{
private _crate = _x;
{_crate addWeaponCargoGlobal _x} forEach _weaponsArray;
{_crate addMagazineCargoGlobal _x} forEach _magazineArray;
{_crate addItemCargoGlobal _x} forEach _itemArray;
} forEach _Crates
};
};
//Or if you really need the string output
[] spawn {
private _Crates = nearestObjects [SearchObj, ["plp_ct_LockerBig"], 100];
private _weaponsArray = [];
private _magazineArray = [];
private _itemArray = [];
{
private _WeaponCargo = getWeaponCargo _x;
private _MagazineCargo = getMagazineCargo _x;
private _ItemCargo = getItemCargo _x;
_weaponsArray append ((_WeaponCargo select 0) apply {[_x,(_WeaponCargo select 1 select _forEachIndex)]});
_magazineArray append ((_MagazineCargo select 0) apply {[_x,(_MagazineCargo select 1 select _forEachIndex)]});
_itemArray append ((_ItemCargo select 0) apply {[_x,(_ItemCargo select 1 select _forEachIndex)]});
} forEach _Crates;
private _Output = format ["
[%1, %2, %3] spawn {
params ['_weaponsArray', '_magazineArray', '_itemArray'];
private _Crates = nearestObjects [SearchObj, ['plp_ct_LockerBig'], 100];
{
private _crate = _x;
{_crate addWeaponCargoGlobal _x} forEach _weaponsArray;
{_crate addMagazineCargoGlobal _x} forEach _magazineArray;
{_crate addItemCargoGlobal _x} forEach _itemArray;
} forEach _Crates
};
", _weaponsArray, _magazineArray, _itemArray];
uiNamespace setVariable ['Ares_CopyPaste_Dialog_Text', _Output];
private _dialog = createDialog "Ares_CopyPaste_Dialog";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment