Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Stat Increase by Skill

Save-Point

Full Version: Stat Increase by Skill
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(08-31-2013, 03:08 AM)DerVVulfman Wrote: [ -> ]Doublebumps are permitted if important content is added.... and after work, I went and cobbled this little thingie up:

Insert the command into the Scene_Title methods as it depicts and work out the values in the Flat_States module, and you're good to go. Winking

Code:
#==============================================================================
# ** Flat State Effects
#------------------------------------------------------------------------------
#    by DerVVulfman
#    version 1.0
#    08-30-2013
#    RGSS / RPGMaker XP
#------------------------------------------------------------------------------
#
#  Requested by: gerronix12
#
#  This script requires  a very minor edit  on your part  to make this system
#  work.   It requires that you insert a command  into two methods within the
#  Scene_Title class, specifically within both the 'main' & the 'battle_test'
#  methods as you can see below:
#  
#      $data_system        = load_data("Data/System.rxdata")
#      
#      # New Insert to alter status effects...
#      states_flatrate_addition
#      
#  This script requires  a very minor edit  on your part  to make this system
#  After that, just add the new arrays for each status effect which will have
#  flat rates.  As an example, the script had tweaked out the 4th status eff-
#  ect (aka DAZZLE) to give the victim a +10 boost to magic defense  while it
#  gives a -5 penalty to the victim's agility score.
#
#------------------------------------------------------------------------------
#
#  == All values must be entered.  No nil values or empty spaces accepted. ==
#
#------------------------------------------------------------------------------
#  NOTE:  May interfere with Database Limit Break / Limit Overriding systems.
#         That's where the code is commented: "Calculate between boundaries".
#==============================================================================


module Flat_States
  
  FLAT_STATES = {}

  # ===============
  # FLAT RATES BY
  # STATE ID NUMBER    HP   SP   STR  DEX  AGI  INT  ATK  HIT  PDF  MDF  EVA
  # ==============     ===  ===  ===  ===  ===  ===  ===  ===  ===  ===  ===
    FLAT_STATES[4] = [   0,   0,   0,   0,  -5,   0,   0,   0,   0,  10,   0 ]
  
  
end





#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
#  A module containing RPGXP's data structures and more.
#==============================================================================

