Chris_37 0 Posted March 11, 2018 Hello wondering if anyone is able to help me currently i am attempting to create it so when a unit enters the INCAPACITATED state a dialog appears on the screen not sure if i am going about it right however i currently have if (lifeState _unit == "INCAPACITATED") then { createdialog "blah"; }; this ^ in my event handler handle damage but cant seem to get it to work any ideas? Share this post Link to post Share on other sites
pierremgi 4911 Posted March 12, 2018 This state is not immediate when you trigger the EH. That means you need to wait for it,... inside the EH or in a loop. So, the added value of the EH, here, is not evident. Just say, you'll start your loop at the first hit instead of the start of the game,... but you must avoid multiple repetitions of the code (each hit parts damage). Roughly: thisUnit spawn { while {true} do { waitUntil {sleep 2; lifeState _this == "incapacitated"}; < code you want>; waitUntil {sleep 2; lifeState _this != "incapacitated"}; } }; or thisUnit addEventHandler ["handleDamage", { params ["_unit"]; _unit spawn { waitUntil { lifeState _this == "incapacitated" && isNil {_this getVariable "EHTreated"} }; _this setVariable ["EHTreated", true]; < code you want>; waitUntil { lifeState _this != "incapacitated"} _this setVariable ["EHTreated",nil] }; }]; Added value? Share this post Link to post Share on other sites
Larrow 2823 Posted March 13, 2018 On 3/11/2018 at 6:36 PM, Chris_37 said: in my event handler handle damage but cant seem to get it to work any ideas? Do it in damaged EH instead. The revive handleDamage works out what damage the unit will receive. The damage EH will receive applied damage, specifically on the Incapacitated hit point when going incapacitated. //initPlayerLoacl.sqf #include "\a3\functions_f_mp_mark\revive\fn_reviveinit.sqf" params[ "_player" ]; _player addEventHandler [ "Dammaged", { params[ "_unit", "", "_damage", "", "_hitPoint", "_source" ]; if ( _damage >= 1 && { REVIVE_ENABLED( _unit ) && { _hitPoint == "Incapacitated" }}) then { if (!IN_VEHICLE(_unit)) then { //Unit being set to incapacitated //Do what ever //Test: Tell everyone this unit has been incapacitated format[ "Unit: %1 incapacitated", name _unit ] remoteExec [ "hint", 0 ]; }; }; }]; Put through very little testing. Keep in mind this may change with the coming update, especially the in vehicle part, as I believe they have made some changes to the revive system. 1 1 Share this post Link to post Share on other sites
Chris_37 0 Posted March 13, 2018 @Larrow @pierremgi thanks guys, don't suppose it s possible to stop the player from rolling over when Incapacitated? Share this post Link to post Share on other sites