You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys, I'm developing a cozy game with a lot of dialogs. The player spends their summer vacation in a small town and can talk to the villagers, do quests, etc. Everyday the player should be able to choose a set of interactions with an NPC.
For example: Talk to NPC, ask to walk the dog or leave.
Example dialog:
~ npc_default
npc: Hello, dear. What's on your mind today?
- Talk
...some dialog...
- Walk the dog
do spawn_dog()
....
- Leave => END
~ npc_day1
npc: This is your first day, huh?
It would be awesome if player chooses "Talk" to jump to the dialog for the current day.
I know that it's possible like this:
- Talk => npc_day1
But I would like to use a variable to set the current day, otherwise I would have to write a lot of if statements or use a mutation, right?
Would this be possible to implement?
I don't know how the interpretation of variables in dialog lines works, but maybe you just add some helper function at this line?
The text was updated successfully, but these errors were encountered:
It indeed seems like a decent idea, but it would pose a few problems which could mess up your game in unintended ways, mostly due to the fact that this jump mechanism would be impossible to statically check, and so it could raise runtime errors that require debugging. Static errors are easier to debug, so I would not recommend to use this sort of feature :)
The way you'd do what you want easily, and with static debugging would be:
It has the added benefit of always providing a fallback, as well as being statically analyzed for error. This way you can never have the Dialogue Manager jump to an unknown title, because it would have warned you right in the editor which is way better developer experience.
Although I have to agree it's a bit unsightly with all these elifs :) Maybe #312 could help with readability for this kind of use case.
For the same reasons Selenyhr mentioned, I'm reluctant to add variable jump labels. Once I find the time to implement a match statement that would be the best solution. Until then conditionals are the way to go.
Hey guys, I'm developing a cozy game with a lot of dialogs. The player spends their summer vacation in a small town and can talk to the villagers, do quests, etc. Everyday the player should be able to choose a set of interactions with an NPC.
For example: Talk to NPC, ask to walk the dog or leave.
Example dialog:
It would be awesome if player chooses "Talk" to jump to the dialog for the current day.
I know that it's possible like this:
But I would like to use a variable to set the current day, otherwise I would have to write a lot of if statements or use a mutation, right?
Would this be possible to implement?
I don't know how the interpretation of variables in dialog lines works, but maybe you just add some helper function at this line?
The text was updated successfully, but these errors were encountered: