removeAllActions: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<code>\[\[([a-zA-Z0-9_]+)\]\] +\[\[([a-zA-Z0-9_]+)\]\];?<\/code>" to "<sqf>$1 $2;</sqf>") |
Lou Montana (talk | contribs) (Add warning and examples) |
||
Line 11: | Line 11: | ||
|descr= Removes all unit's user added actions. | |descr= Removes all unit's user added actions. | ||
{{Feature | informative | This command's syntax was | {{Feature|informative|This command's syntax was <sqf inline>unit removeAllActions number</sqf> from {{arma3}} v0.50 to v1.06.}} | ||
{{Feature|important|Usage of this command is usually a bad practice unless justified by the situation; removing all actions in order to remove all actions that ''one'' added is not a good method as a mod or another script could have added its own actions as well and see them removed. Instead, store the action id returned by [[addAction]] either in a script variable or using [[setVariable]].}} | |||
|s1= [[removeAllActions]] | |s1= [[removeAllActions]] obj | ||
|p1= | |p1= obj: [[Object]] | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= <sqf>removeAllActions player;</sqf> | |x1= <sqf>removeAllActions player;</sqf> | ||
|x2= Do | |||
<sqf> | |||
private _actionId = player addAction ["Heal self", { player setDamage 0; }]; | |||
// ... | |||
player removeAction _actionId; | |||
</sqf> | |||
Don't | |||
<sqf> | |||
player addAction ["Heal self", { player setDamage 0; }]; | |||
// ... | |||
removeAllActions player; | |||
</sqf> | |||
|x3= Do | |||
<sqf> | |||
player addAction ["Heal self (once)", { | |||
params ["_target", "", "_actionId"]; | |||
_target setDamage 0; | |||
_target removeAction _actionId; | |||
}]; | |||
</sqf> | |||
Don't | |||
<sqf> | |||
player addAction ["Heal self (once)", { | |||
player setDamage 0; | |||
removeAllActions player; | |||
}]; | |||
</sqf> | |||
|seealso= [[actionIDs]] [[actionParams]] [[addAction]] [[setUserActionText]] [[inGameUISetEventHandler]] [[showHUD]] [[inputAction]] [[removeAction]] [[action]] | |seealso= [[actionIDs]] [[actionParams]] [[addAction]] [[setUserActionText]] [[inGameUISetEventHandler]] [[showHUD]] [[inputAction]] [[removeAction]] [[action]] | ||
}} | }} |
Latest revision as of 11:37, 27 July 2022
Description
- Description:
- Removes all unit's user added actions.
- Groups:
- Interaction
Syntax
- Syntax:
- removeAllActions obj
- Parameters:
- obj: Object
- Return Value:
- Nothing
Examples
- Example 1:
- removeAllActions player;
- Example 2:
- Do
Don't
- Example 3:
- Do
Don'tplayer addAction ["Heal self (once)", { params ["_target", "", "_actionId"]; _target setDamage 0; _target removeAction _actionId; }];
Additional Information
- See also:
- actionIDs actionParams addAction setUserActionText inGameUISetEventHandler showHUD inputAction removeAction action
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note