How do you add a signal from gdscript to visual script

Basically I am a bit lost on how to use “Signal Detected”. I have been having issues with multi key inputs for some reason when holding “Directional Keys” I can move anywhere, but if I am still holding a key down I can’t initiate "Dashing Actions I have set up." It only works if I am holding no “directional keys”. Basically standing still which doesn’t feel good for player movement.

I have an idea of using a gdscript to detect key presses and send an “action value” this works well, but how do I detect this declared gdscript value to visual script? I am stumped hope my screenshots help illustrate what I am trying to achieve. If not why don’t multi key presses work in general.

ps: "I know the screenshot shows walking not connected to dash, but I did that on purpose since no matter what logic I put character only dashes on no movement.

also sorry for 1 photo I guess new users can only upload one photo.

(˶º⤙º˶)

Hey there, I made a simple guide on this post for doing exactly that!

Sorry for the late reply. I will admit I have looked at this very tutorial as well as others in this forum. What I am confused about is how to link the “signal” from gd script → player Root with visual scripting. Mostly which “Signal” in filter signal list do I link to to receive. 2) DO I declare “playerAction” to visual script by name? Sorry if its probably obvious, but for the life of me I can’t see the answer in sight.

On #4 of that you can see that you have to connect it to a receive_signal and then the name is the name that you will be detecting on the link condition.

「いいね!」 1

Thanks to baz for making double check again. It works!!

For those wondering what steps you need its

1)Add a “Child” node object to your visual script controlled “Player0bject”

→in my case the object is called “NativeSignalToVS”

2)Attach a script to the “Child node” and → name it whatever name you want.

→ex: “NativeSignalToVS.gd” → gd refering to gd script

  1. add these items to your script
extends Node

#to be honest I dont know if this is needed
@onready var player:GameObject = $".."

var Action_Value := 0

# basically this refers to signal Your_Name_Here(Action_Value: float) 
signal playerAction(Action_Value: float)

func_ready() -> void:
 playerAction.emit(Action_Value)


func _unhandled_input(event) -> void:
 if event.is_action_pressed("Key_Dash"):
  Action_Value = 6
  playerAction.emit(Action_Value)
  print("Dash Action Initiated: ", Action_Value)

# Wondering where "Key_Dash" came from Input_Map its the "Name_of_Action"


  1. Save then → click on “Child node” in my case again “NativeSignalToVS”

→Look to the right of your editor and click on tab “Node”, then Click on Table “Signals”

→right click and click “Connect” on the first item that has “YOur Signal Name” from the gd script

5)Highlight the Visual Script Object Parent in my case it was “Player1_Base” then click on the words “PIck” it has a pencil icon

6) In “Pick” make sure “Scripts Methods Only” is the only one Highlighted disable “Combatible Methods only”

  1. Click on “Attached Script” it has words recieve_signal_signal_name:string…..etc)

8)Click “Okay” → then Click Connect

  1. You should see in the nodes tab of your node child object the “..:: receive_signal()

→should be under your “Named_Signal” in my case “playerAction”

  1. Go to Visual Script Parent Object from there use your visual programing “Arrows” and point it towards a designated box “ex Dash”.

ex: Standing_Still —————→ Dash

in the (——→) connected arrow add “SignalDetected”

Now set the “Signal Filter” → No Filter

Argument Type → Numeric

Condition Numeric → =

Comparison Target → Constant Value

Constant Value → What ever value your gd script assigned in my case “6”

  1. Click okay and It Should work if your player is standing still you should be able to do something with the value “6” or whatever value you assigned .

It works like this for me I don’t know if its all the way right way to set this up, but it works and that is great :slight_smile:

Now if somebody could tell me why….I cant initiate a dash when walking please tell me.

ex:

Player_Still ——————→ PlayerWalking —————–> “Player_Still_Shortcut”

“Player_Still_Shortcut” ——————> PlayerDashing //Can dash from standing still

“Player_Walking_Shortcut” ————→ PlayerDashing //Cant dash if I am in Walking?

PlayerActionValues:

0 => Standing Still

PlayerActionValues >0 And PlayerActionValues<5 => “Player Walks”

Player Action Value = 6 //Makes player Dash if Standing Still, but not if in walking even tho in my console value 6 is currently being called.

Sorry if I am info dumping I just dont get why even with just straight up numbers and no key presses I still can’t walk + Dash at the same time only standing still…..