Time-loop in rpgmaker, how to make it work?

So I’ve looked around the forum for quite a bit, but wasn’t able to find the answer to the question:
Is it actually possible to achieve something in one save file that will transfer to the same safe file after you load it again?

It may be a confusing question (perhaps not explained well enough) so I’ll try to explain it to the best of my abilities.

here is a scenario:
You are stuck in the time loop where everytime you die, you have an ability to come back and make use of the information gathered in loop that happened before.
From technical side:
Is it possible for the game to somehow “remember” what you did when you played the game, and store that information somewhere that can be read if you play the same save file again?


I had an idea that If you reach an NPC that has valuable information, there would be a script that could create a file in the game folder that conditional branch could read if you played from the same save file later... but the thing is that I have no idea if that is even possible in JavaScript.

Or maybe there is some easier way to achieve this?

also I am using rpgmakerVXA
VXAce doesn't use Javascript, but Ruby.
VXAce doesn't use Javascript, but Ruby.

Even if so the question still remains, where could i find any support for this type of idea. Or if someone did something similar?
Unfortunately, I'm not familiar with plugins enough (other than how to configure existing ones) to figure it out on my own.
Sry if i did not understand it right, but you mean, every time you die, you go back to the beginning but some things remain, like knowledge or maybe even items ect... ????

If so, then that is doable with variable / switches...
You would have to do for every event an reset, like when you go to talk to NPC and he tells you info A and after that he keeps saying info B but when you die and go back to him again he tells you info A again... thats doable but needs alot of organization ect...
So I’ve looked around the forum for quite a bit, but wasn’t able to find the answer to the question:
Is it actually possible to achieve something in one save file that will transfer to the same safe file after you load it again?

It may be a confusing question (perhaps not explained well enough) so I’ll try to explain it to the best of my abilities.

here is a scenario:
You are stuck in the time loop where everytime you die, you have an ability to come back and make use of the information gathered in loop that happened before.
From technical side:
Is it possible for the game to somehow “remember” what you did when you played the game, and store that information somewhere that can be read if you play the same save file again?


I had an idea that If you reach an NPC that has valuable information, there would be a script that could create a file in the game folder that conditional branch could read if you played from the same save file later... but the thing is that I have no idea if that is even possible in JavaScript.

Or maybe there is some easier way to achieve this?

also I am using rpgmakerVXA

So do you want a system that remembers the choices you've made on a previous save file?

Then Global Save File by theLEECH will help you in that regard because it allows the game to remember switches and variables even from a fresh new game.
Sry if i did not understand it right, but you mean, every time you die, you go back to the beginning but some things remain, like knowledge or maybe even items ect... ????

If so, then that is doable with variable / switches...
You would have to do for every event an reset, like when you go to talk to NPC and he tells you info A and after that he keeps saying info B but when you die and go back to him again he tells you info A again... thats doable but needs alot of organization ect...
Yes, however that would require me to make bunch of fake game overs and a LOT of switches which I would prefer not to do.


So do you want a system that remembers the choices you've made on a previous save file?

Then Global Save File by theLEECH will help you in that regard because it allows the game to remember switches and variables even from a fresh new game.
Oh! I think this will do nicely. Much more simple and probably more effective than what I had in mind.
Thank you so much for help.
Hmmm, what you want is a common system that is knows as "Save+" or "Continue+".

