Jump to content
aurora1-4

Copy and Paste Items from Cargo Box

Recommended Posts

Hi all,

 

I'm running a campaign with my unit where we have limited supplies. We put all of our equipment into a virtual basic ammo box at the end of each mission so we know what we have left.

Looking to do one of two things:
1.)  Manually export the contents of the ammo box to my clipboard, then paste it into a Notepad++ document to format. Then run a trigger to add the items at the start of each mission.
So far, I do this:
1a.) I run these in 4 individual triggers at the end of the mission: (This part works)
 

_init = [getItemCargo ammobox]; 
copyToClipboard str _init;

_init = [getWeaponCargo ammobox]; 
copyToClipboard str _init;

_init = [getMagazineCargo ammobox]; 
copyToClipboard str _init;

_init = [getBackpackCargo ammobox]; 
copyToClipboard str _init;

1a.(ii)) I have also tried to run it through one trigger and get this: (This part works)
 

_init = [[getItemCargo ammobox],[getWeaponCargo ammobox],[getMagazineCargo ammobox],[getBackpackCargo ammobox]]; 
copyToClipboard str _init;

But I don't know how I would then get it to separate this output:
 

[[[["uk3cb_optic_SUIT_FNFAL","hlc_optic_LRT_m14","ACE_wirecutter","ACE_MapTools","ACE_EntrenchingTool","ACE_key_lockpick","ACE_CableTie","ACE_Clacker","ACE_EarPlugs","ACE_elasticBandage","ACE_tourniquet","ACE_splint","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_bodyBag","acp_Solid_Tan_V_BandollierB_Solid_Tan","acp_Solid_Tan_V_Rangemaster_belt_Solid_Tan","acp_Solid_Tan_V_SmershVest_01_radio_Solid_Tan_F","acp_Solid_Tan_V_HarnessOGL_Solid_Tan_F","acp_Solid_Tan_V_HarnessO_Solid_Tan_F","acp_Solid_Tan_V_LegStrapBag_Solid_Tan_F","acp_Solid_Tan_V_ChestRigEast_Solid_Tan_F","acp_Solid_Tan_V_TacChestrig_Solid_Tan_F","ItemWatch","ItemMap","ToolKit","TFAR_anprc154","TFAR_microdagr","rhs_acc_pso1m21","acp_Solid_Tan_H_Bandanna_Solid_Tan","acp_Solid_Tan_H_Watchcap_Solid_Tan","acp_Solid_Tan_H_Booniehat_Solid_Tan","acp_Solid_Tan_H_Booniehat_Solid_Tan_hs","acp_Solid_Tan_H_Cap_Solid_Tan","acp_Solid_Tan_H_Cap_Solid_Tan_hs","acp_Solid_Tan_H_Cap_headphones_Solid_Tan","UK3CB_MDF_B_H_Off_Beret","ItemCompass","ACE_fieldDressing","ACE_adenosine","ACE_packingBandage","ACE_plasmaIV_250","acp_Solid_Tan_V_Chestrig_Solid_Tan"],[2,3,2,47,2,3,4,3,44,34,14,17,31,22,2,6,4,3,5,5,3,3,3,5,20,42,2,7,16,1,4,5,4,5,4,5,5,5,32,47,1,16,2,2]]],[[["hlc_rifle_FAL5000_XMAG","HLC_Rifle_g3ka4_GL_XMAG","hlc_rifle_M14_XMAG","launch_RPG7_F","KA_dagger","UK3CB_BHP","rhs_weap_ak74n","UK3CB_SVD_OLD","hlc_rifle_g3a3vris_XMAG","arifle_AKM_F","KA_SilverBaller_L","rhs_weap_ak74n_gp25","uk3cb_enfield_no3","rhs_weap_rpg26","Binocular"],[20,2,4,3,20,4,4,1,4,1,1,3,1,3,10]]],[[["rhs_mag_20Rnd_762x51_m61_fnfal","UK3CB_G3_20rnd_762x51_GT","hlc_50Rnd_762x51_T_G3","1Rnd_HE_Grenade_shell","UGL_FlareWhite_F","rhsusf_20Rnd_762x51_m118_special_Mag","rhs_rpg7_PG7V_mag","rhs_rpg7_OG7V_mag","MiniGrenade","SmokeShellRed","SmokeShellPurple","SmokeShellBlue","ACE_HandFlare_White","ACE_HandFlare_Red","SatchelCharge_Remote_Mag","rhs_30Rnd_545x39_7N10_AK","rhs_10Rnd_762x54mmR_7N1","UK3CB_RPK74_60rnd_545x39_R","rhs_mag_20Rnd_762x51_m80_fnfal","rhs_mag_rgd5","rhs_mag_rdg2_white"],[13,14,3,29,10,10,5,6,16,3,6,6,5,5,7,7,8,7,3,3,6]]],[[["acp_Solid_Tan_B_LegStrapBag_Solid_Tan_F","acp_Solid_Tan_B_RadioBag_01_Solid_Tan_F","acp_Solid_Tan_B_TacticalPack_Solid_Tan","UK3CB_ADG_O_B_RIF"],[3,2,5,1]]]]



