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
I'm looking for a script where the stats (EVA, DEX, INT, STR etc) increases or decreases by a certain amount by using a certain skill during battle.. I want it to be temporary where it will wear off after the battle ends.

The states isn't really of any help as it only change stats by a fix amount so skills effects isn't really gonna vary as much.. Thanks in Advance
So rather than using a percentage value (such as how 'Clumsy' reduces Dexterity by 50%), you want an actual point system like granting a +50pt bonus to STR ?

If so, it would require a few addendums to the Game Battler's Status effect codes (like these):
Code:
#--------------------------------------------------------------------------
  # * Get Strength (STR)
  #--------------------------------------------------------------------------
  def str
    n = [[base_str + @str_plus, 1].max, 999].min
    for i in @states
      n *= $data_states[i].str_rate / 100.0
    end
    n = [[Integer(n), 1].max, 999].min
    return n
  end
These would need editing along with a few other options.
(08-30-2013, 03:08 AM)DerVVulfman Wrote: [ -> ]So rather than using a percentage value (such as how 'Clumsy' reduces Dexterity by 50%), you want an actual point system like granting a +50pt bonus to STR ?

If so, it would require a few addendums to the Game Battler's Status effect codes (like these):
Code:
#--------------------------------------------------------------------------
# * Get Strength (STR)
#--------------------------------------------------------------------------
def str
n = [[base_str + @str_plus, 1].max, 999].min
for i in @states
n *= $data_states[i].str_rate / 100.0
end
n = [[Integer(n), 1].max, 999].min
return n
end
These would need editing along with a few other options.
[/i]


I would like it if you can just set up the reduced in stats in the script instead of in the database (Since I still have to create a lot of states and all that..) I want it to be straightforward where I don't have to link the skills to any states to give the change in stat effect..



I don't really make scripts but I'm thinking it would look like this....



STR[Skill_ID] = 50


or


EVA[Skill_ID] = -45


Numbers are fixed amount and not percentage as you have said on your post


Sorry if I seem to be asking too much. And Thanks for the help anyway..



Can I ask why you want to use hard numbers over a percentage? Hard numbers have an overwhelming effect in the early game, but very little in the late game. While a percentage is always useful.
(08-30-2013, 02:06 PM)MechanicalPen Wrote: [ -> ]Can I ask why you want to use hard numbers over a percentage? Hard numbers have an overwhelming effect in the early game, but very little in the late game. While a percentage is always useful.

To have more variety.. I'm planning to have a lot of skills in my game (over 2000.. yes, I used a Database limit breaker).. but also so some skills can have a very specific damage. Such as "This skill will deal 250 damage" and will always do whatever level the character is..


As I said, its just to differentiate a huge number of skills from each other.

edit: But ofcourse having both percentage and a fix number is always useful than just one of them
I like skills that do, for example, "50 damage + 70% of your strength".
Any plans for something like that?
(08-30-2013, 02:32 PM)gerronix12 Wrote: [ -> ]
(08-30-2013, 02:06 PM)MechanicalPen Wrote: [ -> ]Can I ask why you want to use hard numbers over a percentage? Hard numbers have an overwhelming effect in the early game, but very little in the late game. While a percentage is always useful.

To have more variety.. I'm planning to have a lot of skills in my game (over 2000.. yes, I used a Database limit breaker).. but also so some skills can have a very specific damage. Such as "This skill will deal 250 damage" and will always do whatever level the character is..


As I said, its just to differentiate a huge number of skills from each other.

edit: But ofcourse having both percentage and a fix number is always useful than just one of them
That is a good reason, but just remember that any skill that fixed damage or stat up will never be used over a percentage in the second half of the game.
Another solution is to have the ability to upgrade skills.
Lvl 1: 50 damage
Lvl 2: 80 damage
etc

That keeps these kinds of attacks relevant.
(08-30-2013, 03:50 PM)MechanicalPen Wrote: [ -> ]
(08-30-2013, 02:32 PM)gerronix12 Wrote: [ -> ]
(08-30-2013, 02:06 PM)MechanicalPen Wrote: [ -> ]Can I ask why you want to use hard numbers over a percentage? Hard numbers have an overwhelming effect in the early game, but very little in the late game. While a percentage is always useful.

To have more variety.. I'm planning to have a lot of skills in my game (over 2000.. yes, I used a Database limit breaker).. but also so some skills can have a very specific damage. Such as "This skill will deal 250 damage" and will always do whatever level the character is..

As I said, its just to differentiate a huge number of skills from each other.

edit: But ofcourse having both percentage and a fix number is always useful than just one of them
That is a good reason, but just remember that any skill that fixed damage or stat up will never be used over a percentage in the second half of the game.
Well, I've seen games where no actual character levels are applied, or games where you may have levels but no increase in stats without an outside influcence (training gyms or etc). So a flat rate system would be interesting to have in those cases where your stats don't change that much from beginning to end.
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
Pages: 1 2