Jump to content
Sign in to follow this  
shark-attack

Equiping a TAC Vest which is stored in a backpack

Recommended Posts

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 by shark-attack

Share this post


Link to post
Share on other sites

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

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

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

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

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

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 by Larrow

Share this post


Link to post
Share on other sites

^ 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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×