First of all, thanks a lot for a great plugin for Unity! The quality of the visual editing tools for editing graphs is really high, and have certainly saved us a lot of time writing editor scripts.
I have a question about runtime scripting of DialogueTrees which I hope you can help me with:
Is there a way to Backtrack/Undo in a DialogueTree at runtime? Say, I would like to give the player the choice of going back to the previous Choice node, and pick a different choice.
If it’s any help, then I can myself in my gameplay code could keep track of the node number to go back to, but I don’t see anywhere from my DialogueTreeController that I can get a reference to the tree directly, and go to that specific node. Technically i COULD put in an “Undo” choice in every single choice in the DialogueTree itself, but I would prefer to not bother the gameplay designer with this.
Thanks a lot for your positive feedback and I am sorry for the late reply!
Considering I understood correctly, then you could use the “Jump” node to make the dialogue jump the flow back to another node (even a previous node of course). Do you mean something different that what the “Jump” node does?
Thanks a lot for your reply. Technically, yes, I could have our designers put in “Jump” nodes in our Dialogue Trees, and then utilize these to make an Undo functionality. But I would prefer to do it through scripting in some way, since that would give less clutter in our Dialogue Trees and be less error-prone.
Is it e.g. possible to Jump to a previous node in the Dialogue Tree, even though there’s not actually a Jump node put into the tree?
Or is it maybe possible at runtime to insert Jump nodes into a Dialogue Tree at every Choice node, just before I start the Dialogue itself?
Or do you have other good ideas for implementing something like Backtrack/Undo through code?
Hmm. Considering I understand correctly, one solution to go about this, would be to change the “Start” node dynamically in runtime, so that the next time the Dialogue starts, it does so from that new “Start” node. To change the “Start” node you would of course need to somehow get a reference to the node you want. The easiest way, would probably be to use Tags on the nodes you want to manage through code.
Here is an example code on how to set the “Start” node of the dialogue to another node which we get by it’s Tag name.
(Node tags can be set in the node inspector by the way).
I’ll be looking into this and see if I can make it work.
One question though : What’s the way to restart the DialogueTree after changing primeNode? DialogueTreeController have no support for stopping or restarting current dialogue (it has a “Reset”, but only in Editor mode).
Restaring the Dialogue can be done by calling “controller.StopBehaviour()”, then “controller.StartDialogue()” again.
I will just need to add a “StopDialogue” method (overlooked) so that the API remains consistent.
Thanks for pointing that out.
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.