Ekuipment Points VX
#1
Ekuipment Points VX

by Kyonides

Introduction

Limit the type of weapons or armor pieces your heroes will be able to equip!
If your heroes want to replace their equipment, they better earn enough EP first!
Another way to explain it would be to call it an equipment weight script.

The script lets you set the default and custom EP the actor will start with. The same is valid for weapons and pieces of armor.
Actors can also gain more EP by leveling up.

Inside the EkuipPoints module you can find the WEAPON_POINTS, ARMOR_POINTS, ACTOR_POINTS & the ACTOR_LEVEL_POINTS constants that will let you customize the EP earned by actors and the EP costs of their equipment.

You can also change the X & Y coordinates of windows or EP labels at will.

NOTES

Actors have no note boxes. This is why you need to depend on the ACTOR_POINTS & ACTOR_LEVEL_POINTS constants to set their EP accordingly.
To open the equipment window in battle, during the actor's command phase, press the RM's X button. Normally, it's linked to your A key on the keyboard.

Screenshots

The Script

Code:
# * Ekuipment Points VX * #
#   Scripter : Kyonides
#   v1.0.5 - 2025-11-05

# Limit the type of weapons or armor pieces your heroes will be able to equip!
# If heroes want to replace their equipment, they better earn enough EP first!

# Note Tag: <ep n> where n is a positive number.

# * Optional Script Calls * #
# Block a given actor's change equipment feature, especially useful in battle:
#  boolean stands for true OR false only.
#   $game_actors[ActorID].block_equip_change = boolean
#   $game_party.members[Index].block_equip_change = boolean

# Block the party's change equipment feature at once:
#   $game_party.block_equip_change = boolean

# Increase a given actor's equipment points:
#   $game_actors[ActorID].ep_plus += Number
#   $game_party.members[Index].ep_plus += Number

module EkuipPoints
  LABEL = "EP"
  EP_LABEL_COLOR = [40, 242, 254] # [R,G,B]
  GAUGE_COLOR1   = [255, 180, 60] # [R,G,B]
  GAUGE_COLOR2   = [180, 255, 60] # [R,G,B]
  EP_COST_X = 170
  EP_STATUS_XY_WH  = [0, 24, 120, 6]
  BATTLE_EQUIP_WIN_X   = 80
  BATTLE_EQUIP_WIN_Y   = 288
  BATTLE_EQUIP_WIN_OPA = 255
  BATTLE_EQUIP_WIN_BACK_OPA = 255
  EQUIP_BASE_POINTS = 1
  ACTOR_POINTS = {}
  ACTOR_POINTS.default = 4
  # [ActorID] = BasePoints
  ACTOR_POINTS[1] = 6
  ACTOR_POINTS[2] = 7
  ACTOR_LEVEL_POINTS = {}
  ACTOR_LEVEL_POINTS.default = { :levels => 10, :ep => 1 }
  # [ActorID] = { :levels => LevelsNeeded, :ep => ExtraPoints }
  ACTOR_LEVEL_POINTS[1] = { :levels => 8, :ep => 2 }
end

module RPG
  class BaseItem
    BASE_EP = EkuipPoints::EQUIP_BASE_POINTS
    def note_ep
      @note[/<ep (\d+)/i]
      $1 ? $1.to_i : BASE_EP
    end

    def ep_cost
      @ep_cost ||= note_ep
    end
  end

  class Equipment
    def ep_cost
      0
    end
  end
end

class Game_Actor
  alias :kyon_ekuip_points_gm_act_stp :setup
  alias :kyon_ekuip_points_gm_act_lvl_up :level_up
  alias :kyon_ekuip_points_gm_act_lvl_dn :level_down
  def setup(actor_id)
    kyon_ekuip_points_gm_act_stp(actor_id)
    @maxep_base = EkuipPoints::ACTOR_POINTS[actor_id]
    hash = EkuipPoints::ACTOR_LEVEL_POINTS[actor_id]
    @base_ep_levels = hash[:levels]
    @base_level_ep = hash[:ep]
    @ep_plus = 0
    calc_level_ep
  end

  def calc_level_ep
    @level_ep = @level / @base_ep_levels * @base_level_ep
  end

  def level_up
    kyon_ekuip_points_gm_act_lvl_up
    calc_level_ep
  end

  def level_down
    kyon_ekuip_points_gm_act_lvl_dn
    calc_level_ep
  end

  def maxep
    @maxep_base + @level_ep + @ep_plus
  end

  def ep_used
    list = equips.compact
    list.inject(0) {|total, item| total + item.ep_cost }
  end

  def ep_left
    self.maxep - self.ep_used
  end

  def enough_ep?(equip_type, item)
    return true unless item
    equipment = equips[equip_type] || RPG::Equipment.new
    used = self.ep_used - equipment.ep_cost + item.ep_cost
    return false if used < 0
    self.maxep >= used
  end
  attr_accessor :ep_plus, :block_equip_change
