aseliot 2 Posted March 15, 2017 https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/inGameUISetEventHandler#Action I cannot get this thing to work i've added it to the target unit and to the player but when I perform an action the handler doesn't do anything. I have unit A that needs to be rescued by the player, so there is an action added to A. So i've done both situations of adding the handler to either unit A or the player and it doesn't seem do anything for either of them? I also checked wether it is added and it is as systemChat in the text block display in the case of the switch. Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted March 15, 2017 How are you calling the eventhandler? "Doesn't do anything" doesn't do anything to help you with your problem. Cheers 1 Share this post Link to post Share on other sites
aseliot 2 Posted March 15, 2017 8 minutes ago, Grumpy Old Man said: How are you calling the eventhandler? "Doesn't do anything" doesn't do anything to help you with your problem. Cheers Not sure what you mean the handler description says "Triggers on action key press.". The handler should fire when the player interacts with another unit that has an action added to it. Share this post Link to post Share on other sites
killzone_kid 1326 Posted March 15, 2017 1 hour ago, aseliot said: i've added it to the target unit and to the player Not sure what you mean, it is not an entity EH you can add to a unit Share this post Link to post Share on other sites
aseliot 2 Posted March 15, 2017 5 minutes ago, killzone_kid said: Not sure what you mean, it is not an entity EH you can add to a unit Heh oh now I see... why would you need that for, and why is it only for UI... I've been searching for an event handler that I can use when a unit performs an action, then I need the event handler to fire somehow. I tried damaging the unit etc (with value 0.1) but things either don't seem to work or on AnimDone way too many times without having a chance to stop it. Is there no event handler that I can use for this? Doesn't really matter if I have to put a line of code into the action to let the EH register it. Share this post Link to post Share on other sites
killzone_kid 1326 Posted March 15, 2017 So does this not work? unitA addAction ["Rescue Me", {hint "I'm rescued!!!"}]; Share this post Link to post Share on other sites
aseliot 2 Posted March 15, 2017 43 minutes ago, killzone_kid said: So does this not work? unitA addAction ["Rescue Me", {hint "I'm rescued!!!"}]; Yes it does, but I need the addaction to fire an eventhandler somehow, doesn't really matter to me what event it is. This is for the sake of not putting task related code in my unit spawning behaviour code otherwise it becomes a mess. So it would've been perfect to have an event handler that fires on an action. Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted March 15, 2017 18 minutes ago, aseliot said: Yes it does, but I need the addaction to fire an eventhandler somehow, doesn't really matter to me what event it is. This is for the sake of not putting task related code in my unit spawning behaviour code otherwise it becomes a mess. So it would've been perfect to have an event handler that fires on an action. It's still not clear what exactly you wanna do. What exactly is stopping you from running code out of the addAction once executed? Splitting stuff up into multiple functions usually does the trick, so you don't need to have everything inside a single file, if that's what you meant: //MyFunctions.sqf: TAG_fnc_MyRescueFunction = { params ["_target","_caller","_ID"]; hint format ["I, %1, was just rescued by %2!!!",name _target,name _caller] }; //Unitspawn.sqf: unitA addAction ["Rescue Me", {_this call TAG_fnc_MyRescueFunction}]; Cheers Share this post Link to post Share on other sites
killzone_kid 1326 Posted March 15, 2017 Or add scripting event handler BIS_fnc_addScriptedEventHandler Share this post Link to post Share on other sites
aseliot 2 Posted March 15, 2017 2 hours ago, killzone_kid said: Or add scripting event handler BIS_fnc_addScriptedEventHandler Hey that's great, that fixes everything :o Share this post Link to post Share on other sites