Page 1 of 1

Dialogue->Variables.. Change it from a script.

Posted: Tue Jul 24, 2018 6:15 am
by Japtor
Hi,

I was wondering if there is a way to access a variable inside Dialogue->Variables and be able to change its value via a script inside any game object.

Thanks,
Javier.

Re: Dialogue->Variables.. Change it from a script.

Posted: Tue Jul 24, 2018 8:08 am
by Tony Li
Hi Javier,

Yes, use DialogueLua.GetVariable() and SetVariable():

Code: Select all

using PixelCrushers.DialogueSystem;
...
int score = DialogueLua.GetVariable("Score").AsInt;
score = score + 50;
DialogueLua.SetVariable("Score", score);

Re: Dialogue->Variables.. Change it from a script.

Posted: Sat Jul 28, 2018 12:57 pm
by Japtor
Hi,

Thanks for the help! It worked! :)

Re: Dialogue->Variables.. Change it from a script.

Posted: Sat Jul 28, 2018 7:24 pm
by Tony Li
Great! Glad to help.