end

class Game_Party
  def block_equip_change=(state)
    members.each {|actor| actor.block_equip_change = state }
  end
end

class Window_Base
  def ep_color
    @ep_color ||= Color.new(*EkuipPoints::EP_LABEL_COLOR)
  end

  def ep_gauge_color1
    @ep_gauge_color1 ||= Color.new(*EkuipPoints::GAUGE_COLOR1)
  end

  def ep_gauge_color2
    @ep_gauge_color2 ||= Color.new(*EkuipPoints::GAUGE_COLOR2)
  end

  def draw_ep_left(actor, lx, ly, lw, lh=4, large=nil)
    left = actor.ep_left
    gw = lw * left / actor.maxep
    gc1 = ep_gauge_color1
    gc2 = ep_gauge_color2
    c = self.contents
    c.fill_rect(lx, ly + WLH - lh - 2, lw, lh, gauge_back_color)
    c.gradient_fill_rect(lx, ly + WLH - lh - 2, gw, lh, gc1, gc2)
    c.font.color = system_color
    label = EkuipPoints::LABEL
    label = label[0] if large
    c.draw_text(lx, ly, lw, WLH, label)
    c.font.color = normal_color
    if large
      c.draw_text(lx, ly, lw / 2 + 4, WLH, left.to_s, 2)
      c.draw_text(lx, ly, lw / 2 + 16, WLH, "/", 2)
      c.draw_text(lx, ly, lw, WLH, actor.maxep.to_s, 2)
    else
      c.draw_text(lx, ly, lw, WLH, left.to_s, 2)
    end
  end
end

class Window_MenuStatus
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    $game_party.members.each {|actor| draw_actor_data(actor) }
  end

  def draw_actor_data(actor)
    draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
    dx = 104
    dy = actor.index * 96 + WLH / 2
    draw_actor_name(actor, dx, dy)
    draw_actor_class(actor, dx + 120, dy)
    draw_actor_level(actor, dx, dy + WLH * 1)
    draw_ep_left(actor, dx + 60, dy + WLH * 1, 50)
    draw_actor_state(actor, dx, dy + WLH * 2)
    draw_actor_hp(actor, dx + 120, dy + WLH * 1)
    draw_actor_mp(actor, dx + 120, dy + WLH * 2)
  end
end

class Window_EquipMod < Window_Selectable
  def initialize(x, y, actor)
    super(x, y, 336, WLH * 4 + 32)
    self.z = 1000
    self.opacity = EkuipPoints::BATTLE_EQUIP_WIN_OPA
    self.back_opacity = EkuipPoints::BATTLE_EQUIP_WIN_BACK_OPA
    @actor = actor
    refresh
    self.index = 0
  end

  def row_max
    5
  end

  def item
    @data[@index]
  end

  def refresh
    self.contents.clear
    @data = []
    for item in @actor.equips do @data.push(item) end
    @item_max = @data.size
    self.contents.font.color = system_color
    if @actor.two_swords_style
      self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon1)
      self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::weapon2)
    else
      self.contents.draw_text(4, WLH * 0, 92, WLH, Vocab::weapon)
      self.contents.draw_text(4, WLH * 1, 92, WLH, Vocab::armor1)
    end
    self.contents.draw_text(4, WLH * 2, 92, WLH, Vocab::armor2)
    self.contents.draw_text(4, WLH * 3, 92, WLH, Vocab::armor3)
    self.contents.draw_text(4, WLH * 4, 92, WLH, Vocab::armor4)
    draw_item_name(@data[0], 92, WLH * 0)
    draw_item_name(@data[1], 92, WLH * 1)
    draw_item_name(@data[2], 92, WLH * 2)
    draw_item_name(@data[3], 92, WLH * 3)
    draw_item_name(@data[4], 92, WLH * 4)
  end

  def draw_item_name(item, rx, ry, enabled=true)
    super
    return unless item
    rect = item_rect(index)
    rect.x = rx
    rect.y = ry
    rect.width -= rx
    f = contents.font
    f.color = ep_color
    f.color.alpha = 160 unless enabled
    number = sprintf("%2d", item.ep_cost)
    contents.draw_text(rect, number, 2)
  end

  def update_help
    @help_window.set_text(item ? item.description : "")
  end
end

class Window_EquipItem
  def reset_index
    self.index = 0 if @index < 0
  end

  def enable?(item)
    @actor.enough_ep?(@equip_type, item)
  end

  def equip_type=(type)
    type = 0 if @actor.two_swords_style && type == 1
    @equip_type = type
    refresh
  end

  def draw_item(index)
    rect = item_rect(index)
    c = self.contents
    c.clear_rect(rect)
    item = @data[index]
    return unless item
    number = $game_party.item_number(item)
    enabled = enable?(item)
    rect.width -= 4
    draw_item_name(item, rect.x, rect.y, enabled)
    c.draw_text(rect, sprintf(":%2d", number), 2)
    f = c.font
    f.color = ep_color
    f.color.alpha = 160 unless enabled
    rect.x += EkuipPoints::EP_COST_X
    rect.width = 40
    number = item.ep_cost
    c.draw_text(rect, sprintf("%2d", number), 2)
  end
