Save-Point
KLoseEquip ACE - 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 VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: KLoseEquip ACE (/thread-8770.html)



KLoseEquip ACE - kyonides - 06-26-2023

KLoseEquip ACE

by Kyonides

Introduction

Do you want to make your heroes lose their equipment just because you're an evil game developer?
Now you can make your evil dreams come true! Shocked
You can make them lose SOME or ALL of their pieces of equipment!

The script had an entirely different name in the past, but I felt the new one is a lot more descriptive than Special Removal. Grinning

Warning!

The heroes will NEVER get their equipment back. It's gone. Like FOREVER!
OK, I lied about losing them forever because there are other calls that will keep them stored in the Game Variable of your choice!

The Script

Code:
# * KLoseEquip ACE * #
#  Scripter : Kyonides Arkanthes
#  2023-06-25

# WARNING #

# ALL of these Script Calls will cause an Irreversible Loss of Equipment!

# actor will be treated by Game_Interpreter as a local variable.
# This means that once the event finishes processing the Call Script command,
# it will no longer exist.

# Use @actor instead if you need it to exist outside the Call Script command.
# Don't forget to add a Call Script command at the end of the process to clear
# that variable by entering: @actor = nil

# * Script Calls * #

# - Step 1: Find an Actor, namely a Teammate
#  actor = $game_party.member(ActorIndex)
# OR #
#  @actor = $game_party.member(ActorIndex)

# - Step 2: Use Any of the following Calls

# - Discard Equipment By Index (SlotID)
#  actor.discard_equip_by_index(SlotID)

# - Discard Many of Them By Indexes (SlotIDs)
#  actor.discard_equip_by_indexes(SlotID1, etc.)

# - Discard Equipment By Index (SlotID) and Store it in a Game Variable
#  actor.store_discarded_equip_by_index(VarID, SlotID)

# - Discard Many of Them By Indexes (SlotIDs)
#  -> It will store them in consecutive Game Variables!
#  actor.store_discarded_equip_by_indexes(VarID, SlotID1, etc.)

class Game_Actor
  # Store Equipment ID or Name? :id or :name or :equip (the whole object)
  EQUIP_VAR_MODE = :id
  def discard_equip_by_index(index)
    this_equip = @equips[index]
    this_equip.object = nil if this_equip.object
  end

  def discard_equip_by_indexes(*slot_ids)
    slot_ids.each {|slot_id| discard_equip_by_index(slot_id) }
  end

  def equip_id_or_name(slot_id)
    equip = @equips[slot_id].object
    case EQUIP_VAR_MODE
    when :id
      equip ? equip.id : 0
    when :name
      equip ? equip.name : "?"
    when
      equip
    end
  end

  def store_discarded_equip_by_index(var_id, index)
    $game_variables[var_id] = equip_id_or_name(index)
    discard_equip_by_index(index)
  end

  def store_discarded_equip_by_indexes(var_id, *slot_ids)
    slot_ids.each do |slot_id|
      store_discarded_equip_by_index(var_id, slot_id)
      var_id += 1
    end
  end
end

class Game_Party
  def member(pos)
    $game_actors[@actors[pos]]
  end
end

Terms & Conditions

Free for use in any game. Gamer 
Due credit is mandatory.
Don't piss me off! Tongue sticking out
That's it!