module RPG
  #============================================================================
  # ** State
  #----------------------------------------------------------------------------
  #  Data class for state.
  #============================================================================

  class State
    #------------------------------------------------------------------------
    # * Public Instance Values
    #------------------------------------------------------------------------    
    attr_accessor :hit_flat
    attr_accessor :maxhp_flat
    attr_accessor :maxsp_flat
    attr_accessor :str_flat
    attr_accessor :dex_flat
    attr_accessor :agi_flat
    attr_accessor :int_flat
    attr_accessor :atk_flat
    attr_accessor :pdef_flat
    attr_accessor :mdef_flat
    attr_accessor :eva_flat
    #------------------------------------------------------------------------
    # * Object Initialization
    #------------------------------------------------------------------------    
    alias flat_states_initialize initialize
    def initialize
      # Perform the original call
      flat_states_initialize
      # New Values
      @hit_flat   = 0
      @maxhp_flat = 0
      @maxsp_flat = 0
      @str_flat   = 0
      @dex_flat   = 0
      @agi_flat   = 0
      @int_flat   = 0
      @atk_flat   = 0
      @pdef_flat  = 0
      @mdef_flat  = 0
      @eva_flat   = 0
    end
  end
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias flat_states_battler_maxhp maxhp
  alias flat_states_battler_maxsp maxsp
  alias flat_states_battler_str   str
  alias flat_states_battler_dex   dex
  alias flat_states_battler_agi   agi
  alias flat_states_battler_int   int
  alias flat_states_battler_hit   hit
  alias flat_states_battler_atk   atk
  alias flat_states_battler_pdef  pdef
  alias flat_states_battler_mdef  mdef
  alias flat_states_battler_eva   eva
  #--------------------------------------------------------------------------
  # * Get Maximum HP
  #--------------------------------------------------------------------------
  def maxhp
    # Perform the original call
    n = flat_states_battler_maxhp
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].maxhp_flat
    end
    # Calculate between boundaries
    n = [[Integer(n), 1].max, 999999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Maximum SP
  #--------------------------------------------------------------------------
  def maxsp
    # Perform the original call
    n = flat_states_battler_maxsp
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].maxsp_flat
    end
    # Calculate between boundaries
    n = [[Integer(n), 0].max, 9999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Strength (STR)
  #--------------------------------------------------------------------------
  def str
    # Perform the original call
    n = flat_states_battler_str
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].str_flat
    end
    # Calculate between boundaries
    n = [[Integer(n), 1].max, 999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Dexterity (DEX)
  #--------------------------------------------------------------------------
  def dex
    # Perform the original call
    n = flat_states_battler_dex
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].dex_flat
    end
    # Calculate between boundaries
    n = [[Integer(n), 1].max, 999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Agility (AGI)
  #--------------------------------------------------------------------------
  def agi
    # Perform the original call
    n = flat_states_battler_agi
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].agi_flat
    end
    # Calculate between boundaries
    n = [[Integer(n), 1].max, 999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Intelligence (INT)
  #--------------------------------------------------------------------------
  def int
    # Perform the original call
    n = flat_states_battler_int
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].int_flat
    end
    # Calculate between boundaries
    n = [[Integer(n), 1].max, 999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Hit Rate
  #--------------------------------------------------------------------------
  def hit
    # Perform the original call
    n = flat_states_battler_hit
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].hit_flat
    end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Attack Power
  #--------------------------------------------------------------------------
  def atk
    # Perform the original call
    n = flat_states_battler_atk
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].atk_flat
    end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Physical Defense Power
  #--------------------------------------------------------------------------
  def pdef
    # Perform the original call
    n = flat_states_battler_pdef
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].pdef_flat
    end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Magic Defense Power
  #--------------------------------------------------------------------------
  def mdef
    # Perform the original call
    n = flat_states_battler_mdef
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].mdef_flat
    end
    return Integer(n)
  end
  #--------------------------------------------------------------------------
  # * Get Evasion Correction
  #--------------------------------------------------------------------------
  def eva
    # Perform the original call
    n = flat_states_battler_eva
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].eva_flat
    end
    return n
  end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
    alias flat_states_battler_maxhp maxhp
  #--------------------------------------------------------------------------
  # * Get Maximum HP
  #--------------------------------------------------------------------------
  def maxhp
    # Perform the original call
    n = flat_states_battler_maxhp
    # Cycle through states
    for i in @states
      # Add flat rate for given parameter
      n += $data_states[i].maxhp_flat
    end
    # Calculate between boundaries
    n = [[Integer(n), 1].max, 999999].min
    return n
  end
end



#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
#  A module containing RPGXP's data structures and more.
#==============================================================================

module RPG
  #============================================================================
  # ** State
  #----------------------------------------------------------------------------
  #  Data class for state.
  #============================================================================

  class State
    #------------------------------------------------------------------------
    # * Public Instance Values
    #------------------------------------------------------------------------  
    def swap_state_parameters
      # Get current ID
      id = @id
      # Only if flat rate exists
      if Flat_States::FLAT_STATES.has_key?(id)
        # Use current ID to affect current state
        @maxhp_flat = Flat_States::FLAT_STATES[id][0]
        @maxsp_flat = Flat_States::FLAT_STATES[id][1]
        @str_flat   = Flat_States::FLAT_STATES[id][2]
        @dex_flat   = Flat_States::FLAT_STATES[id][3]
        @agi_flat   = Flat_States::FLAT_STATES[id][4]
        @int_flat   = Flat_States::FLAT_STATES[id][5]
        @atk_flat   = Flat_States::FLAT_STATES[id][6]
        @hit_flat   = Flat_States::FLAT_STATES[id][7]
        @pdef_flat  = Flat_States::FLAT_STATES[id][8]
        @mdef_flat  = Flat_States::FLAT_STATES[id][9]
        @eva_flat   = Flat_States::FLAT_STATES[id][10]
      else
        @hit_flat   = 0
        @maxhp_flat = 0
        @maxsp_flat = 0
        @str_flat   = 0
        @dex_flat   = 0
        @agi_flat   = 0
        @int_flat   = 0
        @atk_flat   = 0
        @pdef_flat  = 0
        @mdef_flat  = 0
        @eva_flat   = 0
      end
    end
  end
