how to shut down game but not shut down again after restarting (Oneshot style)

VilNess

Villager
Member
Joined
May 12, 2021
Messages
7
Reaction score
1
First Language
Finland
Primarily Uses
RMMZ
Hello all! This is my first post here. :)

I´ve used RPG maker MZ for about six months now. It´s my first real game planning engine. Never really learned writing code so this program is a saving grace for people like me who really want to make a game but get overwhelmed by programming. Still, I have already succeeded at making quite much with event tricks (like having an event follow players that triggers attack which enables old school Zelda -like attacking) and I´ve made "protect a friend" mission where you push attackers away for 1 minute to win the scenario.

Anyway for the question:
how to shut down game but not shut down again after restarting? This kind of thing is used a lot in games like OneShot.

Logically, event x should trigger both game save and shutdown (with this I have succeeded thanks to: SceneManager.exit();
BUT with my lacking in programming skills I haven´t figured out how to skip the shutdown again after loading save file.

This subject probably has been here already, so sorry if this is asking the same thing.

Thanks for your time anyway :)
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
4,858
Reaction score
1,868
First Language
Dutch
Primarily Uses
RMMV
saving the game and return to title screen I presume is one thing,
exit closes the game, when saving when dieing continue on that
spot, unless you load a common event first before that happening
on saveLoad?
 

VilNess

Villager
Member
Joined
May 12, 2021
Messages
7
Reaction score
1
First Language
Finland
Primarily Uses
RMMZ
Hmm, I´n not sure if I understood:
What I was thinking of doing (again, technically probably close to OneShot shutdowns) is to trigger an event (like talking to someone or getting an item) that both saves the game and shuts it down.
And when you reopen the game you will get an cutscene and the game processes on after that cutscene.

I did some googling and some people have had similiar problem which they tried to fix with some weird timer things.
Other solutions we´re having the load savefile function trigger something that (if I understood correctly) bypasses the event which triggered the shutdown in the first place.
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
334
Reaction score
458
First Language
French, German
Primarily Uses
RMMZ
I'd need to test it to be sure, but my first attempt would be to call
JavaScript:
$gameTemp.doShutdown = true;
before you save the game.

After the game is saved, you'd use a conditional branch to check for the following script:
JavaScript:
$gameTemp.doShutdown
and only shut down the game from inside that conditional branch.

Since $gameTemp does not get saved, creating a variable within and setting it to true before saving would allow you to check if that variable is still true afterwards, so you can shut down the game.

When you load the save, the variable no longer exists (since it was never saved) and the line of code that sets it won't get executed again (because it's already been executed). Thus the variable is no longer true and the game won't shut down.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,154
Reaction score
1,865
First Language
English
Primarily Uses
RMMV
trigger an event (like talking to someone or getting an item) that both saves the game and shuts it down.
And when you reopen the game you will get an cutscene and the game processes on after that cutscene.
So this is my confusion (and I suspect for other people - I don't know how many people have played Oneshot, I've never heard of it).

When you talk about "reopening the game," are you talking about running the game executable again, or about loading that save file?

So scenario one (which Nolonar gave you a solution for): The game saves your progress and kicks you out of the game (why exactly do you want this? As a player, it sounds annoying). You go to the normal title menu, load your game, and continue playing.

Scenario two (what I originally thought you were asking): The game saves your progress and completely closes. You run the game again, and you don't get the normal title menu, you immediately resume your save with the cutscene and stuff.
 

VilNess

Villager
Member
Joined
May 12, 2021
Messages
7
Reaction score
1
First Language
Finland
Primarily Uses
RMMZ
Thanks to both of you. I am mostly meaning that the game would completely shut down.
I can imagine it being annoying if it is used too much, but as a spice to making a "rare effect" seem even stronger, I can imagine it might be just the thing a few scenarios need.

And after you reopen the game the game intro would be altered a bit (optional little spice also).

Thanks you both for your ideas and replies. I will try Nolonars solution and see if it works :)
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,154
Reaction score
1,865
First Language
English
Primarily Uses
RMMV
I am mostly meaning that the game would completely shut down.
And after you reopen the game the game intro would be altered a bit (optional little spice also).
So Nolonar's answer will shut down the game, but won't do anything for changing the title menu when you start it up again. For that, you'll need to look at the plugins that deal with New Game+/metadata things.
I can imagine it being annoying if it is used too much, but as a spice to making a "rare effect" seem even stronger, I can imagine it might be just the thing a few scenarios need.
I can't imagine a situation where I'm not annoyed by a game shutting itself off and expecting me to run it again (I would probably just go do something else instead). But if you have an artistic vision, run with it!
 

VilNess

Villager
Member
Joined
May 12, 2021
Messages
7
Reaction score
1
First Language
Finland
Primarily Uses
RMMZ
Sorry for doublepost.


I tested Nolonars suggestion and it worked perfectly. :) Thanks you so much, this helped me a lot on two ways:
I understand RPG maker a little better and my game development is progressing


Edit: ATT_Turan
Also thanks to you
"So Nolonar's answer will shut down the game, but won't do anything for changing the title menu when you start it up again. For that, you'll need to look at the plugins that deal with New Game+/metadata things."
Yea, obviously I have to go deeper into that aspect as well.
For now I just moved main character do a different map with that script so there is no change to shut down the game again with the same event.
 

Latest Threads

Latest Posts

Latest Profile Posts

SF_Vehicle2 and SF_People2_8 added!
index.php

If I made an 8-bit-esque, dark fantasy tileset/graphics pack, would y'all be into that? Like, for Dark Souls demakes, Nintendo vampire wannabes, Castlevania ripoffs and such?

Working title: Alice's 8-bit Gothic. Do or not do? (Like do y'all even use 8-bit style graphics?)
I love editing things .
16b6a8abb5d27bf617d9b802cd5b868a.jpg

* Wall frames made with pencil photo and program photos, * Leaf and Pot, with cliché ideas of flowers
*bear on top of the closet belonging to the art of whtdragon lol.
No better feeling than part of a project just clicking into place without a single issue.

Forum statistics

Threads
118,438
Messages
1,115,987
Members
155,402
Latest member
Bansher
Top