Save File Management on Game over Condition

I'm going to try to be as specific as possible but I'm very new to JS and manipulating RPG Maker MV code so please bare with me. 🙂


First the broad description:


- First - After a player saves their game progress to a specific save file slot that player can no longer save in other file slots


- Second - Any time a player's condition becomes 'Knockout', or HP reaches zero, the 'Game Over' screen event happens


- Third - Any time a 'Game Over' event happens the save file corresponding to that specific game gets deleted automatically


Now the readme sticky before posting requests ask that I be as specific as possible so I'm going to be as specific as my capabilities allow. Also I'm not saying this is the only way  or the best way as I'm sure I'm not going to be anywhere near 100% on point.


In depth Description: 


**** Restricting save file to a specific slot after saving ****


      - Each Save File slot will be assigned a variable - For example Slot one will have a 2 digit variable Xx or whatever won't conflict with other variables


      - When a new game is created that game is assigned a variable called Game File or w/e and is given a unique 2 digit variable, the number of variables in the list equaling the number of save slots available


      - When a game is saved the Save File slot variable and the Game File variables will combine into a unique 4 digit variable, if the Save Slot file variable is Xx and the Game File variable is 3k then the new variable will be Xx3k and replace both the Save Slot and Game File variables with this variable


      - When a player attempts to save their progress and when they choose any given save file slot the following script will be triggered to run -


                - 1st - There is a check to see first if the Save File variable of the chosen save slot is a paired 4 digit variable or an unpaired 2 digit variable


                               - If the Save File variable is 4 digit - It will then check to see if the Game File variable is a paired 4 digit variable or an unpaired 2 digit variable


                                          - If the Game File variable is 2 digit - A cancel sound effect is played and the file is not saved


                                          - If the Game File variable is 4 digits - The Save Slot variable and the Game File variable are checked to see if they are identical


                                                  - If identical - The game saves


                                                  - If nonidentical - A cancel sound effect is played and the game is not saved


                               - If the Save File variable is 2 digit - It checks to see if the Game File Variable is 2 or 4 digits


                                           - If the Game File variable is 4 digits - A cancel sound effect plays and the game is not saved


                                           - If the Game File variable is 2 digits - The game is saved to that file and either the two variables are combined, Game File variable 3k and Save Slot variable Xx becomes Xx3k, or a new 4 digit variable is made. Both the Save Slot variables and the Game File variables are replaced with the same new 4 digit variable


      - This should allow a player to only save a new game to a unused save file and only allow a player once the progress is saved to a save file to only use that save file for that game


 *** Upon Knockout, or HP reaching zero the 'Game Over' event triggers ****


     This one is probably pretty easy and self explanatory and I don't know how to implement this or how best this should fit in  with the rest of the plugin


**** Upon any 'Game Over' event the specific save file that get's automatically erased ****


        - I envision this working like - Trigger is when 'Game Over' event triggers


                                                    - The script checks the Game File variable, Xx3k, or just 3k etc


                                                    - If the check comes back and it's a paired variable, Xx3k not just an unpaired 3k, it will check which save file slot variable has that same variable and it will delete that save file


                                                    - If the check comes back and the game file is not paired, just a 3k w/e, nothing happens


I hope this explains it well enough that someone could construct or help me construct the actual scripting required to achieve this effect. Again I'm not saying this is the best way to accomplish this so if anyone has a better way feel free to suggest that.


Thank you for reading. 🙂
Answer for your Second Question


Create a parallel process which will trigger if the HP of your player if his HP is 0; First Get the Value of HP by passing it to a Variable then the condition will do trigger if the Variable(HP) = 0


 I have a Screen shot for that: 


bnUhrF.jpg



Also The Switch Gameover should be on Autorun to start the trigger. 

Original thread: https://forums.rpgmakerweb.com/threads/save-file-management-on-game-over-condition.64891/