Funkman 10 Posted June 25, 2011 Hi, I am trying to add an event handler so if a chopper is going down, it will radio a message "Taking heavy fire, I am going down". At the moment I added an event handler for killed, and another one like so: his addEventHandler ["killed", {hint "This is RedHawk1, taking fire, I am going down"}]; this addEventHandler ["LandedStopped", {hint "This is RedHawk1, taking fire, I am going down"}] Hint is a temporary measure until I record a radio dialogue. This doesn't cover the event that the pilot ejects and is not killed. An easier way I thought would just be to use the event handler Damaged [unit, selectionName, damage] All I would have to do, is find what level of damage triggers the chopper to land, or the pilot to eject, and use that instead. However I dont know what this damage level is. Also, I dont understand selectionName... Any help much appreciated. ---------- Post added at 11:16 AM ---------- Previous post was at 10:36 AM ---------- Testing shows that a damage of .45 and above is enough to send a chopper down. So all I need is an event handler that displays a message when damage is .45 or above... Share this post Link to post Share on other sites
riouken 15 Posted June 25, 2011 I tested it and this is working just as you requested: In the init of the vehicle. this addEventHandler ["Dammaged", {if ((_this select 2) >= .45) then {hint "This is RedHawk1, taking fire, I am going down"};}]; Share this post Link to post Share on other sites
Funkman 10 Posted June 25, 2011 Thanks thats just what I was looking for....Only it doesnt work for me! I copied and pasted your text... Share this post Link to post Share on other sites
demonized 20 Posted June 25, 2011 you can also use the canMove command to check if its actually able to fly or not regardless of damage state, for instance if fuel is damaged and its empty it will go down even though its not heavily damaged. ---------- Post added at 04:00 PM ---------- Previous post was at 03:54 PM ---------- try this in unit init: _idx = this addEventHandler ["Dammaged", { _obj = _this select 0; if (!canMove _obj AND (_obj getVariable ["radio", true])) then { _obj setVariable ["radio", false, true] ; (driver _obj) sidechat "This is RedHawk1, taking fire, I am going down"; }; }] Share this post Link to post Share on other sites