I have a script so that when a unit dies it respawns with the customized loadout I had set for it. Okay, I have a killed event handler in the init.sqf like so:
player addEventHandler ["killed",
{
[] spawn {
waitUntil { alive player };
execVM "weapons.sqf";
};
}];
Can anyone explain to me why this script isn't working?
in ARMA 2 & OA : MISSIONS - Editing & Scripting
Posted
I have a script so that when a unit dies it respawns with the customized loadout I had set for it. Okay, I have a killed event handler in the init.sqf like so:
player addEventHandler ["killed", { [] spawn { waitUntil { alive player }; execVM "weapons.sqf"; }; }];Then in the weapons.sqf I have this:
if (side = west) then { removeallweapons _unit; _unit addmagazine "30rnd_556x45_stanag"; _unit addweapon "M16A2"; _unit addmagazine "30rnd_556x45_stanag"; _unit addmagazine "30rnd_556x45_stanag"; _unit addmagazine "15rnd_9x19_M9"; _unit addweapon "M9"; _unit addmagazine "15rnd_9x19_M9"; _unit addmagazine "15rnd_9x19_M9"; _unit addmagazine "handgrenade_west"; _unit addmagazine "handgrenade_west"; };Upon the unit respawning, it just gives it back its class specific weapons, could someone explain to me what I'm doing wrong?