Overview
A Custom Action Plugin is a system that allows you to create custom Actions and Conditions using GDScript and use them in the Visual Script editor just like built-in Actions and Conditions.
Installing a Custom Action Plugin
This section assumes that you already have the plugin file (a .gd script written in the required format).
-
Place the plugin script (
.gd) in any folder within your project.
(The plugin will be loaded automatically.) -
Open the Visual Script editor.
-
If the plugin provides a Condition, select Add Condition on any transition link.
If the plugin provides an Action, select Add Action on any state. -
Switch the category tab at the top from the default AGMaker tab to a custom tab such as CustomCondition, OfficialPlugin, or another plugin-defined category.
(The tab name is defined by the plugin author, so the displayed name may vary between plugins.) -
If the plugin’s Action or Condition appears in the list, it can be used just like any built-in Action or Condition.
Note: When updating a plugin to a newer version, replace the existing plugin file rather than installing it alongside the old one. Otherwise, an error indicating that a class name conflict has occurred may be generated.
Creating a Custom Action Plugin
Custom Action Plugins currently support GDScript only.
Create a .gd script file anywhere in your project and follow one of the formats below.
Creating an Action
@tool
extends AGMPluginAction
class_name CustomAction
## Numeric value
@export var num: float = 0.0
## Attribute
@export_enum("Fire", "Water", "Earth") var elements: int = 0
# Defines the tab name
func get_plugin_tab_name() -> String:
return "Tab"
# Defines the group name
func get_group_name() -> String:
return "Group"
# Description shown in the tooltip when hovering over the item in the Add dialog
func get_description() -> String:
return "Description"
# Called when entering a state
func on_state_enter(p_owner: Object) -> void:
print("AGMPlugin : CustomAction: on_state_enter")
# Called every frame while the state is active
func on_state_update(p_owner: Object, p_delta: float) -> void:
print("AGMPlugin : CustomAction: on_state_update")
var gameobject: GameObject = p_owner as GameObject
var basesettings: BaseSettings = gameobject.get_base_settings()
basesettings.set_hp(num)
# Called when exiting a state
func on_state_exit(p_owner: Object) -> void:
print("AGMPlugin : CustomAction: on_state_exit")
Creating a Condition
@tool
extends AGMPluginCondition
class_name CustomCondition
# Defines the tab name
func get_plugin_tab_name() -> String:
return "Tab"
# Defines the group name
func get_group_name() -> String:
return "Group"
# Description shown in the tooltip when hovering over the item in the Add dialog
func get_description() -> String:
return "Description"
# Called when entering the condition
# (Triggered when entering the state)
func on_condition_enter(p_owner: Object) -> void:
print("AGMPlugin : CustomCondition: on_condition_enter")
# Called continuously to evaluate the condition
func on_judge_condition(p_owner: Object, p_delta_time: float) -> bool:
print("AGMPlugin : CustomCondition: on_judge_condition")
var gameobject: GameObject = p_owner as GameObject
var basesettings: BaseSettings = gameobject.get_base_settings()
if basesettings.get_hp() <= 0:
return true
else:
return false
# Called when exiting the condition
# (Triggered when leaving the state)
func on_condition_exit(p_owner: Object) -> void:
print("AGMPlugin : CustomCondition: on_condition_exit")
Tips for Writing Plugin Code
AGMPluginAction and AGMPluginCondition do not inherit from Node2D.
Instead, plugin logic should typically operate on the owning object, such as:
GameObject(inherits fromCharacterBody2D)Area2DGameObject(inherits fromArea2D)
These can be accessed through the owner parameter and used to implement the plugin’s functionality.
When developing a large plugin containing multiple Actions and Conditions, it is recommended to create a shared utility script and build an inheritance hierarchy around it. This helps centralize common functionality and improves maintainability.