1b.) I then paste into a document and format to this: (It doesn't work from this step onwards)
 

_Items = [[[["uk3cb_optic_SUIT_FNFAL","hlc_optic_LRT_m14","ACE_wirecutter","ACE_MapTools","ACE_EntrenchingTool","ACE_key_lockpick","ACE_CableTie","ACE_Clacker","ACE_EarPlugs","ACE_elasticBandage","ACE_tourniquet","ACE_splint","ACE_morphine","ACE_epinephrine","ACE_bloodIV_500","ACE_bodyBag","acp_Solid_Tan_V_BandollierB_Solid_Tan","acp_Solid_Tan_V_Rangemaster_belt_Solid_Tan","acp_Solid_Tan_V_SmershVest_01_radio_Solid_Tan_F","acp_Solid_Tan_V_HarnessOGL_Solid_Tan_F","acp_Solid_Tan_V_HarnessO_Solid_Tan_F","acp_Solid_Tan_V_LegStrapBag_Solid_Tan_F","acp_Solid_Tan_V_ChestRigEast_Solid_Tan_F","acp_Solid_Tan_V_TacChestrig_Solid_Tan_F","ItemWatch","ItemMap","ToolKit","TFAR_anprc154","TFAR_microdagr","rhs_acc_pso1m21","acp_Solid_Tan_H_Bandanna_Solid_Tan","acp_Solid_Tan_H_Watchcap_Solid_Tan","acp_Solid_Tan_H_Booniehat_Solid_Tan","acp_Solid_Tan_H_Booniehat_Solid_Tan_hs","acp_Solid_Tan_H_Cap_Solid_Tan","acp_Solid_Tan_H_Cap_Solid_Tan_hs","acp_Solid_Tan_H_Cap_headphones_Solid_Tan","UK3CB_MDF_B_H_Off_Beret","ItemCompass","ACE_fieldDressing","ACE_adenosine","ACE_packingBandage","ACE_plasmaIV_250","acp_Solid_Tan_V_Chestrig_Solid_Tan"],[2,3,2,47,2,3,4,3,44,34,14,17,31,22,2,6,4,3,5,5,3,3,3,5,20,42,2,7,16,1,4,5,4,5,4,5,5,5,32,47,1,16,2,2]]]];
_Weapons = [[[["hlc_rifle_FAL5000_XMAG","HLC_Rifle_g3ka4_GL_XMAG","hlc_rifle_M14_XMAG","launch_RPG7_F","KA_dagger","UK3CB_BHP","rhs_weap_ak74n","UK3CB_SVD_OLD","hlc_rifle_g3a3vris_XMAG","arifle_AKM_F","KA_SilverBaller_L","rhs_weap_ak74n_gp25","uk3cb_enfield_no3","rhs_weap_rpg26","Binocular"],[20,2,4,3,20,4,4,1,4,1,1,3,1,3,10]]]];
_Magazines = [[[["rhs_mag_20Rnd_762x51_m61_fnfal","UK3CB_G3_20rnd_762x51_GT","hlc_50Rnd_762x51_T_G3","1Rnd_HE_Grenade_shell","UGL_FlareWhite_F","rhsusf_20Rnd_762x51_m118_special_Mag","rhs_rpg7_PG7V_mag","rhs_rpg7_OG7V_mag","MiniGrenade","SmokeShellRed","SmokeShellPurple","SmokeShellBlue","ACE_HandFlare_White","ACE_HandFlare_Red","SatchelCharge_Remote_Mag","rhs_30Rnd_545x39_7N10_AK","rhs_10Rnd_762x54mmR_7N1","UK3CB_RPK74_60rnd_545x39_R","rhs_mag_20Rnd_762x51_m80_fnfal","rhs_mag_rgd5","rhs_mag_rdg2_white"],[13,14,3,29,10,10,5,6,16,3,6,6,5,5,7,7,8,7,3,3,6]]]];
_Backpacks = [[[["acp_Solid_Tan_B_LegStrapBag_Solid_Tan_F","acp_Solid_Tan_B_RadioBag_01_Solid_Tan_F","acp_Solid_Tan_B_TacticalPack_Solid_Tan","UK3CB_ADG_O_B_RIF"],[3,2,5,1]]]];

call {
	ammobox addItemCargo _Items;
	ammobox addWeaponCargo _Weapons;
	ammobox addMagazineCargo _Magazines;
	ammobox addBackpackCargo _Backpacks
};

1c.) Then paste this into a trigger to execute at the start of the mission. (this doesn't work)

2.) It would be nice not to have to manually do all of this. Instead, would there be a way to automatically export these three arrays into a document in the mission folder from one trigger?
2a.) Have a trigger that executes a file on mission start (which has been updated from the step above at previous mission end).

