Custom rendering of options in YARN

Let’s talk about the very useful YARN integrated into the engine.
I would like some options, instead of being represented in the classic list, to be selectable by clicking on a button.

The idea is: “If the option text contains assign this function to …”
I managed to capture the text (DialogueTree :: Option (…)) but not the node it connects to …

I temporarily fixed it by creating a custom command, but I would like a more integrated solution with the YARN editor (my solution does not show links between nodes).

Hi,
I’ll answer, but I’m not quite sure that I understood.
You can load each option to a separate text object, and spawn a button next to each option, and link the buttons and the text objects (with the Link events), and this should enable you to achieve what you want.

Thank you, sounds good…
“load each option to a separate text object”… How?
With “DialogueTree::Option( number )” i have just the option text.

I try to make myself understood better, with option like:
[[Go to the garden |garden]]
I can capture the “Go to the garden” part with “DialogueTree::Option( number )” but not the second part which indicates the link to send to.

Why don’t you juest capture the “DialogueTree::Option( number ) in an answer_variable then later you can set another conditions over that answer_variable like
if answer_variable == 1 Go to garden
if annswer_variable == 2 Got to some other place

I would like to use only YARN to let authors and translators write only the JSON file of the texts.

With your idea (for which I thank you anyway) I should create and update a “trigger” for each JSON through the engine … It is not optimal.

When you insert the option text in the text object, add an instance variable containing the option number.
Then, when the player hovers/clicks on the text object or linked button, select the option based on that number variable.

1 Like

It is strange to be able to access the first data so easily and not to be able to access the second. But ok, what you propose is also a solution.
Thank you!