BIS fnc holdActionAdd: Difference between revisions
Jump to navigation
Jump to search
(added new icons) |
Lou Montana (talk | contribs) m (Highlight holdaction names) |
||
Line 14: | Line 14: | ||
| Adds an action to an object which requires the user to hold a key to perform the action.<br> | | Adds an action to an object which requires the user to hold a key to perform the action.<br> | ||
Available official icons as of {{arma3}} '''v2.00'' : <spoiler> | Available official icons as of {{arma3}} '''v2.00''' : <spoiler> | ||
* "\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\ | * "\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_'''loadVehicle'''_ca.paa" | ||
* "\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\ | * "\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_'''unloadVehicle'''_ca.paa" | ||
* "\a3\missions_f_oldman\data\img\holdactions\ | * "\a3\missions_f_oldman\data\img\holdactions\holdAction_'''box'''_ca.paa" | ||
* "\a3\missions_f_oldman\data\img\holdactions\ | * "\a3\missions_f_oldman\data\img\holdactions\holdAction_follow_'''start'''_ca.paa" | ||
* "\a3\missions_f_oldman\data\img\holdactions\ | * "\a3\missions_f_oldman\data\img\holdactions\holdAction_follow_'''stop'''_ca.paa" | ||
* "\a3\missions_f_oldman\data\img\holdactions\ | * "\a3\missions_f_oldman\data\img\holdactions\holdAction_'''talk'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''connect'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''forceRespawn'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''hack'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''loaddevice'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''passleadership'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''requestleadership'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''reviveMedic'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''revive'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''search'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''secure'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''takeOff1'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''takeOff2'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''thumbsdown'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''thumbsup'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''unbind'''_ca.paa" | ||
* "\a3\ui_f\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_'''unloaddevice'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\'''attack'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\'''destroy'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\holdAction_'''market'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\holdAction_'''sleep2'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\holdAction_'''sleep'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\'''map'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\'''meet'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\'''refuel'''_ca.paa" | ||
* "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\ | * "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\'''repair'''_ca.paa" | ||
</spoiler> |Description= | </spoiler> |Description= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 67: | Line 67: | ||
|p7= codeStart: [[Code]] - Code executed when action starts. Passed arguments are: | |p7= codeStart: [[Code]] - Code executed when action starts. Passed arguments are: | ||
<syntaxhighlight lang="cpp">params ["_target", "_caller", "_actionId", "_arguments"];</syntaxhighlight> | <syntaxhighlight lang="cpp">params ["_target", "_caller", "_actionId", "_arguments"];</syntaxhighlight> | ||
* | * target: [[Object]] - the object which the action is assigned to | ||
* | * caller: [[Object]] - the unit that activated the action | ||
* | * actionId: [[Number]] - ID of the activated action (same as ID returned by addAction) | ||
* | * arguments: [[Array]] - arguments given to the function |Parameter 7= | ||
|p8= codeProgress: [[Code]] - Code executed on every progress tick. Passed arguments are: | |p8= codeProgress: [[Code]] - Code executed on every progress tick. Passed arguments are: | ||
<syntaxhighlight lang="cpp">params ["_target", "_caller", "_actionId", "_arguments", "_progress", "_maxProgress"];</syntaxhighlight> | <syntaxhighlight lang="cpp">params ["_target", "_caller", "_actionId", "_arguments", "_progress", "_maxProgress"];</syntaxhighlight> | ||
* | * target: [[Object]] - the object which the action is assigned to | ||
* | * caller: [[Object]] - the unit that activated the action | ||
* | * actionId: [[Number]] - ID of the activated action (same as ID returned by addAction) | ||
* | * arguments: [[Array]] - arguments given to the function | ||
* | * progress: [[Number]] - currentProgress; progress goes from 1 to 24 | ||
* | * maxProgress: [[Number]] - max progress (24) |Parameter 8= | ||
|p9= codeCompleted: [[Code]] - code executed on completion. Passed arguments are: | |p9= codeCompleted: [[Code]] - code executed on completion. Passed arguments are: | ||
Line 101: | Line 101: | ||
|x1= <code><nowiki>[</nowiki>[[player]], "Kill", "", "", "[[true]]", "[[true]]", { [[hint]] "Started!" }, { [[systemChat]] [[str]] ([[_this]] [[select]] 3) }, { [[player]] [[setDamage]] 1 }, { [[hint]] "Afraid of death?" }, [], 10, [[nil]], [[true]], [[false]]] [[call]] [[BIS_fnc_holdActionAdd]];</code> |Example 1= | |x1= <code><nowiki>[</nowiki>[[player]], "Kill", "", "", "[[true]]", "[[true]]", { [[hint]] "Started!" }, { [[systemChat]] [[str]] ([[_this]] [[select]] 3) }, { [[player]] [[setDamage]] 1 }, { [[hint]] "Afraid of death?" }, [], 10, [[nil]], [[true]], [[false]]] [[call]] [[BIS_fnc_holdActionAdd]];</code> |Example 1= | ||
|x2= <code>[ | |x2= <code>[ | ||
_myLaptop, {{ | _myLaptop, {{cc|Object the action is attached to}} | ||
"Hack Laptop", {{ | "Hack Laptop", {{cc|Title of the action}} | ||
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{ | "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{cc|Idle icon shown on screen}} | ||
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{ | "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", {{cc|Progress icon shown on screen}} | ||
"_this [[distance]] _target < 3", {{ | "_this [[distance]] _target < 3", {{cc|Condition for the action to be shown}} | ||
"_caller [[distance]] _target < 3", {{ | "_caller [[distance]] _target < 3", {{cc|Condition for the action to progress}} | ||
{}, {{ | {}, {{cc|Code executed when action starts}} | ||
{}, {{ | {}, {{cc|Code executed on every progress tick}} | ||
{ _this [[call]] MY_fnc_hackingCompleted }, {{ | { _this [[call]] MY_fnc_hackingCompleted }, {{cc|Code executed on completion}} | ||
{}, {{ | {}, {{cc|Code executed on interrupted}} | ||
[], {{ | [], {{cc|Arguments passed to the scripts as _this select 3}} | ||
12, {{ | 12, {{cc|Action duration [s]}} | ||
0, {{ | 0, {{cc|Priority}} | ||
[[true]], {{ | [[true]], {{cc|Remove on completion}} | ||
[[false]] {{ | [[false]] {{cc|Show in unconscious state }} | ||
] [[remoteExec]] ["[[BIS_fnc_holdActionAdd]]", 0, _myLaptop]; {{ | ] [[remoteExec]] ["[[BIS_fnc_holdActionAdd]]", 0, _myLaptop]; {{cc|MP compatible implementation}}</code> |Example 2= | ||
| [[Number]] - Action ID |Return value= | | [[Number]] - Action ID |Return value= | ||
Line 128: | Line 128: | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on August 4, 2019 - 10:46 (UTC)</dd> | <dd class="notedate">Posted on August 4, 2019 - 10:46 (UTC)</dd> | ||
<dt class="note">[[User:R3vo|R3vo]]</dt> | <dt class="note">[[User:R3vo|R3vo]]</dt> | ||
Line 142: | Line 133: | ||
Keep in mind that '''Example 2''' adds the action to every client and JIP, but also adds it when it was already removed. E.g., Laptop has already been hacked by a player. | Keep in mind that '''Example 2''' adds the action to every client and JIP, but also adds it when it was already removed. E.g., Laptop has already been hacked by a player. | ||
</dd> | </dd> | ||
<dd class="notedate">Posted on December 30, 2019 - 03:13 (UTC)</dd> | <dd class="notedate">Posted on December 30, 2019 - 03:13 (UTC)</dd> | ||
<dt class="note">[[User:demellion|demellion]]</dt> | <dt class="note">[[User:demellion|demellion]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
All the incoming parameters are also mutually shared with '''codeStart''', '''codeProgress''', '''codeCompleted''' and '''codeInterrupted''' as they all running in the same scope. The full list of [[params]] shared: | All the incoming parameters are also mutually shared with '''codeStart''', '''codeProgress''', '''codeCompleted''' and '''codeInterrupted''' as they all running in the same scope. The full list of [[params]] shared: | ||
<code>_arguments params [ | <code>_arguments [[params]] [ | ||
"_a0", | "_a0", | ||
"_a1", | "_a1", | ||
Line 177: | Line 164: | ||
Where '''_a0-_a9''' are actual range of [[params]] coming from '''arguments''' inputted in [[BIS_fnc_holdActionAdd]] function call. | Where '''_a0-_a9''' are actual range of [[params]] coming from '''arguments''' inputted in [[BIS_fnc_holdActionAdd]] function call. | ||
</dd> | </dd> | ||
<!-- Note Section END --> | |||
</dl> | </dl> | ||
< | |||
<h3 style="display:none">Bottom Section</h3> |
Revision as of 19:24, 3 December 2020
Description
- Description:
- Adds an action to an object which requires the user to hold a key to perform the action.
Available official icons as of Arma 3 v2.00 :- "\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_loadVehicle_ca.paa"
- "\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_unloadVehicle_ca.paa"
- "\a3\missions_f_oldman\data\img\holdactions\holdAction_box_ca.paa"
- "\a3\missions_f_oldman\data\img\holdactions\holdAction_follow_start_ca.paa"
- "\a3\missions_f_oldman\data\img\holdactions\holdAction_follow_stop_ca.paa"
- "\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_forceRespawn_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_passleadership_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_requestleadership_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_revive_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff1_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_takeOff2_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_thumbsdown_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_thumbsup_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa"
- "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\attack_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\destroy_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\holdAction_market_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\holdAction_sleep2_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\holdAction_sleep_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\map_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\meet_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\refuel_ca.paa"
- "\a3\ui_f_oldman\data\IGUI\Cfg\holdactions\repair_ca.paa"
- Execution:
- call
- Groups:
- Interaction
Syntax
- Syntax:
- [target, title, idleIcon, progressIcon, conditionShow, conditionProgress, codeStart, codeProgress, codeCompleted, codeInterrupted, arguments, duration, priority, removeCompleted, showUnconscious, showWindow] call BIS_fnc_holdActionAdd
- Parameters:
- target: Object - Object the action is attached to
- title: String - Title of the action shown in the action menu.It can contain Structured Text tags, such as
<t color='#FFAA00'>text</t>
- idleIcon: String - Path of the idle icon shown on screen
- progressIcon: String - Path of the progress icon shown on screen
- conditionShow: String - Condition for the action to be shown.
Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit) - conditionProgress: String - Condition for the action to progress; if false is returned action progress is paused.
Special arguments passed to the code: _target, _caller, _id, _arguments - codeStart: Code - Code executed when action starts. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments"];
- codeProgress: Code - Code executed on every progress tick. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments", "_progress", "_maxProgress"];
- target: Object - the object which the action is assigned to
- caller: Object - the unit that activated the action
- actionId: Number - ID of the activated action (same as ID returned by addAction)
- arguments: Array - arguments given to the function
- progress: Number - currentProgress; progress goes from 1 to 24
- maxProgress: Number - max progress (24)
- codeCompleted: Code - code executed on completion. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments"]; // same as codeStart
- codeInterrupted: Code - code executed on interrupted. Passed arguments are:
params ["_target", "_caller", "_actionId", "_arguments"]; // same as codeCompleted
- arguments: Array - arguments passed to the scripts
- duration: Number - action duration, a.k.a how much time it takes to complete the action
- priority: Number - priority value; actions are arranged in descending order according to this value
- removeCompleted: Boolean - (Optional, default true) remove on completion
- showUnconscious: Boolean - (Optional, default false) show in unconscious state
- showWindow: Boolean - (Optional, default true) show on screen; if false action needs to be selected from action menu to appear on screen
- Return Value:
- Number - Action ID
Examples
- Example 1:
[player, "Kill", "", "", "true", "true", { hint "Started!" }, { systemChat str (_this select 3) }, { player setDamage 1 }, { hint "Afraid of death?" }, [], 10, nil, true, false] call BIS_fnc_holdActionAdd;
- Example 2:
[ _myLaptop, // Object the action is attached to "Hack Laptop", // Title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Idle icon shown on screen "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Progress icon shown on screen "_this distance _target < 3", // Condition for the action to be shown "_caller distance _target < 3", // Condition for the action to progress {}, // Code executed when action starts {}, // Code executed on every progress tick { _this call MY_fnc_hackingCompleted }, // Code executed on completion {}, // Code executed on interrupted [], // Arguments passed to the scripts as _this select 3 12, // Action duration [s] 0, // Priority true, // Remove on completion false // Show in unconscious state ] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop]; // MP compatible implementation
Additional Information
- See also:
- BIS_fnc_holdActionRemoveBIS_fnc_holdKey
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
Notes
- Posted on August 4, 2019 - 10:46 (UTC)
- R3vo
- Keep in mind that Example 2 adds the action to every client and JIP, but also adds it when it was already removed. E.g., Laptop has already been hacked by a player.
- Posted on December 30, 2019 - 03:13 (UTC)
- demellion
-
All the incoming parameters are also mutually shared with codeStart, codeProgress, codeCompleted and codeInterrupted as they all running in the same scope. The full list of params shared:
_arguments params [ "_a0", "_a1", "_a2", "_a3", "_a4", "_a5", "_a6", "_a7", "_a8", "_a9", "_target", "_title", "_iconIdle", "_iconProgress", "_condShow", "_condProgress", "_codeStart", "_codeProgress", "_codeCompleted", "_codeInterrupted", "_duration", "_removeCompleted" ];
Where _a0-_a9 are actual range of params coming from arguments inputted in BIS_fnc_holdActionAdd function call.