Game Master: Toolbar Action Creation – Arma Reforger
Lou Montana (talk | contribs) m (Text replacement - "inherent" to "inherit") |
Lou Montana (talk | contribs) m (Text replacement - "\{\{Link\|enfusion.*\.c\|([A-Za-z0-9_]+)\}\}" to "{{Link/Enfusion|armaR|$1}}") |
||
(One intermediate revision by one other user not shown) | |||
Line 12: | Line 12: | ||
! Description | ! Description | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_EditorToolbarAction}} | ||
| Basic functionality for toolbar actions. You click the button and something happens, very similar to Context actions (see also [[Arma Reforger:Game Master: Context Action Creation|Context Action Creation tutorial]]) | | Basic functionality for toolbar actions. You click the button and something happens, very similar to Context actions (see also [[Arma Reforger:Game Master: Context Action Creation|Context Action Creation tutorial]]) | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseToggleToolbarAction}} | ||
| A toggle action which can be toggled and untoggled; though in general the functionality is quite similar to SCR_EditorToolbarAction | | A toggle action which can be toggled and untoggled; though in general the functionality is quite similar to SCR_EditorToolbarAction | ||
|- | |- | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseCommandAction}} | ||
| Used for Faction and Command bar actions that take entity targets and have a built-in function to spawn a prefab. | | Used for Faction and Command bar actions that take entity targets and have a built-in function to spawn a prefab. | ||
|} | |} | ||
Line 42: | Line 42: | ||
|- | |- | ||
| <enforce inline>Track()</enforce> | | <enforce inline>Track()</enforce> | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseToggleToolbarAction}} only. Track events which influence the action. | ||
|- | |- | ||
| <enforce inline>Untrack()</enforce> | | <enforce inline>Untrack()</enforce> | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseToggleToolbarAction}} only. Untrack events which influence the action. | ||
|- | |- | ||
| <enforce inline>Toggle()</enforce> | | <enforce inline>Toggle()</enforce> | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseToggleToolbarAction}} only. Toggle action state. To be called by inherited classes. | ||
|} | |} | ||
Line 83: | Line 83: | ||
=== UI Info === | === UI Info === | ||
Now that the action is added you will have to fill in the variables. We will start with the UI Info. Press the Set Class button and select {{Link| | Now that the action is added you will have to fill in the variables. We will start with the UI Info. Press the Set Class button and select {{Link/Enfusion|armaR|SCR_UIInfo}} from the list. | ||
This will get you the following UI Info variables to fill in: | This will get you the following UI Info variables to fill in: | ||
Line 118: | Line 118: | ||
|- | |- | ||
| Command Prefab | | Command Prefab | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseCommandAction}} only. The prefab that will be spawned when toggling the button. | ||
|- | |- | ||
| Effects | | Effects | ||
Line 127: | Line 127: | ||
|- | |- | ||
| Info Toggled | | Info Toggled | ||
| {{Link| | | {{Link/Enfusion|armaR|SCR_BaseToggleToolbarAction}} only. The Name, Description and Icon of a toggled button. | ||
|- | |- | ||
| Order | | Order | ||
Line 139: | Line 139: | ||
{{GameCategory|armaR|Modding|Tutorials}} | {{GameCategory|armaR|Modding|Tutorials|Game Master}} |
Latest revision as of 12:04, 5 January 2023
We will be creating a specific General Toolbar action. The Faction and Command toolbars are quite similar to the General Toolbar and we will touch upon them as well though these also interact with either the faction or the AI group.
Script Creation
As we will be creating a general toolbar action we will need to inherit from one of the Toolbar classes:
Class | Description |
---|---|
SCR_EditorToolbarAction | Basic functionality for toolbar actions. You click the button and something happens, very similar to Context actions (see also Context Action Creation tutorial) |
SCR_BaseToggleToolbarAction | A toggle action which can be toggled and untoggled; though in general the functionality is quite similar to SCR_EditorToolbarAction |
SCR_BaseCommandAction | Used for Faction and Command bar actions that take entity targets and have a built-in function to spawn a prefab. |
Methods
There are a few functions to take into account:
Method | Description |
---|---|
CanBeShown() | Whether or not the action will be shown in the toolbar. The action cannot be performed (not even with shortcut) if it is not shown, but you can set it up in such a way that the action is shown/hidden depending on events. |
CanBePerformed() | Whether or not the action can be performed. The action cannot be selected or executed if false but the button is still shown. |
Perform() | Here you actually execute the action. Write the code to bed performed here. |
IsServer() | Set the return value to true/false if you want the action to be executed on server/locally |
Track() | SCR_BaseToggleToolbarAction only. Track events which influence the action. |
Untrack() | SCR_BaseToggleToolbarAction only. Untrack events which influence the action. |
Toggle() | SCR_BaseToggleToolbarAction only. Toggle action state. To be called by inherited classes. |
Config Modding
Add to Config
Locate the wanted config in which you want to create your Toolbar Action, and press the + button to add a new item to its array.
Folder | Config | Description |
---|---|---|
Data |
EditToolbar.conf | General Toolbar for Edit mode |
PhotoToolbar.conf | General Toolbar for Photo mode | |
AdminToolbar.conf | General Toolbar for Admin mode | |
SharedToolbar.conf | Toolbar actions that are shared between all the above modes | |
Data |
Command.conf | Toolbar for both Faction as well as Command |
UI Info
Now that the action is added you will have to fill in the variables. We will start with the UI 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 name |
Description | Description when focusing on action |
Icon | Icon of action |
Other Variables
Variable | Description |
---|---|
Action Group | Makes sure actions are group together. Each enum is their own group divided by a divider. |
Action Type | Purely visible and decides which widget the action has.
|
Command Prefab | SCR_BaseCommandAction only. The prefab that will be spawned when toggling the button. |
Effects | Array of effects when action is performed, things such as Sound and Particle effects. |
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. |
Info Toggled | SCR_BaseToggleToolbarAction only. The Name, Description and Icon of a toggled button. |
Order | This dictates the order of the action within their respected Action Group (They can have no action group).
The higher the number the closer the action is in the left compaired to other actions. Actions with the same order are ordered the same as in the config array. |
Shortcut | Add an Input action name if you want the action also to be executed via short cut. Note that CanBePerformed() will still be checked. |