end



#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs title screen processing.
#==============================================================================

class Scene_Title
  #--------------------------------------------------------------------------
  # * Setup Scopes
  #--------------------------------------------------------------------------
  def states_flatrate_addition
    # Run Through states
    ($data_states).each do |state|
      # Skip if state is nil
      next if state.nil?
      # Setup flat rate for state
      state.swap_state_parameters
    end
  end
end


I know I'm asking too much but can you please make a demo on how it works? I really have no experience in scripting. Its ok if you're busy, you don't need to do it ASAP, I just really need to know how it works.. Thanks, like seriously..
Actually, I don't think a demo is even necessary. Inserting it into a blank project is all that's necessary.

Look at this main part of the script
Code:
# FLAT RATES BY
  # STATE ID NUMBER    HP   SP   STR  DEX  AGI  INT  ATK  HIT  PDF  MDF  EVA
  # ==============     ===  ===  ===  ===  ===  ===  ===  ===  ===  ===  ===
    FLAT_STATES[4] = [   0,   0,   0,   0,  -5,   0,   0,   0,   0,  10,   0 ]

This takes the already existing 4th state in your database (Dazzle I think??) and does two things. It gives a -5 points penalty to the user's AGILITY but grants a +10 points to their Magic Defense.

This means that anyone hit with the 'Dazzle' skill (or any skill with the Dazzle state) will not just have the default status effect, but will also have these two parameter value effects.

So plugging this script in place will already do that. Just make as many lines as you want like this:
Code:
FLAT_STATES[4] = [   0,   0,   0,   0,  -5,   0,   0,   0,   0,  10,   0 ]
FLAT_STATES[8] = [  10,  20,   0,   0,   0,   0,   0,   0,   0,  10,   0 ]

I dunno what State #8 is (I'm at work). But this second line would add +10 to thier max health, +20 to their max SP and again grant +10 to thier MDF. But only for as long as you design that state to remain effective.

AND... these effects can stack. For example, you make a state that drops a character's dexterity by 25% using the default system..... like Fumble. You can also use this to give it an additional -15 point reduction after that!



Just make sure you have the brackets [ ] properly set.
(09-08-2013, 10:16 PM)DerVVulfman Wrote: [ -> ]Actually, I don't think a demo is even necessary. Inserting it into a blank project is all that's necessary.

Look at this main part of the script
Code:
# FLAT RATES BY
# STATE ID NUMBER HP SP STR DEX AGI INT ATK HIT PDF MDF EVA
# ============== === === === === === === === === === === ===
FLAT_STATES[4] = [ 0, 0, 0, 0, -5, 0, 0, 0, 0, 10, 0 ]

This takes the already existing 4th state in your database (Dazzle I think??) and does two things. It gives a -5 points penalty to the user's AGILITY but grants a +10 points to their Magic Defense.

This means that anyone hit with the 'Dazzle' skill (or any skill with the Dazzle state) will not just have the default status effect, but will also have these two parameter value effects.

So plugging this script in place will already do that. Just make as many lines as you want like this:
Code:
FLAT_STATES[4] = [ 0, 0, 0, 0, -5, 0, 0, 0, 0, 10, 0 ]
FLAT_STATES[8] = [ 10, 20, 0, 0, 0, 0, 0, 0, 0, 10, 0 ]

I dunno what State #8 is (I'm at work). But this second line would add +10 to thier max health, +20 to their max SP and again grant +10 to thier MDF. But only for as long as you design that state to remain effective.

AND... these effects can stack. For example, you make a state that drops a character's dexterity by 25% using the default system..... like Fumble. You can also use this to give it an additional -15 point reduction after that!



Just make sure you have the brackets [ ] properly set.
Ok, I get it completely now.. I feel so stupid now.. lol.. Sorry for being an idiot.. Thanks.. And just to be clear.. The stat change is only temporary right? After the battle, all the stat change will be removed right?..

edit: Oh yeah, I can either make it temporary or not and there's an option about it..
So I guess this request was solved? Winking
(09-09-2013, 02:39 AM)DerVVulfman Wrote: [ -> ]So I guess this request was solved? Winking
Yes.. thanks
Pages: 1 2