I would be happy for either solution, I just don't want to have to take screenshots/recordings of the contents of the ammobox and manually add each one in the "Equipment Storage" tab.

Thanks in advance,

Aurora

Share this post


Link to post
Share on other sites

Code:

private _items = format ["private _items = %1;", getItemCargo _obj]; 
private _weaps = format ["private _weaps = %1;", getWeaponCargo _obj]; 
private _mags = format ["private _mags = %1;", getMagazineCargo _obj]; 
private _packs = format ["private _packs = %1;", getBackpackCargo _obj];
private _br = toString [13,10];

private _stuff = _items + _br + _weaps + _br + _mags + _br + _packs;

copyToclipboard _stuff;

 

Result:

private _items = [["optic_Hamr","ItemWatch","ItemCompass","ItemGPS","ItemRadio","ItemMap","FirstAidKit"],[2,1,1,1,1,1,6]];
private _weaps = [["arifle_SPAR_01_blk_F","Binocular"],[2,1]];
private _mags = [["30Rnd_556x45_Stanag_red"],[12]];
private _packs = [["B_AssaultPack_blk"],[2]];
  • Like 1

Share this post


Link to post
Share on other sites

Hmm, actually, we need to format that differently. Classic BI that getXCargo doesn't harmonize with addXCargo.

 

Using the same code above, and returning the same arrays, we can do this:

//Returned arrays pasted into script

private _items = [["optic_Hamr","ItemWatch","ItemCompass","ItemGPS","ItemRadio","ItemMap","FirstAidKit"],[2,1,1,1,1,1,6]];
private _weaps = [["arifle_SPAR_01_blk_F","Binocular"],[2,1]];
private _mags = [["30Rnd_556x45_Stanag_red"],[12]];
private _packs = [["B_AssaultPack_blk"],[2]];

//End paste


private _count = count (_items#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_items#0)#_i,(_items#1)#_i];
};

private _count = count (_weaps#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_weaps#0)#_i,(_weaps#1)#_i];
};

