Jump to content
Sign in to follow this  
shuko

SHK_gear

Recommended Posts

Since the switching gear stuff gets asked almost daily. Here is something related to it, a script to switch gear for multiple units. You can have any number of different gear sets (just add a new case inside the switch). Point of this is to cut down the work when using same loadout in different missions. One down side/known issue is that the changed gear does not show up in briefing. Instead, it is changed after it, when the mission actually begins. I don't think I'm the only one eager to hear a solution to this.

SHK_gear.sqf

Called from init.sqf

[
 ["AgentWest",[a1,a2,a3,a4]],
 ["Police",[p1,p2,p3,p4,p5,p6,p7,p8]],
 ["Fugitive",[f1,f2,f3,f4,c1,c2,c3]]
] execvm "SHK_gear.sqf";

In this example the unit arrays consist of named units, but you can pass for example (units myGrp) or whatever, as long as it returns an array of units.

SHK_gear.sqf

private ["_gear","_c"];
_gear = {
 private "_u";
 _u = _this select 0;
 removeallweapons _u;
 switch (_this select 1) do {
   case "AgentWest": {_u addweapon "NVGoggles";_u addmagazine "30Rnd_556x45_G36";_u addmagazine "30Rnd_556x45_G36";_u addmagazine "30Rnd_556x45_G36";_u addmagazine "30Rnd_556x45_G36";_u addmagazine "30Rnd_556x45_G36";_u addmagazine "30Rnd_556x45_G36";_u removeweapon "NVGoggles";_u removeweapon "Binocular";_u addweapon "ItemGPS";_u addweapon "G36C";};
   case "Police": {_u addweapon "NVGoggles";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u removeweapon "NVGoggles";_u removeweapon "Binocular";_u addweapon "AK_47_M";};
   case "Fugitive": {_u addweapon "NVGoggles";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u addmagazine "30Rnd_762x39_AK47";_u removeweapon "NVGoggles";_u removeweapon "Binocular";_u addmagazine "PipeBomb";_u addweapon "AK_47_S";};
 };
 _u selectweapon (primaryweapon _u);
};
waituntil {time > 0};
{
 _c = _x select 0;
 {
   if (!isnil "_x") then {
     if (local _x) then {
       [_x,_c] call _gear;
     };
   };
 } foreach (_x select 1);
} foreach _this;

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  

×