removeAllActions: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
(Add warning and examples)
 
(25 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command


| arma3 |Game name=
|game1= arma3
|version1= 0.50


|0.50|Game version=
|arg= global


|arg= global |Multiplayer Arguments=
|eff= local


|eff= local |Multiplayer Effects=
|gr1= Interaction


|gr1= Interaction |GROUP1=
|descr= Removes all unit's user added actions.
{{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]].}}


| Removes all unit's user added actions.  |DESCRIPTION=
|s1= [[removeAllActions]] obj


| '''removeAllActions''' unit |SYNTAX=
|p1= obj: [[Object]]


|p1= unit: [[Object]] - unit, vehicle or static object  |PARAMETER1=
|r1= [[Nothing]]


| [[Nothing]] |RETURNVALUE=  
|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>


|x1= <code>[[removeAllActions]] [[player]];</code>|EXAMPLE1=
|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]]
| [[actionIDs]], [[actionParams]], [[addAction]], [[setUserActionText]], [[inGameUISetEventHandler]], [[showHUD]], [[inputAction]], [[removeAction]], [[action]] |SEEALSO=
 
|  |MPBEHAVIOUR=
}}
}}
<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on 30 October, 2013
<dt class="note">[[User:Druid|Druid]]
<dd class="note">
Syntax of this command was until Arma 3 ver. 1.06: ''unit'' '''removeAllActions''' ''number''
<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|New Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}

Latest revision as of 11:37, 27 July 2022

Hover & click on the images for description

Description

Description:
Removes all unit's user added actions.
This command's syntax was unit removeAllActions number from Arma 3 v0.50 to v1.06.
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.
Groups:
Interaction

Syntax

Syntax:
removeAllActions obj
Parameters:
obj: Object
Return Value:
Nothing

Examples

Example 1:
removeAllActions player;
Example 2:
Do
private _actionId = player addAction ["Heal self", { player setDamage 0; }]; // ... player removeAction _actionId;
Don't
player addAction ["Heal self", { player setDamage 0; }]; // ... removeAllActions player;
Example 3:
Do
player addAction ["Heal self (once)", { params ["_target", "", "_actionId"]; _target setDamage 0; _target removeAction _actionId; }];
Don't
player addAction ["Heal self (once)", { player setDamage 0; removeAllActions player; }];

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