03-08-2008, 12:44 AM
(This post was last modified: 09-02-2024, 05:49 PM by DerVVulfman.)
VX Individual Equipment Fix
Version: 1.0
Version: 1.0
Introduction
I was looking though VX's Missing Features again and decided that this shouldn't be too hard to do. And it wasn't ^_^
Features
Allows you to lock any equipment on any actor individually
Screenshots
Can't really take a screenshot....
Script
"Script"
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
Instructions
Put it under the Materials Section
Further instructions can be found in the script header.
Compatibility
Compatible with most things I hope. However, this script changes 'Scene_Equip's update_equip_selection command and 'Game_Party's add_actor command. However the small piece of coding can easily be added where you need it.