Page 1 of 1

Dialogue System and plyGame: Level Selection Type of Game

Posted: Tue Jan 09, 2018 6:57 pm
by davidsibya08
Good day sir Tony.

I would like to build a topic that focuses on the title above.
So, my first question is:
How would I set my Lua Variable back to 0 every time the level loads?
In my case, I used the Set Lua Variable block but it does not set back right to 0.

I have ExoPlanets variable, In level one. The player must collect all 10.
If the level is completed then retried level one. It already results to 10 which should be 0.

Re: Dialogue System and plyGame: Level Selection Type of Game

Posted: Tue Jan 09, 2018 8:21 pm
by Tony Li
Hi David,

Add a Lua Trigger to your scene. You can add it to an existing, active GameObject or a new, empty GameObject. Set the Trigger to OnStart. Set the Lua code to:

Code: Select all

Variable["ExoPlanets"] = 0
This will reset ExoPlanets to 0 when the scene starts.