Page 1 of 1

Setting Dialogues on runtime

Posted: Thu Sep 24, 2015 6:35 pm
by nishant
Hi,
I have a dialogue that tells the user the current day . The day gets stored and updated along with day/night cycle . I wanted to know if its feasible to edit the dialogue text in runtime . So for day 1 its will say "Today is day 1 " , for day 2 it will say "Today is day 2 " and so on ...


Thanks.
Nishant

Re: Setting Dialogues on runtime

Posted: Fri Sep 25, 2015 9:48 am
by Tony Li
Hi Nishant,

Yes, it's very easy. Store the day in a Dialogue System variable. For example:

Code: Select all

using PixelCrushers.DialogueSystem;
...
DialogueLua.SetVariable("Day", timeOfDay.day);
Then use the [var=varName] markup tag in your Dialogue Text:
  • Dialogue Text: "Today is day [var=Day]."
You can also register your own Lua functions and use the [lua(...)] tag, or use the RandomElement() function to choose text randomly from a list.

Re: Setting Dialogues on runtime

Posted: Fri Sep 25, 2015 11:36 am
by nishant
Cool that works... Thanks a lot