KustomElemState XP
#1
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
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply


Messages In This Thread
KustomElemState XP - by kyonides - Today, 04:36 AM



Users browsing this thread: 1 Guest(s)