Page 1 of 1
Dynamic response text
Posted: Mon Sep 02, 2024 12:34 pm
by Swing Wren
Hello, I'm trying to have some more control over the text of responses without having to create another node as de conditions get quite a bit more complicated with multiple nodes. Something like this for example:
- example-burritos.png (32.46 KiB) Viewed 105 times
The response of cheese burritos may have different disabled text depending on different conditions:
I not have enough money: Text in red
If Paul is Angry: No cheese for you!
if no more cheese burritos: I'm out of cheese burritos!
What would be a good way to achieve this? Thank you
Re: Dynamic response text
Posted: Mon Sep 02, 2024 1:56 pm
by Tony Li
Hi,
Personally, I think separate response dialogue entries would make the options more clear. That is, separate options for "Cheese burrito", "No cheese burritos for you" and "I'm out of cheese burritos".
However, if you want to keep it in one dialogue entry, you can use the
Conditional() Lua function inside a
[lua(code)] markup tag.
For example, set the Dialogue Text or Menu Text to:
Code: Select all
[lua(Conditional(Variable["Paul.IsAngry"], "No cheese for you!"))]
[lua(Conditional(Variable["Burritos"] <= 0, "I'm out of burritos!"))]
[lua(Conditional(Variable["Money"] < 40 and Variable["Burritos"] >= 1 and not Variable["Paul.IsAngry"], "I don't have enough money"))]
Re: Dynamic response text
Posted: Tue Sep 03, 2024 3:12 am
by Swing Wren
Hey, Thank you! that was what I was looking for!
In other cases I would keep those options separate but here having to keep only one visible and disabled It gets too cumbersome to manage the logic for each option for only having different text.
Thanks again!
Re: Dynamic response text
Posted: Tue Sep 03, 2024 8:09 am
by Tony Li
Glad to help!