HazJ 1288 Posted December 21, 2018 Quote If action is added to player, condition is evaluated all the time. https://community.bistudio.com/wiki/addAction actRevive = player addAction [format [localize "STR_action_revive", name cursorObject], { [cursorObject, (_this select 0)] spawn Haz_fnc_revive; }, [], 0, false, false, "", "_this distance cursorObject <= 4 && cursorObject getVariable [""isUnconscious"", FALSE] && !(cursorObject getVariable [""isBeingRevived"", FALSE])"]; Something soo simple... Share this post Link to post Share on other sites
Dedmen 2588 Posted December 21, 2018 Just add the action to the target? Instead of yourself? You are taking the name of the object that was being looked at when the action was added, not when the action is executed. Or https://community.bistudio.com/wiki/setUserActionText 1 Share this post Link to post Share on other sites
davidoss 550 Posted December 21, 2018 Use cursorTarget instead of cursorObject 1 Share this post Link to post Share on other sites
Dedmen 2588 Posted December 21, 2018 12 minutes ago, davidoss said: Use cursorTarget instead of cursorObject uh. no. 2 Share this post Link to post Share on other sites
HazJ 1288 Posted December 21, 2018 8 hours ago, Dedmen said: Just add the action to the target? Instead of yourself? You are taking the name of the object that was being looked at when the action was added, not when the action is executed. Or https://community.bistudio.com/wiki/setUserActionText Yeah. That is one method. Anyway without doing it that way? I did try setUserActionText however still can't get it to update. Share this post Link to post Share on other sites
davidoss 550 Posted December 21, 2018 actRevive = player addAction [ localize "STR_action_revive", { [cursorObject, (_this select 0)] spawn Haz_fnc_revive; }, [], 0, false, false, "", "_this distance cursorObject <= 4 && cursorObject getVariable [""isUnconscious"", FALSE] && !(cursorObject getVariable [""isBeingRevived"", FALSE])"]; [] spawn { while {alive player} do { waitUntil {sleep 1; !isNull cursorTarget && {cursorTarget getVariable ["isUnconscious", FALSE]}}; player setUserActionText [ actRevive, format [localize "STR_action_revive", name cursorTarget]; }; }; ??? Share this post Link to post Share on other sites
HazJ 1288 Posted December 21, 2018 No no. That is just a really bad idea. Thanks though. A while loop with a waitUntil? It really is Christmas. lol! Why does it get Error no vehicle? It is actually evaluating each time but the name part is failing? Share this post Link to post Share on other sites
Grumpy Old Man 3540 Posted December 21, 2018 15 minutes ago, davidoss said: actRevive = player addAction [ localize "STR_action_revive", { [cursorObject, (_this select 0)] spawn Haz_fnc_revive; }, [], 0, false, false, "", "_this distance cursorObject <= 4 && cursorObject getVariable [""isUnconscious"", FALSE] && !(cursorObject getVariable [""isBeingRevived"", FALSE])"]; [] spawn { while {alive player} do { waitUntil {sleep 1; !isNull cursorTarget && {cursorTarget getVariable ["isUnconscious", FALSE]}}; player setUserActionText [ actRevive, format [localize "STR_action_revive", name cursorTarget]; }; }; ??? No need for a separate loop: _ID = player addAction [name cursorObject, {}, [], 0, false, false, "", "_target setUserActionText [_target getVariable ['TAG_fnc_myActionID',-1], name cursorObject];_target distance cursorObject <= 4"]; player setVariable ["TAG_fnc_myActionID",_ID]; Cheers 1 1 Share this post Link to post Share on other sites
HazJ 1288 Posted December 21, 2018 Thank you @Grumpy Old Man! I ditched the getVariable, don't need that part. _target setUserActionText [actRevive, format [localize ""STR_action_revive"", name cursorObject]]; Shame you can't directly get _id in the condition field. No big deal as ID to stored on actRevive handle so. Quote _target: Object - the object to which action is attached or, if the object is a unit inside of vehicle, the vehicle _this: Object - caller person to whom the action is shown (or not shown if condition returns false) _originalTarget: Object - the original object to which the action is attached, regardless if the object/unit is in a vehicle or not Share this post Link to post Share on other sites
pierremgi 4739 Posted December 22, 2018 13 hours ago, davidoss said: Use cursorTarget instead of cursorObject It's not a problem if you don't aim at the primaryweapon of the "target"... Share this post Link to post Share on other sites