Code:
#==============================================================================
# ** Individual Equipment Fix
#------------------------------------------------------------------------------
# By Syvkal
# Version 1.0
# 05-12-08
#==============================================================================
#
# This script allows you to lock any equipment on any actor individually
# The data is loaded when an actor is added to the party
# I built this in to make it easier for the user
#
# There is some configuration needed, but that comes further down the script
#
# Do not touch the next section, unless you know what you're doing
#
#
#=================================================#
# ** D O N O T T O U C H ** #
#=================================================#
module Equip_fix
$data_actors = load_data("Data/Actors.rvdata")
ACTORS_SIZE = $data_actors.size
FIX = [false, false, false, false, false]
ACTORS = []
for i in 0...ACTORS_SIZE
ACTORS.push(FIX)
end
def self.lock_equip(actor, index)
ACTORS[actor-1][index] = true
end
#=================================================#
#=================================================#
# ** C O N F I G U R A T I O N ** #
#=================================================#
#
# This is the part you can configure
#
# Simply follow the instructions to lock any of the actors equipement
#
# Use the 'lock_equip' command to lock any equipment:
#
# lock_equip(actor, equipment)
#
# The equipment is zero indexed. The values are as follow:
#
# 0 - Weapon | 3 - Body Armour
# 1 - Shield or Weapon 2 | 4 - Accessory
# 2 - Helmet
#
# So by putting:
#
# lock_equip(1, 0) - Will lock actor one's weapon
#
# Place your configurations Below
# -----------------------------
#=================================================#
end
#==============================================================================
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# Added the Individual [Fixed Equipment] Option
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :fixed_equipment
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias setup_original setup
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
@fixed_equipment = [false, false, false, false, false]
setup_original(actor_id)
end
#--------------------------------------------------------------------------
# * Get Individual Fixed Equipment Option
#--------------------------------------------------------------------------
def fixed_equipment(index)
return @fixed_equipment[index]
end
#--------------------------------------------------------------------------
# * Set Individual Fixed Equipment
#--------------------------------------------------------------------------
def equip_fix(index)
@fix = @fixed_equipment
@fix[index] = true
@fixed_equipment = @fix
return @fix[index]
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# Edited to check fixed equipment properly.
#==============================================================================
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# * Update Equip Region Selection
#--------------------------------------------------------------------------
def update_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @actor.fixed_equipment(@equip_window.index) # Changed this line
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
end
end
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Edited to automatically load settings when a member is added to the party.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
if @actors.size < MAX_MEMBERS and not @actors.include?(actor_id)
@actors.push(actor_id)
@fix = Equip_fix::ACTORS[actor_id-1]
for i in 0...@fix.size
if @fix[i]
$game_actors[actor_id].equip_fix(i)
end
end
$game_player.refresh
end
end
end