Actions
An action is a modular system that lets you enhance your buildables by adding extra functionality, making them more dynamic and versatile. You can assign and combine multiple actions to any buildable, allowing for greater flexibility in how they behave and interact within the game world.
Callable Functions
GetOwnedGameplayTagsTags()
This allows you to get the tags which defines this Action. When you want to try and find a specific action.ExecuteAction()
This executes the logic of this action.IsActionAvailable()
This needs to return true for the action to be executed. This allows you to set up conditions for when this action can be executed.GetDisplayText()
Gets the text for this action.GetDisplayIcon()
Gets the icon for this action.
Overridable Functions
ExecuteAction()
This is where you will be putting your logic for this Action. Not overriding this will result in the action doing nothing.IsActionAvailable()
You can override this to make actions conditional. If this returns false thenGetAvailableActions()
in the Buildable won't return this action.GetDisplayIcon()
If you need more advanced behavior for getting the Action Icon, then override this.GetDisplayText()
If you need more advanced behavior for getting the action text, then override this.
Example
With actions you can create interesting behavior for your buildables.
An example of this would be creating a door with multiple actions: a toggle door action, a move action, and a destroy action. In this case, we want the toggle door action to be the default, so the player can simply walk up and interact with the door to toggle its open state.
To achieve this:
Add the Default Action Tag
Create a Door
Buildable Definition
.Add the tag
Action.Default
to the toggle action.This allows the system to recognize the toggle as the default action.
Interact with the Door
With the default action set, we can easily find and execute this action by doing a short interaction on the door itself.
We do this by opening the BP_Openable class, in here we set the short interaction to query for the default action.
Access the Radial Menu
The player can also open the radial menu through a long interact on the door and choose from the available actions, including the default toggle action.
![Image showing the radial menu with different door actions]
Last updated