Page 1 of 1

Replacing Text dynamically

Posted: Mon Aug 24, 2020 9:48 pm
by nathanj
Hi Tony ,

I'm drawing a complete blank at the moment.

I would like to make certain names in my dialogue to be replaced dynamically. Say for example,

"Hi, go and gather some berries from {Location}".

I know I've done this before, I just can't remember how to do it. If you could just point me in the direction, no need to explain,

Thanks!

Re: Replacing Text dynamically

Posted: Mon Aug 24, 2020 10:27 pm
by Tony Li
Hi Nathan,

One way is to set a variable. Example C# code:

Code: Select all

DialogueLua.SetVariable("Location", "Tahiti");
Then use [var=variable] in the Dialogue Text:
  • Dialogue Text: "Hi, go an gather some berries from [var=Location]."

Re: Replacing Text dynamically

Posted: Mon Aug 24, 2020 10:31 pm
by nathanj
Ah, that's it.

Thanks!
Nathan

Re: Replacing Text dynamically

Posted: Mon Aug 24, 2020 10:45 pm
by Tony Li
Glad to help!