private _count = count (_mags#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addMagazineCargo [(_mags#0)#_i,(_mags#1)#_i];
};

private _count = count (_packs#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addBackpackCargo [(_packs#0)#_i,(_packs#1)#_i];
};

Depending on how/where this is being run, you may want to use the GLOBAL variants of the addXCargo commands. If you are using a trigger set to Server Only, for example.

 

As always, there is likely a better way to do this, but this seems to work.

  • Like 2

Share this post


Link to post
Share on other sites

I created (a while ago) scripts for that. The goal was to check also custom content of all backpacks/vests/uniforms in a crate/cargo for duplication or else.

 

 

Just skip all appearance/textures thingies. (removed)

EDITED (see 1st post of this link)

  • Like 2

Share this post


Link to post
Share on other sites
8 hours ago, Harzach said:

Hmm, actually, we need to format that differently. Classic BI that getXCargo doesn't harmonize with addXCargo.

 

Using the same code above, and returning the same arrays, we can do this:


//Returned arrays pasted into script

private _items = [["optic_Hamr","ItemWatch","ItemCompass","ItemGPS","ItemRadio","ItemMap","FirstAidKit"],[2,1,1,1,1,1,6]];
private _weaps = [["arifle_SPAR_01_blk_F","Binocular"],[2,1]];
private _mags = [["30Rnd_556x45_Stanag_red"],[12]];
private _packs = [["B_AssaultPack_blk"],[2]];

//End paste


private _count = count (_items#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_items#0)#_i,(_items#1)#_i];
};

private _count = count (_weaps#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_weaps#0)#_i,(_weaps#1)#_i];
};

private _count = count (_mags#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addMagazineCargo [(_mags#0)#_i,(_mags#1)#_i];
};

private _count = count (_packs#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addBackpackCargo [(_packs#0)#_i,(_packs#1)#_i];
};

Depending on how/where this is being run, you may want to use the GLOBAL variants of the addXCargo commands. If you are using a trigger set to Server Only, for example.

 

As always, there is likely a better way to do this, but this seems to work.



This works perfectly, thankyou!

 

Share this post


Link to post
Share on other sites

Just an idea, thoroughly untested other than the linked scripts( see top comment ). Likely mistakes that need fixing.

Spoiler

//Original get/setContents script post
//https://forums.bohemia.net/forums/topic/230527-sort-weaponsitembackpacksmagazines-help/?do=findComment&comment=3416287

//Description.ext
class CfgFunctions {
	class StoreEquipment {
		tag = "TAG";
		class Category {
			file = "TAG\StoreEquipment\functions";
			
			class getContents {};
			class setContents {};
			class restoreContents {};
			class saveContents {};
			class init { postInit = 1; }
		};
	};
};

StoreEquipment_boxes[] = { "SomeBox_1", "SomeBox_2" }; //STRING varName of containers to save contents of
StoreEquipment_eraseOnMissionEnd = 1; // 0 = false, 1 = true


//TAG\StoreEquipment\functions\fn_saveContents.sqf
if !( isServer ) exitWith {};

_boxes = getArray( missionConfigFile >> "StoreEquipment_boxes" );
if ( isNil "_boxes" ) exitWith {};

_var = [ missionName ];
{
	_box = missionNamespace getVariable _x;
	if ( !isNil "_x" && { !isNull _x } ) then {
		_contents = _box call TAG_fnc_getContents;
		_var pushBack [ _x, _contents ];
	};
}forEach _boxes;

_profile = profileNamespace getVariable[ "StoreEquipment", [] ];
if ( _profile isNotEqualTo [] ) then {
	_index = _profile findIf{ _x select 0 == missionName };
	if ( _index > -1 ) then {
		_profile set[ _index, _var ];
	}else{
		_profile pushBack _var;
	};
	profileNamespace setVariable[ "StoreEquipment", _profile ];
}else{
	profileNamespace setVariable[ "StoreEquipment", [ _var ] ];
};

saveProfileNamespace;


//TAG\StoreEquipment\functions\fn_restoreContents.sqf
if !( isServer ) exitWith {};

