Wizard Engine Stat Saver Script

● ARCHIVED · READ-ONLY
Started by Wyn Wizard 2 posts View original ↗
  1. Hello everyone!

    I have recently picked up scripting again, feeling that I needed to actually do something with my RPG Maker career. So, thanks to Kerbonlkiln for the original idea, I made a script that upon level up, will save the stats of a specific player by adding a state to said player, then running a common event. Then said common event will check to see if any actors have this state, save each stat to its appropriate variables (i.e. Max HP -> Variable 1, Max MP -> Variable 2, etc.), then removing the previously applied state. Now, even though this script was meant to be a custom one exclusively for my game, I wanted to see if I could apply this effect to all the characters in the party.

    Here is the single person script:

    Spoiler
    #==================================================================================# Author: Wyn Wizard# Email: eugenepetrie@live.com# Supporting Authors: Kerbonklin (for basic idea of the script)# Title: Wyn Wizard Stat Saver# Creation Date: 9/14/2014# Version: 1.0.0#==================================================================================# KNOWN BUGS:# None#----------------------------------------------------------------------------------# UPDATES:# 1.) New Editable Region 9/14/2014#----------------------------------------------------------------------------------# INSTRUCTIONS:# Editable region starts on line 42.# # Actor: lets you choose which actor in your database gets this effect.# # Common_Event: lets you choose the slot the custom common event is in.# # State: lets you choose the clot in which the custom state is located.# # NOTE: the slot in which your Actor, Common_Event, and State # are located must match the numbers located in the editable region!# # If any errors occur, please feel free to email me at eugenepetrie@live.com,# or pm me, Wyn Wizard.#----------------------------------------------------------------------------------# TERMS AND CONDITIONS:## This script are free to use in FREE games, where the only thing I ask is to be given credit.# For COMMERCIAL games, please email me.#==================================================================================$imported = {} if $imported.nil?$imported["WizardEngine-TitleEngine"] = true#==================================================================================# EDITABLE REGION#==================================================================================module WIZENG module STAT Actor = 1 Common_Event = 1 State = 26 end # end STATend # end WIZENG#==================================================================================# END EDITABLE REGION#==================================================================================#==================================================================================# ** Game_Actor#----------------------------------------------------------------------------------# This class handles actors. It is used within the Game_Actors class# ($game_actors) and is also referenced from the Game_Party class ($game_party).#==================================================================================class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias wizard_initialize initialize def initialize(actor_id) p("Stat Saver Script Initialized") actor = wizard_initialize(actor_id) return actor end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- alias wizard_level_up level_up def level_up wizard_level_up $game_actors[WIZENG::STAT::Actor].add_state(WIZENG::STAT::State) $game_temp.reserve_common_event(WIZENG::STAT::Common_Event) p("Stat Saver Level Up Called") endend
    now here is the broken party version:

    Spoiler
    $imported = {} if $imported.nil?$imported["WizardEngine-TitleEngine"] = true#==================================================================================# EDITABLE REGION#==================================================================================module WIZENG module STAT #Actor = 1 Common_Event = 1 State = 26 end # end STATend # end WIZENG#==================================================================================# END EDITABLE REGION#==================================================================================#==================================================================================# ** Game_Actor#----------------------------------------------------------------------------------# This class handles actors. It is used within the Game_Actors class# ($game_actors) and is also referenced from the Game_Party class ($game_party).#==================================================================================class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias wizard_initialize initialize def initialize(actor_id) p("Stat Saver Script Initialized") actor = wizard_initialize(actor_id) return actor end #-------------------------------------------------------------------------- # * Level Up #-------------------------------------------------------------------------- alias wizard_level_up level_up def level_up wizard_level_up for i in $game_party.size() $game_actors.add_state(WIZENG::STAT::State) $game_temp.reserve_common_event(WIZENG::STAT::Common_Event) actor_HP = $game_actors.max_hp $game_variables = actor_HP end p("Stat Saver Level Up Called") endend

    Whats broken is the fact that i can't find the size of the party to test to see if the max hp of the actor "i" is being saved anywhere. Also, if you can't get the actor's max hp from the "$game_actors.max_hp" then how do I find this stat per actor?

     

    I am a little befuddled over how to find all the functions that can be called per global variable (i.e. $game_variables, $game_actors, etc.), and if there is a place I can find them, where are they located at?

     
  2. $game_party.all_members.size should return you the size you need.

    You could also do something like this:

    alias wizard_level_up level_updef level_up wizard_level_up $game_party.all_members.each_with_index do |actor, i| actor.add_state(WIZENG::STAT::STATE) $game_temp.reserve_common_event(WIZENG::STAT::Common_Event) $game_variables = actor.max_hp endendWhy do you need a common event in the first place? 

    You could do all the saving in the script.