Reset Game

Melarnos
23 Jun 2016, 16:49
Hi everyone,

I'm working on my first Quest game and I've managed to find a lot of answers here (thanks for everyone who provides solutions, your help is much appreciated! :D ).
However I'm still struggling with some issues. One of them seems quite basci but I didn't find the answer here, nor in the documentation. Sorry if the subject has already been discussed.

The question is simple : Is there a script/function to restart the game?

My game includes an inventory, status attributes, flags and a scoring system. So I'm looking for a way to reset all integer attributes to 0, unset all flags and clear the inventory. AND then sending the player back to the start of the game (=room 1), up for a fresh start.
Actually, the objective is to create and hyperlink that, when clicked, has the same effect than "File/Restart".

Well, I guess the easy way to do that is to run a script that enters "CTRL+R"... but I don't know how to do that (such a newbie I guess :P)

It's a main issue since my game is meant to be replayed multiple times.

Thanks !

XanMag
23 Jun 2016, 18:44
This is a good questions and not one that I have seen on here since I began.

My way to do it, which is most likely long and complicated and a fustercluck (it's what I do), would be to add a function that has all of the starting boolean/flags, attribute values, sets score to zero, and moves all inventory items back to the location room from which they began. Then, you could link that function to a command (like, typing 'restart' or clicking a 'press to continue' script) to force the player back to square one. It might be a frustrating bit, but I think you could definitely get it to work, especially if the game from starting point to end point is not super long. I'd look for a different method if you have a bunch of flags, items, and attributes that need reset.

And... if you miss one flag or inventory item or resetting of an attribute... you are taunting the game breaking bug to visit your game. :D

Although, I'm curious... what's different between restarting and just playing the game again from the beginning?

Melarnos
23 Jun 2016, 19:14

I'd look for a different method if you have a bunch of flags, items, and attributes that need reset.


Unfortunately, yes, I definitely have :D

Thanks for the answer, though (I thought of a similar solution but as a very last resort).
To answer your question : I just want to give the player the opportunity to restart the game immediately, with just one click.

I'm confident the solution exists!
(and there is certainly a way to tell the game to execute the "CTRL+R" command, I just don't know how).
Anyone?

HegemonKhan
24 Jun 2016, 08:39
this is a similar issue with 'saving/loading' a game... and that issue is... you got to "collect all data (char stats, npc/item/object initial locations, game states, etc etc etc: any data that has changed from it's initial setting/Values at the start of the game), and set it back to what it originally was set at".

thus... I don't understand the reason of creating your own resetting, when you can just actually stop the game, and start a new game.

now, I'm well aware that you may want to be able to start the game over while continuing some data over to it (like cash/gold, experience, stats, whatever, etc etc etc). Unless you do the same advanced encoding/decoding programming that is required for 'saving/loading' a game, there's a more simple but more limited method (if you don't mind its limitations) of using a 'password' type of system when you start your game, for an example:

new game -> enter password? if yes, enter password, else -> you play through your game -> upon game over, you're asked if you want to restart game. if yes, then you're given a password, for an example of how it would work:

if (player.stats = 100) {
msg ("password: godmode")
} else if (player.cash > 1000000) {
msg ("password: rich")
} else if (player.stats = 100 and player.cash > 1000000) {
msg ("password: richgodmode")
}


(new game and "yes" on if you want to enter password) enter password:
if you entered: godemode, then player.stats = 100
if you entered: rich, then player.cash = 10000000
if you entered: richgodmode, then player.stats = 100 and player.cash = 1000000

though you can see that this is a huge hassle and/or it's very limited...

if you want something much better... that's using encoding/decoding programming....

Melarnos
24 Jun 2016, 14:48

I'm well aware that you may want to be able to start the game over while continuing some data over to it



Nope, that's quite the opposite, actually :)
Your password idea is a good one but unfortunately it doesn't apply to what I'm looking for.

I don't understand the reason of creating your own resetting, when you can just actually stop the game, and start a new game.



I wish to improve the gaming experience, by allowing the player to immediately click "restart" when they reach the "Game over" room, without having to close/re-open the game. Maybe it's not a big improvement, but I'd really like to add it. As a matter of fact, I tried out some games that have this feature. I just want to know how to do it (the only nuance is that it should reset everything, not just send the player back to the first room).

HegemonKhan
24 Jun 2016, 15:01
that's a very minor thing to do for the huge amount of effort/work/time it'd take to do it (well, good programmers like Jay, Pixie, Pertex, and others can probably do it relatively fast as they are well experienced in doing encoding/decoding, but that's certainly not me... not yet, lol)... but whatever...

(I'd first actually get your entire game made/finished, and then you can put the effort into this tiny improvement in the "gaming experience" as you say)

XanMag
25 Jun 2016, 01:30
If you are resetting the game entirely, can you just add a link to your games homepage and they can click on that?

Melarnos
05 Jul 2016, 16:39

That's an interesting idea, XanMag! I haven't thought of that since my game is not online yet. I guess I'd have to publish it one first time, then update it with the link to the game homepage (does updating work well by the way? I think I've seen a topic with someone having problems updating the game).
Anyway, this solution seems to be a good one for an online version. Thanks for that!
The thing is, I'd like my game to be available online and for download as well, and then your solution doesn't work for a desktop version, I guess.

If anyone thinks of a solution that could work for a desktop version of the game, I'm all ears :)


XanMag
05 Jul 2016, 17:09

I have never had a problem updating my game. Update. Wait 20-30 seconds for file to upload. Done. If it happens, it does not happen very often. Good luck.