Jump to content
Sign in to follow this  
citazenman

Loadout / Equipment Issue.

Recommended Posts

I have a small problem. I have a very complex mission that I have solved nearly every issue with, except this pesky one.

I have the players in the mission get placed in a C-130 with equipment for a HALO jump.(The AI just teleport to the team leader after everyone is on the ground.) I can't get the units to properly apply new equipment after all units are on the ground.

Here is the relavent parts of the init and equipment SQFs.(I omitted most of it for space.)

Init

execVM "initial_loadout.sqf";
seals = group unit1;

if (isServer) then {


if (isPlayer unit1) then {[unit1] execVM "loadouts\jumper.sqf"; unit1 moveInCargo c130;};
if (isPlayer unit2) then {[unit2] execVM "loadouts\jumper.sqf"; unit2 moveInCargo c130;};
if (isPlayer unit3) then {[unit3] execVM "loadouts\jumper.sqf"; unit3 moveInCargo c130;};
if (isPlayer unit4) then {[unit4] execVM "loadouts\jumper.sqf"; unit4 moveInCargo c130;};


ambushTrig = createTrigger ["EmptyDetector", _spawnpos, true];
ambushTrig setTriggerArea [300, 300, 0, false];
ambushTrig setTriggerActivation ["WEST", "PRESENT", false];
ambushTrig setTriggerStatements ["this", "['You are in the drop zone. Go! Go! Go!','hint',true,false] call BIS_fnc_MP;", ""];



};


if (isServer) then {
sleep 10;
waitUntil {sleep 2; isTouchingGround unit1 AND isTouchingGround unit2 AND isTouchingGround unit3 AND isTouchingGround unit4}; //As weird as this is, it is not an issue
{if (!isPlayer _x) then {_x setpos getpos unit1}} forEach units seals;
sleep 0.5; 
[unit1] execVM "loadouts\lead.sqf";
sleep 0.2; // all this sleep is here out of my paranoia that the scripts could all be affecting each other. 
[unit2] execVM "loadouts\mark.sqf";
sleep 0.2;
[unit3] execVM "loadouts\breach.sqf";
sleep 0.2;
[unit4] execVM "loadouts\heavy.sqf";
sleep 0.2;

};

{if (!isPlayer _x) then {_x allowDamage false}} forEach units seals;

example of a loadout

private ["_unit"];
_unit = _this select 0;
if (!(local _unit)) exitWith {};

removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
sleep 0.2; // more paranoia sleep.

_unit forceAddUniform "TRYK_U_B_3c";
for "_i" from 1 to 6 do {_unit addItemToUniform "ACE_fieldDressing";};
for "_i" from 1 to 2 do {_unit addItemToUniform "ACE_morphine";};
_unit addItemToUniform "ACE_Clacker";
for "_i" from 1 to 3 do {_unit addItemToUniform "rhs_mag_30Rnd_556x45_Mk318_Stanag";};
_unit addVest "TRYK_V_ArmorVest_khk2";
_unit addItemToVest "ACE_EarPlugs";
for "_i" from 1 to 3 do {_unit addItemToVest "RH_15Rnd_9x19_SIG";};
for "_i" from 1 to 7 do {_unit addItemToVest "rhs_mag_30Rnd_556x45_Mk318_Stanag";};
for "_i" from 1 to 4 do {_unit addItemToVest "rhs_mag_M441_HE";};
for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
_unit addItemToVest "Chemlight_green";
_unit addBackpack "B_Carryall_cbr";
_unit addItemToBackpack "optic_DMS";
for "_i" from 1 to 8 do {_unit addItemToBackpack "rhs_mag_M441_HE";};
for "_i" from 1 to 4 do {_unit addItemToBackpack "SUPER_flash";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "DemoCharge_Remote_Mag";};
_unit addItemToBackpack "ClaymoreDirectionalMine_Remote_Mag";
_unit addHeadgear "TRYK_H_Booniehat_3CD";
_unit addGoggles "TRYK_Shemagh";
sleep 0.2;

_unit addWeapon "rhs_weap_m4a1_carryhandle_m203";
_unit addPrimaryWeaponItem "rhsusf_acc_nt4_black";
_unit addPrimaryWeaponItem "FHQ_acc_ANPEQ15_black";
_unit addPrimaryWeaponItem "rhsusf_acc_eotech_552";
_unit addWeapon "RH_p226";
_unit addHandgunItem "RH_suppr9";
_unit addHandgunItem "RH_M6X";
_unit addWeapon "Laserdesignator";
sleep 0.2;

_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
_unit linkItem "ItemGPS";
_unit linkItem "NVGoggles";
sleep 0.2;


Thanks for taking the time to read and for any help you can give. I assume this is a locality issue because It works fine in SP. only certain aspects of the scripts fail.(backpacks,vest items, etc...)

Share this post


Link to post
Share on other sites

Check out theaddWeaponGlobal (and similar) function, it lets you add items globally. Alternatively, I believe you can just call the script using Bis_fnc_mp, eg. "[[[unit1], ""loadouts\jumper.sqf""], "BIS_fnc_execVM", unit1] call BIS_fnc_MP" on the server for each player. This will run your script on each client, where the player is local, and remove the items.

Share this post


Link to post
Share on other sites
Check out theaddWeaponGlobal (and similar) function, it lets you add items globally. Alternatively, I believe you can just call the script using Bis_fnc_mp, eg. "[[[unit1], ""loadouts\jumper.sqf""], "BIS_fnc_execVM", unit1] call BIS_fnc_MP" on the server for each player. This will run your script on each client, where the player is local, and remove the items.

Thanks I was wondering if BIS_fnc_mp would fix it, but I wasnt sure how to use it in this context.

works perfectly

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  

×