Trb - RestoreBattle (Battle Save)

Discussion in 'JS Plugin Releases (RMMV)' started by tale, Oct 28, 2019.

  1. tale

    tale Volunteer Veteran

    Messages:
    462
    Likes Received:
    744
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    RestoreBattle - Version 1.00 (2017/1/14)

    Creator name: Trb

    Overview
    Allows you to save in battle and resume the battle from the battle save.

    Features
    - Save and restore is done through plugin commands.
    - To reset the battle save, run the script
    Code:
    $gameSystem._battleSaveData = []
    <Plugin Command>
    Code:
    SaveBattle
    Saves the previous battle state.
    If you want to save multiple times, add a number like "SaveBattle 1" or "SaveBattle 2"

    Code:
    RestoreBattle
    Before the battle event, you can restore from battle save.
    If multiple files are saved, restored the data with “RestoreBattle 1” or “RestoreBattle 2”

    Note: plugin commands for this plugin are not case sensitive. SAVEBATTLE and savebattle can be used.

    Event Sample)
    [​IMG]

    Battle with one Minotaur and two bats.
    [​IMG]

    After defeating two bats and then escape-
    (SaveBattle was used)
    [​IMG]
    [Harold escaped!]

    Retry the battle: only Minotaur remains
    (RestoreBattle 1 restore the state from SaveBattle 1)
    [​IMG]
    [Minotaur appears!]

    Credit and Thanks: Trb

    Terms of Use- Free for commercial and non-commercial use.

    License - MIT License: http://opensource.org/licenses/mit-license.php

    You can download js file from the thread attachment or Dropbox link: https://www.dropbox.com/s/68qehkaoew47j5u/Trb_RestoreBattle.js?dl=1
     

    Attached Files:

    #1
    Kaisyl, Eliaquim and gambitben like this.
  2. dragonx777

    dragonx777 Veteran Veteran

    Messages:
    92
    Likes Received:
    24
    Location:
    SC
    First Language:
    English
    Primarily Uses:
    RMMV
    This could be used for a Reset skill. I’ll have to try this out.
     
    #2
  3. dragonx777

    dragonx777 Veteran Veteran

    Messages:
    92
    Likes Received:
    24
    Location:
    SC
    First Language:
    English
    Primarily Uses:
    RMMV
    @tale is there a way to reset mid-battle? i was unable to accomplish this using a skill common event.
     
    #3
  4. tale

    tale Volunteer Veteran

    Messages:
    462
    Likes Received:
    744
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @dragonx777 Reset battle save does not mean it resets the battle process you're in.
    If you reset battle save in battle, technically you're erasing battle save.
    Plugin meant to handle saves while entering (restore) or escaping (save) battle.
     
    #4
  5. dragonx777

    dragonx777 Veteran Veteran

    Messages:
    92
    Likes Received:
    24
    Location:
    SC
    First Language:
    English
    Primarily Uses:
    RMMV
    Darn. Well that makes sense. Would there be a way to edit the plugin to have that optional functionality?
     
    #5
  6. tale

    tale Volunteer Veteran

    Messages:
    462
    Likes Received:
    744
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    Restart Battle would probably be separate plugin/ add-on.

    I found a script call that does the trick. If you're using it for skill, set Scope to None.
    Code:
    BattleManager.setup($gameTroop._troopId, true, false);
    SceneManager.push(Scene_Battle);
    If you want fully recovered party.
    Code:
    BattleManager.setup($gameTroop._troopId, true, false);
    SceneManager.push(Scene_Battle);
    
    $gameParty.members().forEach(function(m){
     m.recoverAll();
    });
    However it looks a bit clutter due to extra message windows from escape, victory, etc..

    Maybe someone who's more familiar with javascript could make this a lot neater to handle.

    During my test with Battle processing script call-
    After Minotaur is gone and two bats remains, I escaped.
    I tried battle again with two bats, then I used script call to restart.
    It brings back the Minotaur. It works, except not used with functionality of RestoreBattle.

    Note: script call actually starts another battle processing of the same encounter. If you escape a battle after script call, ends up repeating encounter.
     
    Last edited: Nov 10, 2019
    #6

Share This Page