_profile = profileNamespace getVariable[ "StoreEquipment", [] ];
if ( _profile isEqualTo [] ) exitWith {};

_index = _profile findIf{ _x select 0 == missionName };
if ( _index > -1 ) then {
	_data = _profile select _index;
	{
		if ( _x isEqualType [] ) then {
			_x params[ "_containerName", "_contents" ];
			_box = missionNamespace getVariable _containerName;
			if ( !isNil "_box" && { !isNull _box } ) then {
				clearItemCargoGlobal _box;
				clearWeaponCargoGlobal _box;
				clearBackpackCargoGlobal _box;
				clearMagazineCargoGlobal _box;
				
				[ _box, _contents ] call TAG_fnc_setContents;
			};
		};
	}forEach _data;
};


//TAG\StoreEquipment\functions\fn_init
if !( isServer ) exitWith {};

[] call TAG_fnc_restoreContents;

addMissionEventHandler[ "HandleDisconnect", {
	if ( count allPlayers == ( [ 1, 0 ] select isDedicated ) ) then {
		[] call TAG_fnc_saveContents;
	};
}];

if ( getNumber( missionConfigFile >> "StoreEquipment_eraseOnMissionEnd" ) > 0 ) then {
	addMissionEventHandler[ "Ended", {
		_profile = profileNamespace getVariable[ "StoreEquipment", [] ];
		if ( _profile isNotEqualTo [] ) then {
			_index = _profile findIf{ _x select 0 == missionName };
			if ( _index > -1 ) then {
				_profile set[ _index, nil ];
				profileNamespace setVariable[ "StoreEquipment", _profile ];
				saveProfileNamespace;
			};
		};
	}];
};


//TAG\StoreEquipment\functions\fn_getContents.sqf
params[ "_container" ];

private _cargo = [ 
	weaponsItemsCargo _container call BIS_fnc_consolidateArray,
	( itemCargo _container select{ !( toLowerANSI( _x call BIS_fnc_itemType select 1 ) in [ "backpack", "uniform", "vest" ] ) } ) call BIS_fnc_consolidateArray,
	magazinesAmmoCargo _container call BIS_fnc_consolidateArray
];

private _containerCargo = everyContainer _container;
{
	_x params[ "_type", "_object" ];
	
	_containerCargo set[ _forEachIndex, [ _type, _object call TAG_fnc_getContents ] ];
}forEach _containerCargo;

[ _cargo, _containerCargo ]


//TAG\StoreEquipment\functions\fn_setContents.sqf
params[ "_container", "_contents" ];
_contents params[ "_cargo", "_containers" ];

{
	_x params[ "_cont", "_contents" ];
	
	_every = everyContainer _container;
	if ( _cont call BIS_fnc_itemType select 1 == "backpack" ) then {
		_container addBackpackCargoGlobal[ _cont, 1 ];
	}else{
		_container addItemCargoGlobal[ _cont, 1 ];
	};
	_addedContainer = ( everyContainer _container - _every ) select 0 select 1;
	
	clearItemCargoGlobal _addedContainer;
	clearWeaponCargoGlobal _addedContainer;
	clearBackpackCargoGlobal _addedContainer;
	clearMagazineCargoGlobal _addedContainer;
	
	[ _addedContainer, _contents ] call TAG_fnc_setContents;
}forEach _containers;

_fnc_addContents = {
	params[ "_index", "_details", "_count" ];
	
	switch ( _index ) do {
		//weapons
		case ( 0 ) : {
			_container addWeaponWithAttachmentsCargoGlobal[ _details, _count ];
		};
		//items
		case ( 1 ) : {
			_container addItemCargoGlobal[ _details, _count ];
		};
		//magazines
		case ( 2 ) : {
			_details params[ "_mag", "_ammo" ];
			
			_container addMagazineAmmoCargo[ _mag, _count, _ammo ];
		};
	};
};

