Desrat 0 Posted September 19, 2011 ok trying to work with BIS_Alice and add a casualties limit to a mission. init of ALICE module (tryed to format it to be readable here) this setvariable ["ALICE_civilianinit", [ { _this addmpeventhandler ["mpkilled", { null = [_this select 1] execVM "scripts\civ_casualties.sqf"; } ] } ] ] call bis_fnc_variablespaceadd; works fine - script triggers, so far so good. but heres where it falls down....I only want it to increment my counter if the killer is one of the playable units, and as I'm using norrins respawn I thought this should work. civ_casualties.sqf if !(isServer) exitWith {}; _killer = _this select 0; if (_killer in NORRN_player_units) then { Civ_Killed = Civ_Killed + 1; publicVariable "Civ_Killed"; }; however it doesn't and neither does this if !(isServer) exitWith {}; _killer = _this select 0; if ((_killer == s1) or (_killer == s2) or (_killer == s3) or (_killer == s4) or (_killer == s5) or (_killer == s6) or (_killer == s7) or (_killer == s8)) then { Civ_Killed = Civ_Killed + 1; publicVariable "Civ_Killed"; }; this does work but obviously only for one unit if !(isServer) exitWith {}; _killer = _this select 0; if (_killer == s1) then { Civ_Killed = Civ_Killed + 1; publicVariable "Civ_Killed"; }; I should add my player array is as follows NORRN_player_units = [s1,s2,s3,s4,s5,s6,s7,s8]; also I dont get any errors reported in my RPT - Can anyone shed any light on what I'm doing wrong here.. Share this post Link to post Share on other sites
demonized 20 Posted September 19, 2011 try using isPlayer instead. Also, you might want to try regular addEventHandler with "killed" instead of the MP version if it still doesnt work. if (!isServer) exitWith {}; _killer = _this select 0; if (isPlayer _killer) then { Civ_Killed = Civ_Killed + 1; publicVariable "Civ_Killed"; }; Share this post Link to post Share on other sites
shuko 59 Posted September 19, 2011 if (_killer in playableUnits) then { ? Share this post Link to post Share on other sites
Desrat 0 Posted September 19, 2011 isPlayer seems to have done the trick thanks, but I still don't understand why if (_killer in NORRN_player_units) then didnt work Share this post Link to post Share on other sites