[Dive Into AGMaker] Script Gist - EmitSignal & SignalDetected

Script Effects

There are two scripts.
One demonstrates how to use the “Condition: SignalDetected” to notify the VS state machine of events occurring within the GD script.
The other demonstrates how to use the “Action: SendSignal” from within the VS state machine to trigger logic in the GD script.

Key Points

  1. The player needs to point to your actual game object.
  2. This snippet briefly demonstrates the functionality of using Godot’s native is_on_floor method to notify the game object to respond.
  3. Use “SignalDetected” in the game object and change the target signal name to on_floor_event, with no parameters.
  4. After using the “SendSignal” action in the visual script, a signal will be dynamically added to the signal list, which can be directly used. Connect it to a function in a GD script.

Core

How to Use Condition - SignalDetected

extends Node

signal agm_send_signal(signal_name,parameter)

@onready var player: GameObject = $".."
var was_in_air = false

func _ready() -> void:
	agm_send_signal.connect(Callable(player,"receive_signal"))

func _physics_process(_delta):
	if player.is_on_floor():
		agm_send_signal.emit("on_floor_event",null)
		pass

How to Use Action-SendSignal

if you create this action, vs will dynamically registers a new signal,
which can then be received in a GDScript script.