Forum Jump :

Author Message

Posts: 4

Level: Member

Country: se
In-game name:

#1 Posted at 2015-03-31 19:41        
Hi, im making a mission and in this mission the players have a custom loudout which i have scripted, the problem is that when hosted on multiplayer with other players the script seems to run multiple times and results in instead of 5 mags they get anywhere from 20 to 30 mags.
It works correctly when run in the editor.
I run it by putting _unit = [this] execVM "SpecopsSL.sqf"; in the units init line.
Here's the code:
_unit = _this select 0;

removeallweapons _unit;
removeallassigneditems _unit;

_unit addheadgear "H_Booniehat_indp";
_unit addGoggles "rhs_scarf";
_unit addBackpack "B_AssaultPack_rgr";

_unit addmagazines ["hlc_30Rnd_556x45_B_AUG", 5];
_unit addmagazines ["hlc_30Rnd_556x45_T_AUG", 2];

_unit addmagazines ["rhs_mag_m67", 2];
_unit addmagazines ["B_IR_Grenade", 2];

_unit addWeapon "hlc_rifle_auga3_b";

_unit addPrimaryWeaponItem "hlc_muzzle_snds_AUG";
_unit addPrimaryWeaponItem "rhsusf_acc_anpeq15";

_unit addWeapon "ItemWatch";
_unit addWeapon "ItemCompass";
_unit addWeapon "ItemMap";
_unit addWeapon "Binocular";
_unit addWeapon "rhsusf_ANPVS_15";
_unit addItem ["FirstAidKit", 2];

This post was edited by Viggoboy (2015-03-31 20:32, ago)

Author Message

Posts: 83

Level: Member

Country: us
In-game name: J.Shock

#2 Posted at 2015-04-09 22:10        
Remove the call line from the init lines of the units, create a file named "initPlayerLocal.sqf" in the mission folder, and put the following call line:

0 = [player] execVM "SpecopsSL.sqf"; 

This post was edited by JShock (2015-04-09 22:19, ago)

John Shock
Scripter, Mission Developer

My scripts: Simple Mortar Script, Redressing Script, Cruise Control Script

My Missions: [COOP-40]Operation Bloody Bayonet