And I am pretty sure Yanfly made a script for save+ for VX Ace. (Not sure where to find, it, but if you look for save+, vx ace and yanfly on google, I am sure you'll be directed right to it.)
Hmmm, what you want is a common system that is knows as "Save+" or "Continue+".

And I am pretty sure Yanfly made a script for save+ for VX Ace. (Not sure where to find, it, but if you look for save+, vx ace and yanfly on google, I am sure you'll be directed right to it.)
I'll check this one out as well, thank you for suggestion!
I was going to suggest a global save script, but keep in mind that if the player dies, you need to save the game so that the values are retained. That does not happen automatically so a modification to game over will still be required to save before returning or title menu.
One way is to prevent the fail-state/game-over entirely. (At least the In-Built version)
Basically instead of a game-over screen when you die (or whatever it is that happened) You'd make a custom screen or event of sorts.
Spoiler: Edit:
What I mean is that you would prevent Battles from ending the game when you fail, which I believe Ace has the in-built ability to do, but rather using a custom event or script, you would activate whatever you need done for the time-loop.


For example, Homework Salesmen by @Ronove doesn't have a game over screen, but rather whenever you're exhausted from overwork or defeated in battle, you just wake up in your bed the next in-game day.

Obviously with a time-loop, you need the world and NPCs who aren't traveling through time to seemingly revert to a previous state, so that's going to require plenty of variables and switches...
Looking through my scripts - there is one called Erisa - Transfer Player on Game Over.
I could modify this to do a save and probably have it set to return to different locations.
Your choice.
Then the player will not get a game over and the data just needs to be saved in a save file to continue later if desired.
Oops, earlier I said what you probably look for was called "Save+" or "Continue+"... That was a brain fart... It is often called "New Game+" or "Continue+"... Not Save+
One way is to prevent the fail-state/game-over entirely. (At least the In-Built version)
Basically instead of a game-over screen when you die (or whatever it is that happened) You'd make a custom screen or event of sorts.
Spoiler: Edit:
What I mean is that you would prevent Battles from ending the game when you fail, which I believe Ace has the in-built ability to do, but rather using a custom event or script, you would activate whatever you need done for the time-loop.


For example, Homework Salesmen by @Ronove doesn't have a game over screen, but rather whenever you're exhausted from overwork or defeated in battle, you just wake up in your bed the next in-game day.

Obviously with a time-loop, you need the world and NPCs who aren't traveling through time to seemingly revert to a previous state, so that's going to require plenty of variables and switches...
While this is true, what I had in mind is sort of "tricking the player" that after they die by game over screen, they would load their save and happen to get completely different outcome based on NPC you talked to before in the same save.

This is why I suggested that I would need a way to read an out of the game file that would be created for the soul reason to be read by the conditional branch (if it is possible, that is)

As you mentioned, it is entirely possible to overcome this issue by creating "fake main menu"
but recreation of player's save screen will stay a problem(especially that I can't predict if they will make more saves), as well as extreme amounts of switches/variables that I would like to avoid for now.

I was going to suggest a global save script, but keep in mind that if the player dies, you need to save the game so that the values are retained. That does not happen automatically so a modification to game over will still be required to save before returning or title menu.
[...]
Looking through my scripts - there is one called Erisa - Transfer Player on Game Over.
I could modify this to do a save and probably have it set to return to different locations.
Your choice.
Then the player will not get a game over and the data just needs to be saved in a save file to continue later if desired.
Ah, that does complicate things a bit. If I need player to save manually after the switch will be triggered, this will probably break the illusion that I had in mind.
Unless there is a way to autosave on the last played save, that is.

So with that script, the game will save on Game Over and make the player go to Title Screen?
And then the game can be resumed from the save made and make player be transferred somewhere else? or am I understanding it wrong.


Also to clarify even further the idea/question:
In what I am trying to achieve it is important that the player starts the game with the save that does start the time loop.
The "Time loop" does not happen on the start of new game, but in forced save that I want to make player do before the time loop mechanic will take place.

In a way, I am trying to find a way to make it possible to continue from the same save but get different start of the game every time you die.

example:
Player character walks in> forced save> "some dialogue"> Game Over> player is sent to main menu> player loads the forced save> "dialogue changes" > Game Over> repeat until player figures out how to avoid endless Game Over (In this case, talking with specific NPC will give the next loop an option to change the outcome of dialogue that you weren't able to choose beforehand).
You could also make it that your game has no real game over, but when you 'die' you transfer the player to another map you control that sets up things for the next loop. That way everything is just in one master save that carries over.
You could also make it that your game has no real game over, but when you 'die' you transfer the player to another map you control that sets up things for the next loop. That way everything is just in one master save that carries over.
The thing is that for the meta plot purposes of the game, I need player's input which consists of loading the save file again from the title screen.
In theory I could do without it, but I feel it will make less of an impact in the story later on.
The thing is that for the meta plot purposes of the game, I need player's input which consists of loading the save file again from the title screen.
In theory I could do without it, but I feel it will make less of an impact in the story later on.
Loading is part of the story? You could fake it. 😉 Make a fake load screen, on this map Bgillisp mentioned, where the player simply selects a choice that represents the "loads"?

I don't know the specifics of your game, but it feels like you make it more complicated on yourself then needed.
Loading is part of the story? You could fake it. 😉 Make a fake load screen, on this map Bgillisp mentioned, where the player simply selects a choice that represents the "loads"?

I don't know the specifics of your game, but it feels like you make it more complicated on yourself then needed.
That would probably require me to know how does the player saves look like, to make make it as believable as possible. Besides, in RPGMVXA you can have up to 16 saves... which just complicates the process.
Or I could just go with this approach and make the whole fake title screen and only couple save files available to go through (like OFF did it once), but I kind of wanted to make it more authentic even though it is overly complicated.

I am fine with dropping the idea if I wont find a way to do it but I need to at least try.
This is why I suggested that I would need a way to read an out of the game file that would be created for the soul reason to be read by the conditional branch (if it is possible, that is)
This is the only easy way I see it working, but I am not sure if Ruby is even able to do such a thing as "creating/detecting a file"(could be a txt file for all i care) and using it as condition.
I'm pretty sure your idea is doable, even if complicated. (Not that I know myself exactly how to do it)

This is the only easy way I see it working, but I am not sure if Ruby is even able to do such a thing as "creating/detecting a file"(could be a txt file for all i care) and using it as condition.
I believe there was something like this in the Master Script list https://rmvxace.fandom.com/wiki/RPG_Maker_VX_Ace_Master_Script_List
I'll edit them in if I find them.

EDIT: Here's some possibilities:
.txt Files Builder/Opener ;
Load Notes from Text Files
I'm pretty sure your idea is doable, even if complicated. (Not that I know myself exactly how to do it)


I believe there was something like this in the Master Script list https://rmvxace.fandom.com/wiki/RPG_Maker_VX_Ace_Master_Script_List
I'll edit them in if I find them.
Thank you, I will look for it as well.

Thank you again for the support, I will try those out!
Ah, that does complicate things a bit. If I need player to save manually after the switch will be triggered, this will probably break the illusion that I had in mind.
Unless there is a way to autosave on the last played save, that is.

So with that script, the game will save on Game Over and make the player go to Title Screen?
And then the game can be resumed from the save made and make player be transferred somewhere else? or am I understanding it wrong.
That's where I was asking your thoughts. What do you want. Making a game over script that saves in the last save spot used is not too hard. I didn't realize you wanted them to go to the title screen. That seems silly to me, but if it's what you want.
To make the player start at a different location when resuming a save file is best done by having the player at that location then saving. So the script would have to transfer the player then save then game over. Of course the screen would have to be blank so the transfer is not seen.

Just explain the situation and I can try to come up with something.

Didn't take too long to create it from scratch.
Tell me if there are any adjustments to make.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Transfer on Game Over        ║  Version: 1.00     ║
# ║ Author: Roninator2                  ║                    ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function:                           ║   Date Created     ║
# ║    Save game on death and           ╠════════════════════╣
# ║    transfer player to another map   ║    06 Feb 2022     ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions:                                            ║
# ║   Turn switch on to disable script                       ║
# ║   Set the data for the variable with script data entry   ║
# ║   in the format of [map id, x, y, direction]             ║
# ║   e.g. [4, 6, 22, 8]                                     ║
# ║   This allows you to change it at any time in the game   ║
# ╚══════════════════════════════════════════════════════════╝
# ╔═════════════════════════════════════╗
# ║ Terms of use:                       ║
# ║ Free for all uses in RPG Maker      ║
# ╚═════════════════════════════════════╝

module R2_Game_Over_Transfer
  Transfer_Var = 10 # variable hold data in format [map id, x, y, d]
  Transfer_Switch = 10 # turn script on/off, switch on = script off
  Title_Switch = 9 # if switch is true will return to title screen
end

class Scene_Gameover < Scene_Base
 
  alias r2_gameover_start_transfer  start
  def start
    r2_gameover_start_transfer
    Graphics.freeze
    revive_for_transfer
  end

  def update
    super
    if $game_switches[R2_Game_Over_Transfer::Title_Switch] == false
      dispose_background if Input.trigger?(:C)
      SceneManager.goto(Scene_Map) if Input.trigger?(:C)
    else
      goto_title if Input.trigger?(:C)
    end
  end
 
  def revive_for_transfer
    return if $game_switches[R2_Game_Over_Transfer::Transfer_Switch] == true
    return if $game_variables[R2_Game_Over_Transfer::Transfer_Var] == 0
    $game_party.battle_members.each { |actor|
      actor.hp = actor.mhp
      actor.mp = actor.mmp
      actor.remove_state(1)
    }
    set_transfer
    transfer_save
  end
 
  def set_transfer
    map = $game_variables[R2_Game_Over_Transfer::Transfer_Var][0]
    x = $game_variables[R2_Game_Over_Transfer::Transfer_Var][1]
    y = $game_variables[R2_Game_Over_Transfer::Transfer_Var][2]
    d = $game_variables[R2_Game_Over_Transfer::Transfer_Var][3]
    $game_player.reserve_transfer(map, x, y, d)
    $game_player.perform_transfer
  end
 
  def transfer_save
    DataManager.save_game_without_rescue(DataManager.last_savefile_index)
  end
 
end

Original thread: https://forums.rpgmakerweb.com/threads/time-loop-in-rpgmaker-how-to-make-it-work.144577/