Dialogue System and plyGame: Level Selection Type of Game

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
davidsibya08
Posts: 57
Joined: Sun Feb 12, 2017 2:11 pm

Dialogue System and plyGame: Level Selection Type of Game

Post 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.
User avatar
Tony Li
Posts: 22110
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
Post Reply