shark-attack 2 Posted September 16, 2014 (edited) Hi I am having some trouble pre loading a TAC vest which is stored in a divers backpack. Equiping a Vest which is worn by the player unit is not a problem but can anyone offer any insight on how to pre load a Tac vest which is stored inside a divers backpack. I am able to add an equiped vest to the backpack after the mission loads but i prefer to do it via the loadout script on mission load. Divers loadout script. called from [p1] units init field. nul = [this] execVM "kit\p1loadout.sqf" // loadout for unit p1 Dive team leader waitUntil {!isNull player}; private ["_unit"]; _unit = _this select 0; if (local _unit) then { removeAllWeapons _unit; removeAllAssignedItems _unit; clearBackpackCargo _unit; removeAllItems _unit; clearAllItemsFromBackpack _unit; sleep 1; _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "30Rnd_65x39_caseless_mag"; _unit addMagazine "16Rnd_9x21_Mag"; _unit addMagazine "16Rnd_9x21_Mag"; _unit addMagazine "16Rnd_9x21_Mag"; _unit addMagazine "3Rnd_HE_Grenade_shell"; _unit addMagazine "3Rnd_HE_Grenade_shell"; _unit addMagazine "3Rnd_HE_Grenade_shell"; _unit addMagazine "MiniGrenade"; _unit addMagazine "MiniGrenade"; _unit addMagazine "DemoCharge_Remote_Mag"; _unit addItemToBackpack "U_B_CombatUniform_mcam"; _unit addItemToBackpack "H_Watchcap_blk"; _unit addItemToBackpack "V_TacVest_blk"; _unit addItemToBackpack "30Rnd_65x39_caseless_mag"; _unit addItemToBackpack "30Rnd_65x39_caseless_mag"; _unit addItemToBackpack "30Rnd_65x39_caseless_mag"; _unit addItemToBackpack "30Rnd_65x39_caseless_mag"; _unit addweapon "arifle_MX_GL_Black_F"; _unit addprimaryweaponitem "optic_Hamr"; _unit addprimaryweaponitem "acc_pointer_IR"; _unit addprimaryweaponitem "muzzle_snds_H"; _unit addweapon "hgun_p07_F"; _unit addWeapon "ItemGPS"; _unit addWeapon "Binocular"; _unit linkItem "ItemMap"; _unit linkItem "ItemCompass"; _unit linkItem "ItemWatch"; _unit linkItem "ItemRadio"; _unit AddItem "FirstAidKit"; _unit linkItem "NVGoggles_OPFOR"; }; The above loadout script seems to work fine when tested in dedicated environment with each unit loading his own specific loadout. Recently returned to ARMA 3 after a long absence (scripting was never a strong point) Any help , advice or pointers would be great. Best wishes shark-attack Edited September 16, 2014 by shark-attack Share this post Link to post Share on other sites
jshock 513 Posted September 16, 2014 Are you saying that you want your diver (classname B_diver_F or whatever it is) to be preloaded with a vest at mission start via this script, or that you want the vest preloaded into the backpack for future use in the mission? Share this post Link to post Share on other sites
shark-attack 2 Posted September 16, 2014 Hi mate I want the diver to start the mission with a pre loaded vest stored in his backpack for use after insertion. Trying to avoid having to do it manually so that the re breather can be stored and with a simple single drag of the mouse in the inventory a pre loaded vest can be equiped. Hope that makes sense Share this post Link to post Share on other sites
jshock 513 Posted September 16, 2014 The uniform, headgear, and 4 magazines are loading into the backpack properly? Because if the 4 mags(or only some) aren't in there I would say the backpack is too small so only the first two items (the uniform and headgear) fit inside the cargo. Share this post Link to post Share on other sites
shark-attack 2 Posted September 16, 2014 Yes mate. All the gear loads into backpack + the charge. I was just curious if it was possible to pre load the Tac Vest which is also contained within the backpack rather than it being empty when equiped. ie When the re breather is dropped and the Tac Vest is equiped the vest contains its own pre defined loadout. Not sure if the filled slots within the vest will affect the load capacity of the backpack ? Share this post Link to post Share on other sites
jshock 513 Posted September 16, 2014 Ok, now I think I get it, I was confused by preload-ception :p. So what you may need to do is assign the vest to the player first, then add in all the gear you would want in the vest, save the gear in the vest to a variable: _vestGear = vestContainer _unit; But I don't know where to go from here, because there isn't an "unassignVest" command of any sort, to then unassign and put it in the backpack. But with the vestContainer variable you may be able to put together an addAction script to reassign the vest and then all the gear as it was saved in the vestContainer variable....maybe??? So once the player is on shore he can just scroll to "Equip Vest" and then the work is done for him... Share this post Link to post Share on other sites
Larrow 2822 Posted September 16, 2014 (edited) something like... (for testing from DebugConsole) player addBackpack "B_FieldPack_khk"; vestType = "V_PlateCarrier1_rgr"; mybackpack = backpackContainer player; mybackpack addItemCargoGlobal [vestType,1]; mystoredvest = { if (_x select 0 == vestType) exitWith {_x select 1}; }forEach everyContainer mybackpack; mystoredvest addItemCargoGlobal ["FirstAidKit",1]; Commented //Give player a backpack player addBackpack "B_FieldPack_khk"; //A type of vest vestType = "V_PlateCarrier1_rgr"; //Get container object of backpack mybackpack = backpackContainer player; //Add a vest to the backpack mybackpack addItemCargoGlobal [vestType,1]; //Vest container object mystoredvest = { //When we find a container object that matches our vestType exit with the container object if (_x select 0 == vestType) exitWith {_x select 1}; //Loop around all containers in the backpack container }forEach everyContainer mybackpack; //Add FirstAidKit to the vest container mystoredvest addItemCargoGlobal ["FirstAidKit",1]; Edited September 16, 2014 by Larrow Share this post Link to post Share on other sites
jshock 513 Posted September 16, 2014 ^ That looks like the money maker, could see it in my head, but couldn't actually type it all out :p. Share this post Link to post Share on other sites
shark-attack 2 Posted September 17, 2014 Hey Larrow. Thanks a million mate. Works a treat :). Thanks Also JShock. Best wishes guys !! Share this post Link to post Share on other sites
gatordev 219 Posted August 14 I found this thread recently and it was super helpful for what I was trying to do (loaded vest in a back pack). But now I'm resurrecting the thread to see if someone can help me with putting a loaded vest in a vehicle. I've tried messing around with the previous code but it's not accepting the _unit variable (I think that's where the error is). But then I realized I wasn't sure if a vehicle can even have a vestContainer. Can you call it that way? I'm sure I'm messing up something else as well with the waitUntil, too. I did change it up a bit to "additemcargoGlobal vestType" and then try and "getItemCargo vestType", but it didn't like that past adding the vest, so no doubt I'm getting lost in the forEach loop. I have to believe there is a simple way to do this and I'm making it more complicated, but my googling hasn't helped other than return me to this thread. Any pointers? Share this post Link to post Share on other sites