VN_fnc_holdActionAdd
VN_fnc_holdActionAdd
Add a hold action. If the hold actions are not initialized yet, initialize the system first. See BIS_fnc_holdActionAdd.
Syntax
[
target,
title,
iconIdle,
iconProgress,
condShow,
condProgress,
codeStart,
codeProgress,
codeCompleted,
codeInterrupted,
arguments,
duration,
priority,
removeCompleted,
showUnconscious,
showWindow
] call VN_fnc_holdActionAddParameters
| Parameter | Type | Default | Description |
|---|---|---|---|
target |
Object | objNull |
object action is attached to |
title |
String | "MISSING TITLE" |
action title text shown in action menu |
iconIdle |
String or Code | "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa" |
idle icon shown on screen; if Code is used, it needs to return the path to icon |
iconProgress |
String or Code | "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa" |
progress icon shown on screen; if Code is used, it needs to return the path to icon |
condShow |
String | "true" |
condition for the action to be shown; special variables passed to the script code are _target (unit to which action is attached to) and _this (caller/executing unit) |
condProgress |
String | "true" |
condition for the action to progress; if false is returned action progress is halted; arguments passed into it are: _target, _caller, _id and _arguments |
codeStart |
Code | {} |
code executed on start; arguments passed via the _this variable are [target, caller, ID, arguments]:• target: Object - (_this select 0) the object which the action is assigned to • caller: Object - (_this select 1) the unit that activated the action • id: Number - (_this select 2) id of the activated action (same as ID returned by addAction) • arguments: Array - (_this select 3) - arguments given to the script if the extended syntax is used |
codeProgress |
Code | {} |
code executed on every progress tick; arguments [target, caller, ID, arguments, currentProgress]; max progress is always 24 |
codeCompleted |
Code | {} |
code executed on completion; arguments [target, caller, ID, arguments] |
codeInterrupted |
Code | {} |
code executed on interrupted; arguments [target, caller, ID, arguments] |
arguments |
Array | [] |
arguments passed to the scripts |
duration |
Number | 10 |
action duration; how much time it takes to complete the action |
priority |
Number | 1000 |
actions are arranged in descending order according to this value |
removeCompleted |
Boolean | true |
remove on completion |
showUnconscious |
Boolean | false |
show in unconscious state |
showWindow |
Boolean | true |
show on screen; if false action needs to be selected from action menu to appear on screen |
Return value
Number - action id that can be used for removal or referencing from other functions
Examples
[
player,
"Don't hold this action!",
nil,
nil,
nil,
nil,
"hint 'please don't...",
nil,
{ hint 'I -told- you!'; player setDamage 1 },
{ hint "phew, you didn't."; (_this select 0) removeAction (_this select 2) },
nil,
6
] call VN_fnc_holdActionAdd