Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Elemental and State Rates
#1
Elemental and State Rates
Version: 1.0


Introduction
This script brings back a lost feature from rm2k(3). It allows you to set the elemental multiplier for elemental and chance for state resistance. It also changes the resistance system to bump down a resistance level if they guard against the element (rather than reducing by half which is crazy)


Script
Code:
module Elem_State_Rate
  #--------------------------------------------------------------------------
  # * Elemental Rates
  #   - syntax: Element_Id => [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  Elemental = {
  1 => [1000, 500, 200, 100, 0, -100]
  }
  #--------------------------------------------------------------------------
  # * Default Elemental Rate
  #   - syntax: [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  Elemental.default = [200,150,100,50,0,-100]
  #--------------------------------------------------------------------------
  # * State Rates
  #   - syntax: Element_Id => [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  States = {
  }
  #--------------------------------------------------------------------------
  # * Default State Rate
  #   - syntax: [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  States.default = [100,80,60,40,20,0]
end  

class Game_Battler
  #--------------------------------------------------------------------------
  # * State Change (+) Application
  #     plus_state_set  : State Change (+)
  #--------------------------------------------------------------------------
  def states_plus(plus_state_set)
    # Clear effective flag
    effective = false
    # Loop (added state)
    for i in plus_state_set
      # If this state is not guarded
      unless self.state_guard?(i)
        # Set effective flag if this state is not full
        effective |= self.state_full?(i) == false
        # If states offer [no resistance]
        if $data_states[i].nonresistance
          # Set state change flag
          @state_changed = true
          # Add a state
          add_state(i)
        # If this state is not full
        elsif self.state_full?(i) == false
          # Get Table
          table = Elem_State_Rate::States[i]
          # Random Chance
          if rand(100) < table[self.state_ranks[i]-1]
            # Set state change flag
            @state_changed = true
            # Add a state
            add_state(i)
          end
        end
      end
    end
    # End Method
    return effective
  end
end

class Game_Actor < Game_Battler
  #-------------------------------------------------------------------------
  # * Name:      Armor Ids
  #   Info:      Gets ALL Armor IDs
  #   Author:    Trickster
  #   Call Info: No Arguments
  #   Returns:   An Array of Armor Ids
  #   Comments:  Detects @armor(n)_id
  #-------------------------------------------------------------------------
  def armor_ids
    equipment = []
    i = 1
    while eval("@armor#{i}_id") != nil
      equipment << eval("@armor#{i}_id")
      i += 1
    end
    return equipment
  end
  #--------------------------------------------------------------------------
  # * Get Element Revision Value
  #     element_id : element ID
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    # Get values corresponding to element effectiveness
    table = Elem_State_Rate::Elemental[element_id]
    # Get Value Minus 1 (0 in front was removed)
    value = $data_classes[@class_id].element_ranks[element_id] - 1
    # Run Through each armor
    self.armor_ids.each do |armor_id|
      # Get Armor
      armor = $data_armors[armor_id]
      # Skip if state is nil or doesn't guard
      next if armor == nil or !armor.guard_element_set.include?(element_id)
      # Add 1 (Bump up)
      value += 1
    end
    # Run Through each state
    @states.each do |state_id|
      # Get State
      state = $data_states[state_id]
      # Skip if state is nil or doesn't guard against element
      next if state == nil or !state.guard_element_set.include?(element_id)
      # Add 1 (Bump up)
      value += 1
    end
    # Restrict to[0,5]
    value = [[value, 0].max, 5].min
    # End Method
    return table[value]
  end
end

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Get Element Revision Value
  #     element_id : Element ID
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    # Get values corresponding to element effectiveness
    table = Elem_State_Rate::Elemental[element_id]
    # Get Value Minus 1 (0 in front was removed)
    value = $data_enemies[@enemy_id].element_ranks[element_id] - 1
    # Run Through each state
    @states.each do |state_id|
      # Get State
      state = $data_states[state_id]
      # Skip if state is nil or doesn't guard against element
      next if state == nil or !state.guard_element_set.include?(element_id)
      # Add 1 (Bump up)
      value += 1
    end
    # Restrict to[0,5]
    value = [[value, 0].max, 5].min
    # End Method
    return table[value]
  end
end


Instructions
Add this script in a new script below Scene_Debug and above your custom scripts

Here is the setup portion of the script it is pretty much self explanatory

Code:
#--------------------------------------------------------------------------
  # * Elemental Rates
  #   - syntax: Element_Id => [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  Elemental = {
  1 => [1000, 500, 200, 100, 0, -100]
  }
  #--------------------------------------------------------------------------
  # * Default Elemental Rate
  #   - syntax: [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  Elemental.default = [200,150,100,50,0,-100]
  #--------------------------------------------------------------------------
  # * State Rates
  #   - syntax: Element_Id => [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  States = {
  }
  #--------------------------------------------------------------------------
  # * Default State Rate
  #   - syntax: [A, B, C, D, E, F]
  #--------------------------------------------------------------------------
  States.default = [100,80,60,40,20,0]


FAQ
Note: Permission granted by Trickster to post:
Quote:And if you post what you have now of my stuff then you don't have the latest versions. I'm too lazy/busy to post stuff.
As this is his material, it is deletable upon his request. Due to his current absense, no support is available. Please do not PM or eMail him for support.


Compatibility
The methods Game_Battler#states_plus, Game_Actor#element_rate, and Game_Enemy#element_rate were modified


Author's Notes
This is the rescripted version of this script since I don't have access to the version I had before the hack.

If anyone has the other version that was posted before the hack contact me with the script, though this isn't very important but would be appreciated.


Terms and Conditions
Hey, I posted this publicly. You can use it. What do you expect? But if you do use it, I do expect you to spell my name correctly in your game. And yes you can use it in commercial games too.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   DoubleX RMMZ State Triggers DoubleX 2 3,619 12-02-2020, 04:10 AM
Last Post: DoubleX
   DoubleX RMVXA Reflect State DoubleX 1 5,760 09-16-2017, 03:52 AM
Last Post: DoubleX
   DoubleX RMMV State Resistance DoubleX 0 4,144 05-28-2016, 09:44 AM
Last Post: DoubleX
   DoubleX RMVXA State Triggers DoubleX 4 8,679 05-14-2016, 03:25 AM
Last Post: DoubleX
   DoubleX RMMV State Triggers DoubleX 4 7,427 05-14-2016, 03:19 AM
Last Post: DoubleX
   DoubleX RMVXA State Counters DoubleX 4 7,609 09-19-2015, 01:57 PM
Last Post: DoubleX
   Victor Engine - State Graphics Victor Sant 0 4,497 12-15-2012, 01:52 AM
Last Post: Victor Sant
   Victor Engine - State Aura Victor Sant 0 3,888 08-02-2012, 12:04 AM
Last Post: Victor Sant
   Victor Engine - State Auto Apply Victor Sant 0 3,673 06-25-2012, 12:17 AM
Last Post: Victor Sant
   Victor Engine - State Cancel Victor Sant 0 3,563 06-24-2012, 01:33 AM
Last Post: Victor Sant



Users browsing this thread: