This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

After working on my dialogue system, I wanted to try to make my own dialogue editor (for both learning and practical uses). Yes, I know there are other dialogue editors.

So, I want to create a node (or instance a template.tscn, really), through code, and have that node be able to assign a value to a dictionary item depending on user input.
When I create a new node as a branch of the previous node, I want the new node node to "inherit" dictionary position of the previous node, and add it´s own.
I´m just not sure how to do this dynamically.

This is how it should work:

node1:
dict["trunk"]

node2:
dict["trunk"]["branch"]

node2b:
dict["trunk"]["branch2"]

node3:
dict["trunk"]["branch"]["leaf"]

say I have a base node, which represents:

node1:
dict["trunk"]

I then want to add a node, and a branch to the dictionary at the same time. Adding the branch to a dictionary is not the problem

How do I make the newly created node understand which position in the dictionary it represents? So if I´m on node 2b, it should know to add a value to
dict["trunk"]["branch2"] without having to hardcode it.

I do hope this doesn´t sound too confusing :P

in Engine by (33 points)

Please log in or register to answer this question.

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.