{
	private _index = _forEachIndex;
	{
		_x params[ "_item", "_count" ];

		[ _index, _item, _count ] call _fnc_addContents;
	}forEach _x;
}forEach _cargo;

 

 

Share this post


Link to post
Share on other sites
On 5/31/2023 at 12:09 AM, Harzach said:

Hmm, actually, we need to format that differently. Classic BI that getXCargo doesn't harmonize with addXCargo.

 

Using the same code above, and returning the same arrays, we can do this:


//Returned arrays pasted into script

private _items = [["optic_Hamr","ItemWatch","ItemCompass","ItemGPS","ItemRadio","ItemMap","FirstAidKit"],[2,1,1,1,1,1,6]];
private _weaps = [["arifle_SPAR_01_blk_F","Binocular"],[2,1]];
private _mags = [["30Rnd_556x45_Stanag_red"],[12]];
private _packs = [["B_AssaultPack_blk"],[2]];

//End paste


private _count = count (_items#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_items#0)#_i,(_items#1)#_i];
};

private _count = count (_weaps#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_weaps#0)#_i,(_weaps#1)#_i];
};

private _count = count (_mags#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addMagazineCargo [(_mags#0)#_i,(_mags#1)#_i];
};

private _count = count (_packs#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addBackpackCargo [(_packs#0)#_i,(_packs#1)#_i];
};

Depending on how/where this is being run, you may want to use the GLOBAL variants of the addXCargo commands. If you are using a trigger set to Server Only, for example.

 

As always, there is likely a better way to do this, but this seems to work.


I'm having a strange problem with this now. It will work at the start of the mission when I test it, but when I try to do it later into the mission it doesn't copy to clipboard anymore. 
The trigger is on Repeatable and Server Only but still no luck.

I tried the same trigger on multiple ammo crates and neither would work.

Any ideas?

 

Share this post


Link to post
Share on other sites

Have you looked at @pierremgi's or @Larrow's solutions above? They're smarter than me.

 

copyToClipboard is SE, so testing on a hosted server will appear to work fine, while it won't work on dedi (unless you have full remote access to it). You might need to save it to serverNameSpace or something like that.

Share this post


Link to post
Share on other sites

I have tested both but can't seem to get either to work. I have a very basic level of understanding into scripting so most, if not all, of this is waaay above anything I can understand. 

I run the dedicated server on a PC that I have full access to. How would I go about executing this through the server? I run the server through TADST btw.
 

Share this post


Link to post
Share on other sites
10 hours ago, aurora1-4 said:

I have tested both but can't seem to get either to work. I have a very basic level of understanding into scripting so most, if not all, of this is waaay above anything I can understand. 

I run the dedicated server on a PC that I have full access to. How would I go about executing this through the server? I run the server through TADST btw.
 

Difficult to help if you don't share your scripts. We just know, it's a dedicated server...

Just a hint copyToClipboard is SE as @Harzach wrote and you overwrite your clipboard each time you are using it. You can use diag_log instead, if you want an history of what you want in the report file.

 

  • Like 1

Share this post


Link to post
Share on other sites

Apologies, I'm running the dedicated server on a second PC that I have full access to.

I have tried using all three solutions, and the only one that has sort of worked has been Hazarch's one (with the limitation that it doesn't work on the dedicated server).

The current setup is:
Trigger (Repeatable, Server Only ticked) activated by Radio Charlie.
In the On Activation, I am using this script:
 

private _items = format ["private _items = %1;", getItemCargo _obj]; 
private _weaps = format ["private _weaps = %1;", getWeaponCargo _obj]; 
private _mags = format ["private _mags = %1;", getMagazineCargo _obj]; 
private _packs = format ["private _packs = %1;", getBackpackCargo _obj];
private _br = toString [13,10];

private _stuff = _items + _br + _weaps + _br + _mags + _br + _packs;

copyToclipboard _stuff;

This seems to work for the first usage even on the dedicated server with multiple players in the server. But later on in the mission ~2hrs later, it no longer works. I am logged in as Admin when activating the trigger.

