Save-Point
KustomElemState XP - 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: KustomElemState XP (/thread-13485.html)



KustomElemState XP - kyonides - 05-26-2026

KustomElemState XP

by Kyonides

The Script is NOT COMPATIBLE With Other Element or State Related Scripts!

Introduction

It's a very brief one for sure. Winking
Alter a given Actor's element or state rate during gameplay! Gamer 
The script creates or loads the custom ranks based on the current class. Orson Ghim Slayne 
It will never try to alter the Classes database contents! Two Thumbs Up! 

Element / State Efficiency Letter 2 Percentage Conversion Table

A - 200% (Weak)
B - 150%
C - 100% (Default)
D - 50%
E - 0% (Immune)
F - -100% (Gets Healed?)

Script Calls

STEP 1
Get an Actor first! - 2 Methods:
Code:
actor = $game_party.actors[Index]
actor = $game_actors[ActorID]

STEP 2
Use any of the following calls.

Check out the current Index of an Element Rate:
Code:
actor.find_element_rate(ElementID)

Check out the current Effect % of an Element:
Code:
actor.element_effect(ElementID)

Change an Actor's Element Rate!  Rate Indices: 1 through 6
Code:
actor.custom_element_rank(ElementID, RateIndex)

Change an Actor's State Rate!    Rate Indices: 1 through 6
Code:
actor.custom_state_rank(StateID, RateIndex)

Move Current Element State 1 Position to the Left
Code:
actor.prev_element_rate!(ElementID)

Move Current Element State 1 Position to the Right
Code:
actor.next_element_rate!(ElementID)

USAGE EXAMPLE

The Script

Code:
# * KustomElemState XP * #
#   Scripter : Kyonides
#   2025-05-25

# * NOT COMPATIBLE With Other Element or State Related Scripts! * #

# Alter a given Actor's element or state rate during gameplay!
# The script creates / loads the custom ranks based on the current class.
# It will never try to alter the Classes DB contents!

# * Script Calls * #

# STEP #1: Get an Actor first! - 2 Methods:
# actor = $game_party.actors[Index]
# actor = $game_actors[ActorID]

# STEP #2: Use any of the following calls.
# - Check out the current Index of an Element Rate:
# actor.find_element_rate(ElementID)

# - Check out the current Effect % of an Element:
# actor.element_effect(ElementID)

# - Change an Actor's Element Rate!  Rate Indices: 1 through 6
# actor.custom_element_rank(ElementID, RateIndex)

# - Change an Actor's State Rate!    Rate Indices: 1 through 6
# actor.custom_state_rank(StateID, RateIndex)

# - Move Current Element State 1 Position to the Left
# actor.prev_element_rate!(ElementID)

# - Move Current Element State 1 Position to the Right
# actor.next_element_rate!(ElementID)

class Game_Actor
  ER_TABLE = [0,200,150,100,50,0,-100]
  alias :kyon_kust_elem_stt_gm_act_setup :setup
  alias :kyon_kust_elem_stt_gm_act_class_id_set :class_id=
  def setup(actor_id)
    kyon_kust_elem_stt_gm_act_setup(actor_id)
    @element_ranks = {}
    @state_ranks = {}
    custom_element_ranks!
    custom_state_ranks!
  end

  def custom_element_ranks!
    @element_ranks[@class_id] ||= $data_classes[@class_id].element_ranks.dup
  end

  def custom_state_ranks!
    @state_ranks[@class_id] ||= $data_classes[@class_id].state_ranks.dup
  end

  def find_element_rate(elem_id)
    @element_ranks[@class_id][elem_id]
  end

  def element_effect(elem_id)
    n = find_element_rate(elem_id)
    ER_TABLE[n]
  end

  def armor_ids
    [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
  end

  def element_rate(element_id)
    pos = find_element_rate(element_id)
    result = ER_TABLE[pos]
    armor_ids.each do |i|
      armor = $data_armors[i]
      if armor != nil and armor.guard_element_set.include?(element_id)
        result /= 2
      end
    end
    @states.each do |i|
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    return result
  end

  def state_ranks
    @state_ranks[@class_id]
  end

  def custom_element_rank(n, value)
    @element_ranks[@class_id][n] = value
  end

  def custom_state_rank(n, value)
    @state_ranks[@class_id][n] = value
  end

  def class_id=(class_id)
    class_id_set(class_id)
    custom_element_ranks!
    custom_state_ranks!
  end

  def change_element_rate(elem_id, value, start)
    pos = find_element_rate(elem_id)
    pos = (pos + value) % 7
    pos = start if pos == 0
    custom_element_rank(elem_id, pos)
    pos
  end

  def prev_element_rate!(elem_id)
    change_element_rate(elem_id, -1, 6)
  end

  def next_element_rate!(elem_id)
    change_element_rate(elem_id, 1, 1)
  end
end

Terms & Conditions

Free as in Beer beer.
Mention me in your game credits.
That's it! Tongue sticking out