Game Master: Context Action Creation – Arma Reforger
Lou Montana (talk | contribs) m (Fix link) |
Lou Montana (talk | contribs) m (Text replacement - "\{\{Link\|enfusion.*\.c\|([A-Za-z0-9_]+)\}\}" to "{{Link/Enfusion|armaR|$1}}") |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
== Script Creation == | == Script Creation == | ||
To create a context action you will need to create a new class inheriting from | To create a context action you will need to create a new class inheriting from {{Link/Enfusion|armaR|SCR_GeneralContextAction}}. | ||
There are three main methods you will be using: | There are three main methods you will be using: | ||
Line 35: | Line 35: | ||
! Description | ! Description | ||
|- | |- | ||
| | | {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/Editor/ActionLists/Context/TempEdit.conf|TempEdit.conf}} | ||
| Edit mode config | | Edit mode config | ||
|- | |- | ||
| | | {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/Editor/ActionLists/Context/TempAdmin.conf|TempAdmin.conf}} | ||
| Admin mode config | | Admin mode config | ||
|- | |- | ||
| | | {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/Editor/ActionLists/Context/TempPhoto.conf|TempPhoto.conf}} | ||
| Photo mode config | | Photo mode config | ||
|- | |- | ||
| | | {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/Editor/ActionLists/Context/Shared.conf|Shared.conf}} | ||
| All modes config | | All modes config | ||
|- | |- | ||
| | | {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/Editor/ActionLists/Context/Tasks.conf|Tasks.conf}} | ||
| Player tasks config | | Player tasks config | ||
|} | |} | ||
Line 53: | Line 53: | ||
Next, locate the config you want and press the '''+''' icon to add your own context action. | Next, locate the config you want and press the '''+''' icon to add your own context action. | ||
=== UI Info === | |||
== UI Info == | |||
Now that the action is added you will have to fill in the variables. We will start with the Info. Press the Set Class button and select SCR_UIInfo from the list. | Now that the action is added you will have to fill in the variables. We will start with the Info. Press the Set Class button and select SCR_UIInfo from the list. | ||
Line 74: | Line 73: | ||
|} | |} | ||
=== Additional Variables === | |||
== Additional Variables == | |||
The base class has some additional variables. | The base class has some additional variables. | ||
{{Feature|informative| | {{Feature|informative| | ||
More advanced classes, located in {{hl|Data\scripts\Game\Editor\Containers\Actions\ContextActions\}} (like | More advanced classes, located in {{hl|Data\scripts\Game\Editor\Containers\Actions\ContextActions\}} (like {{Link/Enfusion|armaR|SCR_DoubleClickAction}}) exist that may offer more options than the default ones listed here but these will not be covered. | ||
}} | }} | ||
Line 102: | Line 100: | ||
|- | |- | ||
| Shortcut | | Shortcut | ||
| Add an Input action name (defined in {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/System/chimeraInputCommon.conf|chimeraInputCommon.conf}}, e.g {{hl|ManualCameraTeleportPlayer}}) if you want the action also to be executed via shortcut. Note that | | Add an Input action name (defined in {{Link|enfusion://ResourceManager/~ArmaReforger:Configs/System/chimeraInputCommon.conf|chimeraInputCommon.conf}}, e.g {{hl|ManualCameraTeleportPlayer}}) if you want the action also to be executed via shortcut. Note that <enforce inline>CanBePerformed()</enforce> will still be checked. | ||
|- | |- | ||
| Enable Shortcut Logics | | Enable Shortcut Logics | ||
Line 117: | Line 115: | ||
|- | |- | ||
| IsServer | | IsServer | ||
| The action is performed on the server if this is true, otherwise it is performed locally. Note that | | The action is performed on the server if this is true, otherwise it is performed locally. Note that <enforce inline>CanBeShown()</enforce> and <enforce inline>CanBePerformed()</enforce> are still checked locally. | ||
|- | |- | ||
| Hide On Hover | | Hide On Hover | ||
Line 129: | Line 127: | ||
{{GameCategory|armaR|Modding|Tutorials}} | {{GameCategory|armaR|Modding|Tutorials|Game Master}} |
Latest revision as of 12:04, 5 January 2023
Context actions are actions the Game Master can do by opening the context menu such as Cast lighting, Delete entity, etc. Context actions change depending on if the Game Master is focusing on an entity and on the type of entities. The following is a guide about how to create new context actions.
Script Creation
To create a context action you will need to create a new class inheriting from SCR_GeneralContextAction.
There are three main methods you will be using:
Method | Description |
---|---|
CanBeShown() | Whether or not the context action will be shown in the menu. Check here if the hovered/selected entities are the ones your action requires. The action cannot be performed (not even with the shortcut) if it is not shown. |
CanBePerformed() | Whether or not the action can be performed. The action will be shown but locked. By the time of writing only gamepad shows locked actions. This will also be checked for Shortcuts. |
Perform() | Here you actually execute the action. Write the code to perform the action here |
Config Modding
Context actions are (generally) mode-specific so decide in which mode(s) the player can execute the action.
Context actions configs are located in
Config | Description |
---|---|
TempEdit.conf | Edit mode config |
TempAdmin.conf | Admin mode config |
TempPhoto.conf | Photo mode config |
Shared.conf | All modes config |
Tasks.conf | Player tasks config |
Next, locate the config you want and press the + icon to add your own context action.
UI Info
Now that the action is added you will have to fill in the variables. We will start with the Info. Press the Set Class button and select SCR_UIInfo from the list.
This will get you the following UI Info variables to fill in:
Variable | Description |
---|---|
Name | Action's display name |
Description | Tooltip description when focusing on the action |
Icon | Action's icon |
Additional Variables
The base class has some additional variables.
Variable | Description |
---|---|
Enabled | Simply if this config action is to be considered or not. Useful for debug/development purpose. |
Info | See UI Info above. |
Action Type | Purely visible and only used in tool bars. Keep on ACTION for context actions. |
Action Group | Makes sure actions are group together. Keep NONE for context actions. |
Order | This dictates the order of the action. The higher the number the higher the action is in the list. Actions with the same order are ordered the same as in the config array. |
Shortcut | Add an Input action name (defined in chimeraInputCommon.conf, e.g ManualCameraTeleportPlayer) if you want the action also to be executed via shortcut. Note that CanBePerformed() will still be checked. |
Enable Shortcut Logics | Will allow the "Shortcut" to work if true. You might want to execute the shortcut action from a different location. So "Shortcut" is purely informative. |
Effects | Array of effects when the action is performed such as sound, particle, UI effects. |
Cooldown Time | Cooldown to prevent spamming of action. Leave zero or less to ignore, duration is in seconds. |
Show On Cooldown Notification | If true will show notification if trying to perform the action if the cooldown is active. |
IsServer | The action is performed on the server if this is true, otherwise it is performed locally. Note that CanBeShown() and CanBePerformed() are still checked locally. |
Hide On Hover | The action is hidden when the cursor is hovering above an entity. |
Hide On Selected | The action is hidden if any entity is selected. |