How do I restart my game after the player had lost?
When the player loses, they will be taken back to the title screen. No special action is needed for them to be able to restart their game unless you have disabled the title and load screen (see above to re-implement game restart).
When you have disabled the title screen and load screen[edit]
The following instructions only apply if you have disabled the title screen and load screen, and implemented your own.
You may have noticed that, if you have disabled the title and load screen (to add your own) and when the player have lost, he left automatically the game and go back under game.exe small windows sized.
If the player wants to continue he has to launch it himself/ herself and you might want to reimplement it because you think it is not very convinient for the player to not to come back to the title screen... Well, don't worry : it is perfectly possible to do so!
If you remember, in the same time as you were implementing we entered a new special plotscript title screen (see above) and put in as "new-game" under custom.exe
#new new-game special plotscript #------------------------------------------- plotscript, title screen, begin suspend player #the player shouldn't be able to move during the title, duh... show backdrop (0) #show absolutely nothing fade screen out wait(1) #this is to avoid the initial fade-in # feel free to add more backdrops here (see above for more details) show backdrop (3) #title screen play song(song:title) #play the title theme wait(1) fade screen in variable(waiting) waiting:= true while(waiting) do, begin #these simulate the regular behaviour of the title screen wait (1) #don't delete the wait (1) command here! I would prevent the player from pressing the keys if(key is pressed(28)) then (waiting:= false) #ENTER if(key is pressed(57)) then (waiting:= false) #SPACE if(key is pressed(1)) then (fade screen out, game over) #ESCAPE end variable (s) #display the load-game menu #if you were implementing your own, you'd do it here s:= load menu(false) #show it, but don't actually do anything if(s >> 0) then, begin load from slot (s) exit script #the game is loaded, we're done here. end if(s == -1) then, begin game over #they chose quit end if(s == 0) then, begin introduction #game intro begins, this is your old new-game script end #end of the load menu end #end of plotscript #-------------------------------------------
Well because you activated those bitsets, when you use the game over command, you don't go back to the title screen anylonger.
To fake the reset effect we need that the script that first launch starts and that's rather easy!. We just have to change a line at the end of the game over script.
Look at the example above :
#--------------------------------------------------------------- plotscript, game is over, begin suspend npcs suspend player play song (game lost) show backdrop (2) # backdrop with Game Over on it! wait (5) title screen # allows to reset game resume npcs resume player end #------------------------------------------------------------
You just have to replace the line game over by another one with the name of your "New Game" special script in it!
You can test and it will works! Just after the game has been lost, the script title screen will start! You may ask
- Hey but won't that prevent the player from leaving the game? Well no. If the player wants to leave, he'll make
pop up the menu using any key as usual and choose exit. The variable (s) will take value -1 and the game over command will run!
Isn't that great? ^_^