I am just looking for a way to copy all the contents of an ammobox to somewhere, so that after the mission has eneded and server has been stopped, I can update the mission in the editor using a script like this:
 

private _items = [["optic_Hamr","ItemWatch","ItemCompass","ItemGPS","ItemRadio","ItemMap","FirstAidKit"],[2,1,1,1,1,1,6]];
private _weaps = [["arifle_SPAR_01_blk_F","Binocular"],[2,1]];
private _mags = [["30Rnd_556x45_Stanag_red"],[12]];
private _packs = [["B_AssaultPack_blk"],[2]];

private _count = count (_items#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_items#0)#_i,(_items#1)#_i];
};

private _count = count (_weaps#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_weaps#0)#_i,(_weaps#1)#_i];
};

private _count = count (_mags#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addMagazineCargo [(_mags#0)#_i,(_mags#1)#_i];
};

private _count = count (_packs#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addBackpackCargo [(_packs#0)#_i,(_packs#1)#_i];
};


 

Share this post


Link to post
Share on other sites

One more question, what are the parameters of your radio trigger? because, as is, _obj is not defined. I suppose it refers to cursorTarget, or cursorObject, or else... how do you set that?

I guess there is some locality issue. when you're in game, vehicles may belong to players and no more on server... but, first of all, what are you doing?

Share this post


Link to post
Share on other sites

I have changed _obj to the variable name of the ammobox (which is "ammobox").

 

//Edit//


I have done a little research and it seems like, as Lazarch mentioned, it would probably be better to save the contents of the box to the serverNamespace or missionNamespace I think.
My thought was to have something like this inside a exit.sqf file:

_savedammobox = {
	private _items = format ["private _items = %1;", getItemCargo ammobox]; 
	private _weaps = format ["private _weaps = %1;", getWeaponCargo ammobox]; 
	private _mags = format ["private _mags = %1;", getMagazineCargo ammobox]; 
	private _packs = format ["private _packs = %1;", getBackpackCargo ammobox];
	private _br = toString [13,10];

	private _stuff = _items + _br + _weaps + _br + _mags + _br + _packs;
};

_profile = missionNamespace getvariable ["_savedammobox", []];
missionNamespace setVariable ["_savedammobox", _profile];

This executes without error, but I don't really know where it goes after that... And I don't really know how I would either call it back and format it into this:
 

private _items = [["optic_Hamr","ItemWatch","ItemCompass","ItemGPS","ItemRadio","ItemMap","FirstAidKit"],[2,1,1,1,1,1,6]];
private _weaps = [["arifle_SPAR_01_blk_F","Binocular"],[2,1]];
private _mags = [["30Rnd_556x45_Stanag_red"],[12]];
private _packs = [["B_AssaultPack_blk"],[2]];

private _count = count (_items#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_items#0)#_i,(_items#1)#_i];
};

private _count = count (_weaps#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addItemCargo [(_weaps#0)#_i,(_weaps#1)#_i];
};

private _count = count (_mags#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addMagazineCargo [(_mags#0)#_i,(_mags#1)#_i];
};

private _count = count (_packs#1) - 1;
for "_i" from 0 to _count do 
{
	ammobox addBackpackCargo [(_packs#0)#_i,(_packs#1)#_i];
};

 

or

 

Just copy the array it gives me so I can manually put it into the eden editor.

I have also tried diag_log like this, to similar outcome of not really knowing how it works:
 

_savedammobox = {
	private _items = format ["private _items = %1;", getItemCargo ammobox]; 
	private _weaps = format ["private _weaps = %1;", getWeaponCargo ammobox]; 
	private _mags = format ["private _mags = %1;", getMagazineCargo ammobox]; 
	private _packs = format ["private _packs = %1;", getBackpackCargo ammobox];
	private _br = toString [13,10];

	private _stuff = _items + _br + _weaps + _br + _mags + _br + _packs;
};

diag_log _savedammobox;

I found the entry in the .rpt file but it was just the contents of _savedammobox...
 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×