BIS fnc holdActionAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add seeAlso BIS_fnc_holdKey link)
m (Fix example and remove related comment)
Line 14: Line 14:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [target,title,idleIcon,progressIcon,condShow,condProgress,codeStart,codeProgress,codeCompleted,codeInterupted,arguments,duration,priority,removeCompleted,showUncon] [[call]] [[BIS_fnc_holdActionAdd]]; |= Syntax
| [target,title,idleIcon,progressIcon,condShow,condProgress,codeStart,codeProgress,codeCompleted,codeInterupted,arguments,duration,priority,removeCompleted,showUncon] [[call]] [[BIS_fnc_holdActionAdd]] |= Syntax


|p1= target: [[Object]] - Object the action is attached to |= Parameter 1
|p1= target: [[Object]] - Object the action is attached to |= Parameter 1
Line 50: Line 50:
|p15= showUncon: [[BOOL]] -Show in unconscious state (default: false)|= Parameter 15
|p15= showUncon: [[BOOL]] -Show in unconscious state (default: false)|= Parameter 15


|x1= <code>[ [[player]],"Kill","","","[[true]]","[[true]]",{[[hint]] "Started!"},{[[systemChat]] [[str]] (_this select 4)},{[[player]] [[setDamage]] 1},{[[hint]] "Afraid of death?"},[],10,[[nil]],[[true]],[[false]]] [[call]] [[BIS_fnc_holdActionAdd]];</code>
|x1= <code><nowiki>[</nowiki>[[player]], "Kill", "", "", "[[true]]", "[[true]]", { [[hint]] "Started!" }, { [[systemChat]] [[str]] (_this select 4) }, { [[player]] [[setDamage]] 1 }, { [[hint]] "Afraid of death?" }, [], 10, [[nil]], [[true]], [[false]]] [[call]] [[BIS_fnc_holdActionAdd]];</code>
  |= Example 1
  |= Example 1
|x2= <code>[
|x2= <code>[
Line 68: Line 68:
     [[true]],                                                                                // Remove on completion
     [[true]],                                                                                // Remove on completion
     [[false]]                                                                                // Show in unconscious state  
     [[false]]                                                                                // Show in unconscious state  
] [[remoteExec]] ["[[BIS_fnc_holdActionAdd]]",-2,_myLaptop];                                 // example for MP compatible implementation</code>
] [[remoteExec]] ["[[BIS_fnc_holdActionAdd]]", [0,2] select [[isDedicated]], _myLaptop];           // example for MP compatible implementation</code>
  |= Example 2
  |= Example 2


Line 90: Line 90:
[[Category:{{Name|tkoh}}: Functions|{{uc:param}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:param}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:param}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:param}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on August 20, 2017 - 00:30 (UTC)</dd>
<dt class="note">[[User:Alwarren|Alwarren]]</dt>
<dd class="note">
Note that example 2 is a bit misleading. It works in multiplayer if and only if it runs on a dedicated server. On a hosted server (and probably in single player), the -2 (which means "run everywhere but the server") will prevent the code from running on the hosting player's machine, and the action will not be available for them.
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->

Revision as of 23:32, 11 February 2018

Hover & click on the images for description

Description

Description:
Adds an action to an object which requires the user to hold a key to perform the action.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[target,title,idleIcon,progressIcon,condShow,condProgress,codeStart,codeProgress,codeCompleted,codeInterupted,arguments,duration,priority,removeCompleted,showUncon] call BIS_fnc_holdActionAdd
Parameters:
target: Object - Object the action is attached to
title: String - Title of the action shown in the action menu
idleIcon: String - Pathi of the idle icon shown on screen. The path for vanilla icons is "\a3\ui_f\data\IGUI\Cfg\holdactions\..." (e.g. "holdAction_connect_ca.paa")
progressIcon: String - Path of the progress icon shown on screen
condShow: String - 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 - Condition for the action to progress.If false is returned action progress is halted; arguments passed into it are: _target, _caller, _id, _arguments
codeStart: Code - Code executed when action starts.
0: Object - target (_this select 0) - the object which the action is assigned to
1: Object - caller (_this select 1) - the unit that activated the action
3: Number - ID (_this select 2) - ID of the activated action (same as ID returned by addAction)
4: Array - arguments (_this select 3) - arguments given to the script if you are using the extended syntax
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]
codeInterupted: Code - Code executed on interrupted; arguments [target, caller, ID, arguments]
arguments: Array - Arguments passed to the scripts
duration: Number - Action duration; how much time it takes to complete the action
priority: Number - Priority; actions are arranged in descending order according to this value
removeCompleted: BOOL - Remove on completion (default: true)
showUncon: BOOL -Show in unconscious state (default: false)
Return Value:
Number - Action ID

Examples

Example 1:
[player, "Kill", "", "", "true", "true", { hint "Started!" }, { systemChat str (_this select 4) }, { 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,2] select isDedicated, _myLaptop]; // example for 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

Bottom Section

Posted on November 4, 2017 - 13:40 (UTC)
Lou Montana
Here's a list of all official icons so far (v1.76) :
  • "\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_revive_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa"
  • "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_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_unbind_ca.paa"