Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: tim.holman on January 13, 2012, 02:41:30 PM

Title: Reset level
Post by: tim.holman on January 13, 2012, 02:41:30 PM
I was wondering if anybody knew of an easy way to reset the current level when dying. In other words, all fsm's should reset and start where they normally would at the beginning of the game. I was thinking about disabling, then re enabling all fsm's in the scene, however, I feel like there should be an easier way to go about this. Any ideas would be greatly appreciated!!
Title: Re: Reset level
Post by: Dev_Sebas on January 13, 2012, 03:25:38 PM
Try "restart level" action.
Bye
Title: Re: Reset level
Post by: tim.holman on January 13, 2012, 05:34:15 PM
I searched for "Restart Level" and didn't see anything. Is this a new action? Would "Load Level" essentially be the same thing? I'm using Playmaker 2.2 (beta 10). I believe Alex sent me an updated beta, however, I have not had time to implement yet. Thank you for your help.
Title: Re: Reset level
Post by: Alex Chouls on January 13, 2012, 05:45:05 PM
Sebastiao is probably talking about this action:
http://hutonggames.com/playmakerforum/index.php?topic=800.0
Title: Re: Reset level
Post by: Dev_Sebas on January 13, 2012, 05:46:01 PM
You can make it with Load Level action and you set the same level.
But if you search in this forum Restart Level, you will find the action.
Bye
Title: Re: Reset level
Post by: Dev_Sebas on January 13, 2012, 05:46:42 PM
Sebastiao is probably talking about this action:
http://hutonggames.com/playmakerforum/index.php?topic=800.0

Yes yes it´s.
Bye
Title: Re: Reset level
Post by: tim.holman on January 17, 2012, 10:43:43 AM
Isn't this essentially the same as "Load Level" or "Load Level Num"? What's the difference?
Title: Re: Reset level
Post by: Alex Chouls on January 24, 2012, 04:29:46 PM
Yes. It's just for convenience really, so you don't have to store the name of the current level.

Reloading the level is probably the best/easiest way to make sure everything resets properly (physics etc.).

But it might make sense for Playmaker to have some high level call for this (e.g., ResetAllFSMs). I'll look into it...
Title: Re: Reset level
Post by: smiffy on June 07, 2012, 12:40:22 PM
Just had to implement this exact thing today and this is what I came up with.

Create a global variable int that can be used to set which level you are on.

Create a new empty scene (I named mine resetter) and create an int switch based on the global var that points to each level. The level transitions just have load movie on them and draw fullscreen colour to keep the screen black.

The player dies and hits the restart level button.
The button sets the global variable for which point in the game they are at. Level 1 = 1 and so on.
It then fades to black and loads the resetter scene.

Title: Re: Reset level
Post by: jasonshow on February 20, 2013, 09:36:13 AM
I try restartlevel.cs ,but it will not reset all my variables,and it seem not to make all objects reseting.
how can I reset my all variables to default,and make all itween stop,and all gameobjects init to default.

thanks a lot.
Title: Re: Reset level
Post by: PET on January 28, 2016, 11:25:26 AM
I have used Restart Level in the past without any problems.

In my project it works without problems, however when I make a build and I do a restart... the level restarts wierdly... I see a white screen.

Any ideas? thanks