0 votes


I have been working on this for a while now and I finally figured out how I can make a working dialogue box with branching properties (this is a .JSON file)

Now I want it to connect to the Main Scene of mine where a dummy character is standing still and has the Area node attached to him. I must add that it is the 3D world / scene. I know that the Area node is able to send a signal to the code where it can say if a Body has entered or left.

I want the code to do following:
- Stop the movement of the character when interacting with the Dummy Character(No further inputs of the player with the WASD Keys which can change the position of the character) this will be the case until every piece of dialogue has been read or skipped. Releasing the input block and continue the normal WASD movement.

  • Input of the player is going to be "Enter" to continue the dialogue

I myself do have some code (shown below) but you can also advice me to use a whole different set of lines of code.

extends Area

const PLAYERNAME = "Mairobi"

export(String) var DialogueName = ""
export(String) var DialogueText = ""

func ready():
entered", self, "onbodyenter")
exited", self, "onbodyexit")

func process(delta):
if Input.is
var bodies = get
for body in bodies:
if (body.get
name() == PLAYERNAME):
print(body.getname() + "interacts with" + getname())
var textbox = get_node("Area/Panel")
textbox.setDialog(DialogueName, DialogueText)

func onbodyenter(body):
name() + "entered the area")

func onbodyexit(body):
name() + "exited the area")
if(body.getname() == PLAYERNAME):
var textbox = get

I am not sure if I need to make more nodes or I need to have another piece of code made.

Thanks for reading
KindoSaur Productions

asked Dec 15, 2019 in Engine by KindoSaurProductions (21 points)

1 Answer

+1 vote

You could use finite state machines here. When player begins conversation with NPC, leave "walking" state an enter "dialogue" state. When reading player's input, in addition to checking action pressed, check state. If input is "WASD" AND state is "walking", move.

answered Dec 16, 2019 by null_digital (162 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.