UserActions: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) (Remove Clarification requests) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Defines an action to be associated with the current object class. Commonly used for operating doors on vehicles. | Defines an action to be associated with the current object class. Commonly used for operating doors on vehicles. | ||
Line 5: | Line 4: | ||
== Class Properties == | == Class Properties == | ||
* '''displayName''': [[String]] - | * '''displayName''': [[String]] - this is the name displayed in the action menu. It supports [[Structured Text]] syntax, for including icons or changing the text appearance. | ||
* '''displayNameDefault''': [[String]] - | * '''displayNameDefault''': [[String]] - this is the name displayed near mid screen. It supports [[Structured Text]] syntax, for including icons or changing the text appearance. Often, only an icon is used in this case. | ||
* '''priority''': [[Number]] - | * '''priority''': [[Number]] - priority value of the action. Actions will be arranged descending according to this. Value can be negative or decimal. Actions with same values will be arranged in order which they were made, newest at the bottom. Typical range is 0 (low priority) to 6 (high priority). | ||
* '''radius''': [[Number]] - | * '''radius''': [[Number]] - defines the range to the object at which the action will become available. Value is in metres. | ||
* '''position''': [[String]] - | * '''position''': [[String]] - memory point which acts as the centre for the radius check. {{Link|https://feedback.bistudio.com/T126930#1649747|May be replaced with named selections (actionNamedSel) in Tac-Ops DLC}} | ||
* '''showWindow''': [[Number]] or [[Boolean]] - | * '''showWindow''': [[Number]] or [[Boolean]] - if set to 1 or [[true]], players see the ''displayNameDefault'' name appear near mid screen as they approach the object if the priority is higher than other available actions. Set to 0 or [[false]] to turn it off. | ||
* '''hideOnUse''': [[Number]] or [[Boolean]] - | * '''hideOnUse''': [[Number]] or [[Boolean]] - if set to 1 or [[true]], it will hide the action menu after selecting that action. If set to 0 or "false", it will leave the action menu open and visible after selecting that action, leaving the same action highlighted, for the purpose of allowing you to reselect that same action quickly, or to select another action. | ||
* '''onlyForPlayer''': [[Number]] or [[Boolean]] - | * '''onlyForPlayer''': [[Number]] or [[Boolean]] - prevents the action from appearing in the commanding menu's action list ({{Controls|`}} → {{Controls|6}}) for an AI. | ||
* '''shortcut''': [[String]] - | * '''shortcut''': [[String]] - one of the [[:Category:Key Actions|key mapping names]] defined in class {{hl|CfgDefaultKeysMapping}} in bin.pbo (e.g. "moveForward"). | ||
* '''condition''': [[String]] - | * '''condition''': [[String]] - code that must return true for the action to be available. Some standard variables can be used in the evaluation. Variable [[Magic Variables#this_2|this]] references the object to which action is attached to. | ||
* '''statement''': [[String]] - | * '''statement''': [[String]] - code that is executed when the action is activated. Some standard variables can be used in the evaluation. Variable [[Magic Variables#this_2|this]] references object to which action is attached to. | ||
* '''aiMaxRange''': [[Number]] | * '''aiMaxRange''': [[Number]] radius at which an AI can see the action (in the commanding menu) | ||
== Examples == | == Examples == | ||
{{arma3}} example | |||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
class CfgVehicles | class CfgVehicles | ||
{ | { | ||
class Civilian; | class Civilian; | ||
class Civilian_F: Civilian | |||
class Civilian_F : Civilian | |||
{ | { | ||
class UserActions | class UserActions | ||
Line 34: | Line 35: | ||
displayNameDefault = "<img image='\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa'/>"; | displayNameDefault = "<img image='\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa'/>"; | ||
priority = 10; | priority = 10; | ||
radius = 10; // | radius = 10; // a too small radius might cause the action to not be visible | ||
position = "camera"; | position = "camera"; | ||
showWindow = 0; | showWindow = 0; | ||
Line 40: | Line 41: | ||
onlyForPlayer = 0; | onlyForPlayer = 0; | ||
shortcut = ""; | shortcut = ""; | ||
condition = "alive this && !isPlayer this"; // | condition = "alive this && !isPlayer this"; // only show if the unit is alive and is not a player | ||
statement = "if (selectRandom [true, false]) then { hint 'I do not have information for you!' } else { hint 'I tell you everything I know!' };"; | statement = "if (selectRandom [true, false]) then { hint 'I do not have information for you!' } else { hint 'I tell you everything I know!' };"; | ||
}; | }; | ||
Line 49: | Line 50: | ||
== See | == See Also == | ||
* [[addAction]] | * [[addAction]] |
Latest revision as of 15:34, 13 September 2024
Defines an action to be associated with the current object class. Commonly used for operating doors on vehicles.
Class Properties
- displayName: String - this is the name displayed in the action menu. It supports Structured Text syntax, for including icons or changing the text appearance.
- displayNameDefault: String - this is the name displayed near mid screen. It supports Structured Text syntax, for including icons or changing the text appearance. Often, only an icon is used in this case.
- priority: Number - priority value of the action. Actions will be arranged descending according to this. Value can be negative or decimal. Actions with same values will be arranged in order which they were made, newest at the bottom. Typical range is 0 (low priority) to 6 (high priority).
- radius: Number - defines the range to the object at which the action will become available. Value is in metres.
- position: String - memory point which acts as the centre for the radius check. May be replaced with named selections (actionNamedSel) in Tac-Ops DLC
- showWindow: Number or Boolean - if set to 1 or true, players see the displayNameDefault name appear near mid screen as they approach the object if the priority is higher than other available actions. Set to 0 or false to turn it off.
- hideOnUse: Number or Boolean - if set to 1 or true, it will hide the action menu after selecting that action. If set to 0 or "false", it will leave the action menu open and visible after selecting that action, leaving the same action highlighted, for the purpose of allowing you to reselect that same action quickly, or to select another action.
- onlyForPlayer: Number or Boolean - prevents the action from appearing in the commanding menu's action list (` → 6) for an AI.
- shortcut: String - one of the key mapping names defined in class CfgDefaultKeysMapping in bin.pbo (e.g. "moveForward").
- condition: String - code that must return true for the action to be available. Some standard variables can be used in the evaluation. Variable this references the object to which action is attached to.
- statement: String - code that is executed when the action is activated. Some standard variables can be used in the evaluation. Variable this references object to which action is attached to.
- aiMaxRange: Number radius at which an AI can see the action (in the commanding menu)
Examples
Arma 3 example
class CfgVehicles
{
class Civilian;
class Civilian_F : Civilian
{
class UserActions
{
class GetInformation
{
displayName = "Get Information";
displayNameDefault = "<img image='\a3\missions_f_oldman\data\img\holdactions\holdAction_talk_ca.paa'/>";
priority = 10;
radius = 10; // a too small radius might cause the action to not be visible
position = "camera";
showWindow = 0;
hideOnUse = 1;
onlyForPlayer = 0;
shortcut = "";
condition = "alive this && !isPlayer this"; // only show if the unit is alive and is not a player
statement = "if (selectRandom [true, false]) then { hint 'I do not have information for you!' } else { hint 'I tell you everything I know!' };";
};
};
};
};