![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Scorch |
I have a dialogue system that prompts multiple options that each branch off into more options and so on… (Kind of like Fallout)
I want to await for the player to press enter on the keyboard before continuing the syntax
Example:
Go A or B?
await(#player pressed enter)
if go A
Go C or D?
await(#player pressed enter)
if....
elif....
elif go B
Go E or F?
await(#player pressed enter)
if....
elif....
why no something like
var option_chosen
if player pressed enter
{
if A == option_chosen
{
//do something
}
else if B == option_chosen
{
do something else
}
}
Moreus | 2023-04-10 08:19
I don’t put this as answer because you will vote down me like last time with almost same question. You just hide your last questions.
this how you tread people who try help you.
Moreus | 2023-04-10 08:30
The response you gave previously had very poor grammar and spelling and was therefore unintelligible.
I am very grateful for the help but obviously, if it is written in severely broken English, without even taking the time to go to Google Translate, it is not helpful. I digress.
I removed the previous question because it was not formulated well on my part.
The problem with this approach is that if option_chosen = C
, then it will not pass if A == option_chosen
because the option is C, not A.
var option_chosen
if player pressed enter
{
if A == option_chosen
{
if C == option_chosen
{
//do something
}
else if D == option_chosen
{
do something else
}
}
else if B == option_chosen
{
do something else
}
}
Scorch | 2023-04-10 11:33
Not sure what you talking about. If you don’t understand answer ask for more.
You needed class
es or struct
s for your dialogues.
Why You hardcode all dialogues?
I can suggest json
JSON — Godot Engine (stable) documentation in English
demo of dialog in json:
{
"id": 1,
"message": "Hi there! How can I help you?",
"options": [
{
"id": 2,
"text": "I'm looking for information on your products.",
"destination_id": 3
},
{
"id": 3,
"text": "I have a problem with my order.",
"destination_id": 4
},
{
"id": 4,
"text": "Never mind, I was just browsing.",
"destination_id": null
}
]
},
{
"id": 3,
"message": "What kind of products are you interested in?",
"options": [
{
"id": 5,
"text": "Electronics",
"destination_id": 6
},
{
"id": 6,
"text": "Clothing",
"destination_id": 7
},
{
"id": 7,
"text": "Furniture",
"destination_id": 8
}
]
},
{
"id": 4,
"message": "I'm sorry to hear that. Can you tell me more about the problem?",
"options": [
{
"id": 8,
"text": "My order hasn't arrived yet.",
"destination_id": 9
},
{
"id": 9,
"text": "The product I received was damaged.",
"destination_id": 10
},
{
"id": 10,
"text": "I received the wrong product.",
"destination_id": 11
}
]
}
Moreus | 2023-04-10 13:22