end

class Window_EquipStatus
  alias :kyon_ekuip_points_win_eqpstts_ref :refresh
  def refresh
    kyon_ekuip_points_win_eqpstts_ref
    draw_ep_left(@actor, 122, 0, 50)
  end
end

class Window_Status
  alias :kyon_ekuip_points_win_stts_drw_bsc_info :draw_basic_info
  def draw_basic_info(dx, dy)
    kyon_ekuip_points_win_stts_drw_bsc_info(dx, dy)
    ex, ey, ew, eh = EkuipPoints::EP_STATUS_XY_WH
    draw_ep_left(@actor, dx + ex, dy + ey, ew, eh, true)
  end
end

class Scene_Equip
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @equip_window.active = true
      @item_window.active = false
      @item_window.index = -1
      return
    elsif Input.trigger?(Input::C)
      item = @item_window.item
      pos = @equip_window.index
      if item and !@actor.enough_ep?(pos, item)
        Sound.play_buzzer
        return
      end
      Sound.play_equip
      @actor.change_equip(pos, item)
      @equip_window.active = true
      @item_window.active = false
      @item_window.index = -1
      @equip_window.refresh
      @item_windows.each {|item_window| item_window.refresh }
    end
  end
end

class Scene_Battle
  alias :kyon_ekuip_points_scn_btl_up :update
  alias :kyon_ekuip_points_scn_btl_up_act_cmdsel :update_actor_command_selection
  def create_equipment_windows
    actor = @active_battler
    if actor.block_equip_change
      Sound.play_buzzer
      return
    end
    Sound.play_decision
    wx = EkuipPoints::BATTLE_EQUIP_WIN_X
    wy = EkuipPoints::BATTLE_EQUIP_WIN_Y
    ww = Graphics.width
    wh = Graphics.height - @actor_command_window.height
    @equip_window = Window_EquipMod.new(wx, wy, actor)
    @equip_item_window = Window_EquipItem.new(0, 0, ww, wh, actor, 0)
    @equip_windows = [@equip_window, @equip_item_window]
    @actor_command_window.active = false
    @equip_index = 0
    @equip_item = true
  end

  def dispose_equipment_windows
    Sound.play_cancel
    @equip_windows.each {|window| window.dispose }
    @actor_command_window.active = true
    @equip_item = false
  end

  def update
    if @equip_item
      update_equipment
    else
      kyon_ekuip_points_scn_btl_up
    end
  end

  def update_equipment
    update_basic(true)
    update_info_viewport
    case @equip_index
    when 0
      update_equip_type
    when 1
      update_equip_list
    end
  end

  def refresh_equip_type
    @equip_item_window.equip_type = @equip_window.index
    @equip_item_window.index = 0
  end

  def update_equip_type
    @equip_window.update
    if Input.trigger?(Input::B)
      dispose_equipment_windows
      return
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      @equip_item_window.active = true
      @equip_window.active = false
      @equip_item_window.reset_index
      return @equip_index = 1
    elsif Input.trigger?(Input::DOWN)
      refresh_equip_type
      return
    elsif Input.trigger?(Input::UP)
      refresh_equip_type
    end
  end

  def back_to_main_equip
    @equip_item_window.active = false
    @equip_window.active = true
    @equip_index = 0
  end

  def update_equip_list
    @equip_item_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @equip_item_window.index = -1
      back_to_main_equip
      return
    elsif Input.trigger?(Input::C)
      pos = @equip_window.index
      item = @equip_item_window.item
      if item and !@active_battler.enough_ep?(pos, item)
        Sound.play_buzzer
        return
      end
      Sound.play_equip
      @active_battler.change_equip(pos, item)
      @equip_item_window.refresh
      @equip_window.refresh
      back_to_main_equip
    end
  end

  def update_actor_command_selection
    if Input.trigger?(Input::X)
      create_equipment_windows
      return
    end
    kyon_ekuip_points_scn_btl_up_act_cmdsel
  end
end


Terms & Conditions

Free as in Beer beer for non-commercial use.
Include me in your game credits! Grinning
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
Ekuipment Points VX - by kyonides - 9 hours ago

Possibly Related Threads…
Thread Author Replies Views Last Post
   Ekuipment's Skill Damage ACE kyonides 1 2,244 03-15-2025, 02:32 AM
Last Post: kyonides
   Victor Engine - Tech Points Victor Sant 0 5,646 03-18-2012, 05:22 AM
Last Post: Victor Sant



Users browsing this thread: 1 Guest(s)