Save-Point
Saving Temporary Actors' Data - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Saving Temporary Actors' Data (/thread-7326.html)



Saving Temporary Actors' Data - kyonides - 09-06-2018

Saving Temporary Actors' Data


I'm not following the usual scripting format for this is just a scriptlet.

Well, you should know by now that it is possible to "save" data before you enter a battle... yeah by means of calling a script!

You can save the very same $game_party data BEFORE your enter the battle and without creating a saved file. In case the team loses, you would just retrieve everything from the temporary variables you would have created, i.e. $game_temp_party.

The Script to be Pasted on your Script Editor

Code:
class Game_TempActors
 attr_reader :actors, :items, :weapons, :armors
 def initialize
   @game_actors = $game_actors.clone
   @actors = $game_party.actors.clone
   @items = $game_party.items.clone
   @weapons = $game_party.weapons.clone
   @armors = $game_party.armors.clone
 end
end

class Game_Party
 def reset_data
   $game_actors = @game_actors#.clone
   @actors = $game_temp_actors.actors#.clone
   @items = $game_temp_actors.items#.clone
   @weapons = $game_temp_actors.weapons#.clone
   @armors = $game_temp_actors.armors#.clone
   $game_temp_actors = @game_actors = nil
 end
end

Script Call to Use Before Battle

$game_temp_actors = Game_TempActors.new

Script Call to Use After Losing the Battle

$game_party.reset_data

or the following call if you won...

$game_temp_actors = nil

Terms & Conditions

You are free to use the way you like it, no restrictions apply here. Just keep in mind I won't be held responsible if you screw it! Laughing + Tongue sticking out


RE: Saving Temporary Actors' Data - kyonides - 09-07-2018

I have updated my script in order to make it compatible for all RGSS based RPG Makers.