sizraide 4 Posted June 10, 2021 Hello, i'm creating a COOP mission. I have this script in the initLocalPlayer.sqf, basically I want a specific number of AI's to immediately die (setDamage 1;) when they loose health. (get shot by players) Quote { if ((damage _x)>0.1) then { _x setDamage 1; sleep 1; }; } forEach [test1, test2]; I've tried damaged and hit eventhandlers but it doesn't work, any help? Share this post Link to post Share on other sites
stanhope 409 Posted June 10, 2021 I'm assuming you want this check to run every time the units get damaged and not just when the server starts so: { _x addEventHandler ["HandleDamage", { params ["", "", "_damage"]; if (_damage > 0.1} then { _damage = 1; }; _damage }]; } forEach [test1, test2]; Untested 3 1 Share this post Link to post Share on other sites
sizraide 4 Posted June 11, 2021 14 hours ago, stanhope said: I'm assuming you want this check to run every time the units get damaged and not just when the server starts so: { _x addEventHandler ["HandleDamage", { params ["", "", "_damage"]; if (_damage > 0.1} then { _damage = 1; }; _damage }]; } forEach [test1, test2]; Untested Works wonderfully, just a tiny bracket mistake in your part where you have } instead of ) next to > 0.1. Other than that it works! Thank you! Share this post Link to post Share on other sites
stanhope 409 Posted June 11, 2021 Well, I was in a meeting at work while writing that so It's surprising to me that that's the only mistake I made 😄 1 Share this post Link to post Share on other sites