Dialogue Text Help

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
EWalk13
Posts: 11
Joined: Mon Oct 12, 2015 6:20 pm

Dialogue Text Help

Post by EWalk13 »

Hi I was just wondering how to incorporate a variables value into the Dialogue Text for a node in a conversation, so the string can be dynamic. I don't know how to use lua that well, but is there a way to script it in the dialogue text box to retrieve the value of a variable?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Text Help

Post by Tony Li »

Hi,

Yes, it's really easy. Just use the [var=varName] tag. For example, say you've defined a number variable in your dialogue database named "PorscheCost" and set the value to 60,000. Then you can set Dialogue Text to something like:
  • Dialogue Text: Interested in that car? It's [var=PorscheCost] dollars.
When you start a conversation, the Dialogue System automatically sets two variables named "Actor" and "Conversant" to the names of the participants. This is useful if you're using the same generic conversation for multiple NPCs, for example a generic Shopkeeper conversation. In this case, you could use:
  • Dialogue Text: Hi, I'm [var=Conversant]! Welcome to my shop!
You can do more sophisticated stuff with the [lua(code)] tag, but it basically works the same way. Instead of providing a variable name, you provide a Lua expression. There's a good example in the documentation section for the RandomElement() Lua function.
EWalk13
Posts: 11
Joined: Mon Oct 12, 2015 6:20 pm

Re: Dialogue Text Help

Post by EWalk13 »

Just tried it and it worked out great thanks!
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue Text Help

Post by Tony Li »

Wow, you're fast!
EWalk13
Posts: 11
Joined: Mon Oct 12, 2015 6:20 pm

Re: Dialogue Text Help

Post by EWalk13 »

Haha I just happened to be working on my project with this when I saw your reply come up
Post Reply