Paskinder Singh 2 Posted February 7, 2019 Hi all, I'm working on a resistance fighter mission and I'm aiming to create a lite-script so that any armed players will be treated as hostile. I'm having trouble with the segment where I have a Fired event handler which then checks if the enemy can see the shooter, and if so it permanently makes the enemy hostile. However, this part of the script doesn't appear to do anything at all. I've gone through each element of it but cannot place which part is going wrong, if anyone has the time to spot any bugs that would be greatly appreciated! Here's the initPlayerLocal: Quote player setCaptive true; hint "You appear unarmed"; player addEventHandler ["InventoryClosed", { if (count (weapons player) == 0) then {player setCaptive true; hint "You appear unarmed"} else {player setCaptive false; hint "You appear armed"}; }]; player addEventHandler ["Take", { if (count (weapons player) == 0) then {player setCaptive true; hint "You appear unarmed"} else {player setCaptive false; hint "You appear armed"}; }]; player addEventHandler ["Fired", { if ((side _x) == west) then {{ if ({[objNull, "VIEW"] checkVisibility [eyepos _x, eyepos player] > 0}) then {player setCaptive false; player removeEventHandler ["InventoryClosed",0]; player removeEventHandler ["Take",0]; hint "Your cover is compromised"; };} forEach _x; } }]; Thanks Share this post Link to post Share on other sites
pierremgi 4853 Posted February 7, 2019 Your _x variables don't mean anything here. Replace inside EH by: { if ({[objNull, "VIEW"] checkVisibility [eyepos _x, eyepos player] > 0}) exitWith { player setCaptive false; player removeEventHandler ["InventoryClosed",0]; player removeEventHandler ["Take",0]; hint "Your cover is compromised"; }; } forEach (allUnits select {side _x == west}); Not saying you're on the right way for your purpose... 2 Share this post Link to post Share on other sites
Paskinder Singh 2 Posted February 7, 2019 Ah I see, I'm still getting the hang of the magic variable. Your amendments to the script still don't run anything. I'll have a mess around with the checkVisibility command in case that is messing it up. Thanks for the pointers! Share this post Link to post Share on other sites