Ehm... No, I can't find it anymore, but I can post it here.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ? Skill CP System - KGC_SkillCPSystem ? VX ?
#_/ ? Last Update: 2008/09/06 ?
#_/ ? Translated and Extended Updates by Mr. Anonymous ?
#_/ ? KGC Site: ?
#_/ ? http://f44.aaa.livedoor.jp/~ytomy/ ?
#_/ ? Translator's Blog: ?
#_/ ? http://mraprojects.wordpress.com ?
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ This script has two functions equipment-related functions.
#_/ The first function is the ability to create moire 'slots' for equipment,
#_/ such as separating Boots and Gauntlets from mere 'accessories'.
#_/ It is possible to also create additional equipment slots. See the customize
#_/ block for more details.
#_/
#_/ The second function is an "EP" (Equipment Point) System, which allows you
#_/ to designate how many 'points' an item costs to successfully equip. A
#_/ character's total EP expenditure is increased upon leveling up.
#_/ This introduces more strategy-oriented character customization.
#_/----------------------------------------------------------------------------
#_/ ? Instructions For Usage ?
#_/ To make use of these functions, you must insert the tag into the desired
#_/ item's "Notes" box located in the Armor tab of the database. For example,
#_/ you want the Leather Boots to be bound to the "Legs" slot and cost
#_/ 2 EP to equip. Insert <equipkind Legs>, press enter, then add <EP 2>
#_/
#_/ ? Tags ?
#_/ <equipkind EquipType>
#_/ Where EquipType = The name of the type of equipment. See EXTRA_EQUIP_KIND
#_/ below.
#_/ <EP Amount>
#_/ Where Amount = The desired amount of EP the item requires to equip.
#_/
#_/
#_/ ? Script Commands ?
#_/ These commands are used in "Script" function in the third page of event
#_/ commands under "Advanced".
#_/
#_/ * set_actor_equip_type(ActorID, [EquipType])
#_/ Allows you to manually specify an actor's equipment slots. a
#_/ Ex. set_actor_equip_type(2, [0, 2, 3, 3, 3])
#_/ If "nil"(without quotations) is appointed to EquipType, the default
#_/ EQUIP_TYPE (see below) is used. Trust me, it's useful!
#_/
#_/ * change_actor_equipment(ActorID, equipslot_index, ItemID)
#_/ Allows you to change the equipment of a specified actor.
#_/ equipslot_index works by finding the equipment slot number, which is
#_/ different from EQUIP_TYPE. Setting ItemID to 0 will remove the item.
#_/ With the default setup, we see:
#_/ 0=Weapon 1=Shield 2=Headgear 3=Armor 4=Accessory 5=Legs 6=Arms
#_/
#_/ So, for an example:
#_/ change_actor_equipment(1, 3, 15)
#_/ Would change Ralph's(Actor01 in the database) armor to Chainmail(By default)
#_/
#_/
#_/============================================================================
#_/ Installation: This script must be inserted below KCG_ExtendedEquipScene
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#=============================================================================#
# ? Customization ? #
#=============================================================================#
module KGC
module EquipExtension
# ? Extended Equipment Classification Names ?
# You may designate the names of additional equipment slots here.
# Each time you designate a new equipment slot, it is assigned a number.
# The first four equipment types (Shield, Helmet, Armor, and Accessory) are
# given as 1, 2, 3, 4, respectively. Then the values below are assigned in
# order. By default "Legs" and "Arms" would be 4 and 5. It is possible
# to add additional slots.
# Example: EXTRA_EQUIP_KIND = ["Legs", "Arms", "Skill Book"]
EXTRA_EQUIP_KIND = ["Legs", "Ammunition"]
# ? Equipment Placement ?
# This allows you to arrange the equip slots as you see fit on the equipment
# menu. Note the order listed below.
# ** Equipment Classification Summary **
# 0.Shield 1.Headgear 2.Armor 3.Accessory 4. "Legs" 5."Arms"
# Note that these can be changed as desired. By default, we've enabled two
# accessory slots at the end, instead of one. If you plan on adding extra
# equip slots, the category's cooresponding number must be inserted in the
# brackets [] below.
EQUIP_TYPE = [0, 1, 2, 4, 3, 3]
end
end
#=============================================================================#
# ? End Customization ? #
#=============================================================================#
#=================================================#
# IMPORT #
#=================================================#
$imported = {} if $imported == nil
$imported["EquipExtension"] = true
#=================================================#
module KGC::EquipExtension
# Unless the EP system is used...
#==============================================================================
# ? KGC::EquipExtension::Regexp
#==============================================================================
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Note Field Tag Strings #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Whatever word(s) are after the separator ( | ) in the following lines are
# what are used to determine what is searched for in the "Note" section of
# an item or armor.
# Regular expressions defined
module Regexp
# Base Item Module
module BaseItem
# Item Type Tag String
# Special note: I cannot get this tag to work right. If anyone knows how
# this works or if it's bugged, please let me know.
EQUIP_TYPE = /<(?:EQUIP_TYPE|equiptype)\s*(\d+(?:\s*,\s*\d+)*)>/
end
# Base Armor Module
module Armor
# Armor Type Tag String
EQUIP_KIND = /<(?:EQUIP_KIND|equipkind)\s*(.+)>/i
end
end
end
#=================================================#
#==============================================================================
# ? KGC::Commands
#==============================================================================
module KGC
module Commands
module_function
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def restore_equip
(1...$data_actors.size).each { |i|
actor = $game_actors[i]
actor.restore_equip
}
end
#--------------------------------------------------------------------------
# ? ?????????????
# actor_id : ???? ID
# equip_type : ?????
#--------------------------------------------------------------------------
def set_actor_equip_type(actor_id, equip_type = nil)
actor = $game_actors[actor_id]
return if actor == nil
actor.equip_type = equip_type
end
#--------------------------------------------------------------------------
# ? ??????????
# actor_id : ???? ID
# index : ???? (0?)
# item_id : ?? or ?? ID (0 ???)
#--------------------------------------------------------------------------
def change_actor_equipment(actor_id, index, item_id)
actor = $game_actors[actor_id]
return if actor == nil
actor.change_equip_by_id(index, item_id)
end
end
end
class Game_Interpreter
include KGC::Commands
end
#=================================================#
#==============================================================================
# ? Vocab
#==============================================================================
module Vocab
# ?????
def self.extra_armor(index)
return KGC::EquipExtension::EXTRA_EQUIP_KIND[index]
end
end
#=================================================#
#==============================================================================
# ? RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def create_equip_extension_cache
@__equip_type = []
self.note.split(/[\r\n]+/).each { |line|
case line
when KGC::EquipExtension::Regexp::BaseItem::EQUIP_TYPE
# ?????
@__equip_type = []
$1.scan(/\d+/) { |num|
@__equip_type << num.to_i
}
end
}
# EP ???????????? EP = 0
end
#--------------------------------------------------------------------------
# ? ?? EP
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def equip_type
create_equip_extension_cache if @__equip_type == nil
return @__equip_type
end
end
#=================================================#
#==============================================================================
# ? RPG::Armor
#==============================================================================
class RPG::Armor < RPG::BaseItem
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def create_equip_extension_cache
super
@__kind = -1
self.note.split(/[\r\n]+/).each { |line|
if line =~ KGC::EquipExtension::Regexp::Armor::EQUIP_KIND
# ????
e_index = KGC::EquipExtension::EXTRA_EQUIP_KIND.index($1)
next if e_index == nil
@__kind = e_index + 4
end
}
end
unless $@
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
alias kind_KGC_EquipExtension kind
def kind
create_equip_extension_cache if @__kind == nil
return (@__kind == -1 ? kind_KGC_EquipExtension : @__kind)
end
end
end
#=================================================#
#==============================================================================
# ? Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_writer :equip_type # ?????
#--------------------------------------------------------------------------
# ? ??????
# actor_id : ???? ID
#--------------------------------------------------------------------------
alias setup_KGC_EquipExtension setup
def setup(actor_id)
actor = $data_actors[actor_id]
@extra_armor_id = []
setup_KGC_EquipExtension(actor_id)
restore_equip
end
#--------------------------------------------------------------------------
# ? MaxEP ??
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ? EP ??
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ? EP ????
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def equip_type
if @equip_type.is_a?(Array)
return @equip_type
else
return KGC::EquipExtension::EQUIP_TYPE
end
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def armor_number
return equip_type.size
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def extra_armor_number
return [armor_number - 4, 0].max
end
#--------------------------------------------------------------------------
# ? ?? ID ??????
#--------------------------------------------------------------------------
def extra_armor_id
@extra_armor_id = [] if @extra_armor_id == nil
return @extra_armor_id
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
alias armors_KGC_EquipExtension armors
def armors
result = armors_KGC_EquipExtension
# ???????????
extra_armor_number.times { |i|
armor_id = extra_armor_id[i]
result << (armor_id == nil ? nil : $data_armors[armor_id])
}
return result
end
#--------------------------------------------------------------------------
# ? ????? (?????????)
# equip_type : ????
# item : ?? or ?? (nil ??????)
# test : ?????? (???????????????????)
#--------------------------------------------------------------------------
alias change_equip_KGC_EquipExtension change_equip
def change_equip(equip_type, item, test = false)
change_equip_KGC_EquipExtension(equip_type, item, test)
# ????????????
if extra_armor_number > 0
item_id = item == nil ? 0 : item.id
case equip_type
when 5..armor_number # ?????
@extra_armor_id = [] if @extra_armor_id == nil
@extra_armor_id[equip_type - 5] = item_id
end
end
restore_battle_skill if $imported["SkillCPSystem"]
restore_passive_rev if $imported["PassiveSkill"]
end
#--------------------------------------------------------------------------
# ? ?????
# item : ?????? or ??
# ??????????????????????????
#--------------------------------------------------------------------------
alias discard_equip_KGC_EquipExtension discard_equip
def discard_equip(item)
last_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
discard_equip_KGC_EquipExtension(item)
curr_armors = [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
return unless item.is_a?(RPG::Armor) # ?????
return if last_armors != curr_armors # ???????
# ????????
extra_armor_number.times { |i|
if extra_armor_id[i] == item.id
@extra_armor_id[i] = 0
break
end
}
restore_battle_skill if $imported["SkillCPSystem"]
restore_passive_rev if $imported["PassiveSkill"]
end
#--------------------------------------------------------------------------
# ? ?? ID ???
# class_id : ????? ID
#--------------------------------------------------------------------------
alias class_id_equal_KGC_EquipExtension class_id=
def class_id=(class_id)
class_id_equal_KGC_EquipExtension(class_id)
return if extra_armor_number == 0 # ????????
# ?????????????
for i in 5..armor_number
change_equip(i, nil) unless equippable?(equips[i])
end
end
#--------------------------------------------------------------------------
# ? EP ???????
# equip_type : ????
# item : ?? or ??
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def restore_equip
return if @__last_equip_type == equip_type
# ???????????????
last_equips = equips
last_hp = self.hp
last_mp = self.mp
if $imported["SkillCPSystem"]
last_battle_skill_ids = battle_skill_ids.clone
end
# ?????
last_equips.each_index { |i| change_equip(i, nil) }
# ????????????
last_equips.compact.each { |item| equip_legal_slot(item) }
self.hp = last_hp
self.mp = last_mp
if $imported["SkillCPSystem"]
last_battle_skill_ids.each_with_index { |s, i| set_battle_skill(i, s) }
end
@__last_equip_type = equip_type.clone
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ? ?????????????
# item : ?? or ??
#--------------------------------------------------------------------------
def equip_legal_slot(item)
if item.is_a?(RPG::Weapon)
if @weapon_id == 0
# ?? 1
change_equip(0, item)
elsif two_swords_style && @armor1_id == 0
# ?? 2 (??????)
change_equip(1, item)
end
elsif item.is_a?(RPG::Armor)
if !two_swords_style && item.kind == equip_type[0] && @armor1_id == 0
# ????? (????????)
change_equip(1, item)
else
# ??????????
list = [-1, @armor2_id, @armor3_id, @armor4_id]
list += extra_armor_id
# ?????????????????
equip_type.each_with_index { |kind, i|
if kind == item.kind && list[i] == 0
change_equip(i + 1, item)
break
end
}
end
end
end
end
#=================================================#
#==============================================================================
# ? Window_Base
#==============================================================================
#=================================================#
#==============================================================================
# ? Window_Equip
#==============================================================================
class Window_Equip < Window_Selectable
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = @actor.equips.clone
@item_max = [@data.size, @actor.armor_number + 1].min
create_contents
# ???????
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)
name = armor_slot_name(@actor.equip_type[0])
self.contents.draw_text(4, WLH * 1, 92, WLH, name)
end
for i in 1...@actor.armor_number
name = armor_slot_name(@actor.equip_type[i])
self.contents.draw_text(4, WLH * (i + 1), 92, WLH, name)
end
# ??????
rect = Rect.new(92, 0, self.width - 128, WLH)
@item_max.times { |i|
rect.y = WLH * i
draw_item_name(@data[i], rect.x, rect.y)
}
end
#--------------------------------------------------------------------------
# ? ?????????
# kind : ??
#--------------------------------------------------------------------------
def armor_slot_name(kind)
case kind
when 0..3
return eval("Vocab.armor#{kind + 1}")
else
return Vocab.extra_armor(kind - 4)
end
end
unless $imported["ExtendedEquipScene"]
#--------------------------------------------------------------------------
# ? ????? 1 ????????
#--------------------------------------------------------------------------
def cursor_pagedown
return if Input.repeat?(Input::R)
super
end
#--------------------------------------------------------------------------
# ? ????? 1 ???????
#--------------------------------------------------------------------------
def cursor_pageup
return if Input.repeat?(Input::L)
super
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
return unless self.active
if Input.repeat?(Input::RIGHT)
cursor_pagedown
elsif Input.repeat?(Input::LEFT)
cursor_pageup
end
end
end
end
#=================================================#
#==============================================================================
# ? Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Item
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
@item_enabled = []
super
@data.each { |item| @item_enabled << enable?(item) }
end
#--------------------------------------------------------------------------
# ? ????????????????
# item : ????
#--------------------------------------------------------------------------
def include?(item)
return true if item == nil
if @equip_type == 0
return false unless item.is_a?(RPG::Weapon)
else
return false unless item.is_a?(RPG::Armor)
return false unless item.kind == @equip_type - 1
end
return @actor.equippable?(item)
end
#--------------------------------------------------------------------------
# ? ??????????????????
# item : ????
#--------------------------------------------------------------------------
def enable?(item)
return false unless @actor.equippable?(item) # ????
return true
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
super(index)
rect = item_rect(index)
item = @data[index]
# ??????????
cw = self.contents.text_size(sprintf(":%2d", 0)).width
rect.width -= cw + 4
end
#--------------------------------------------------------------------------
# ? ????????
# equip_type : ????
#--------------------------------------------------------------------------
def simple_refresh(equip_type)
# ???????????
last_equip_type = @equip_type
@equip_type = equip_type
@data.each_with_index { |item, i|
# ????????????????
if enable?(item) != @item_enabled[i]
draw_item(i)
@item_enabled[i] = enable?(item)
end
}
# ???????
@equip_type = last_equip_type
end
end
#=================================================#
#==============================================================================
# ? Window_EquipStatus
#==============================================================================
class Window_EquipStatus < Window_Base
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
alias refresh_KGC_EquipExtension refresh
def refresh
refresh_KGC_EquipExtension
end
end
#=================================================#
#==============================================================================
# ? Window_Status
#==============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# ? ??????
# x : ??? X ??
# y : ??? Y ??
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
item_number = [@actor.equips.size, @actor.armor_number + 1].min
item_number.times { |i|
draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))
}
end
end
#=================================================#
#==============================================================================
# ? Window_ShopStatus
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ? ?????????????????
# actor : ????
# x : ??? X ??
# y : ??? Y ??
#--------------------------------------------------------------------------
def draw_actor_parameter_change(actor, x, y)
return if @item.is_a?(RPG::Item)
enabled = actor.equippable?(@item)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x, y, 200, WLH, actor.name)
if @item.is_a?(RPG::Weapon)
item1 = weaker_weapon(actor)
elsif actor.two_swords_style and @item.kind == 0
item1 = nil
else
index = actor.equip_type.index(@item.kind)
item1 = (index != nil ? actor.equips[1 + index] : nil)
end
if enabled
if @item.is_a?(RPG::Weapon)
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
change = atk2 - atk1
else
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
change = def2 - def1
end
self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2)
end
draw_item_name(item1, x, y + WLH, enabled)
end
end
#=================================================#
#==============================================================================
# ? Scene_Equip
#==============================================================================
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
EQUIP_TYPE_MAX = KGC::EquipExtension::EXTRA_EQUIP_KIND.size + 5
#--------------------------------------------------------------------------
# ? ?????????
# actor_index : ??????????
# equip_index : ????????
#--------------------------------------------------------------------------
alias initialize_KGC_EquipExtension initialize
def initialize(actor_index = 0, equip_index = 0)
initialize_KGC_EquipExtension(actor_index, equip_index)
unit = ($imported["LargeParty"] ?
$game_party.all_members : $game_party.members)
actor = unit[actor_index]
@equip_index = [@equip_index, actor.armor_number].min
end
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
alias create_item_windows_KGC_EquipExtension create_item_windows
def create_item_windows
create_item_windows_KGC_EquipExtension
kind = equip_kind(@equip_index)
EQUIP_TYPE_MAX.times { |i|
@item_windows[i].visible = (kind == i)
}
end
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
def update_item_windows
kind = equip_kind(@equip_window.index)
for i in 0...EQUIP_TYPE_MAX
@item_windows[i].visible = (kind == i)
@item_windows[i].update
end
@item_window = @item_windows[kind]
@item_window.simple_refresh(@equip_window.index)
end
#--------------------------------------------------------------------------
# ? ?????????
# index : ?????????
#--------------------------------------------------------------------------
def equip_kind(index)
if index == 0
return 0
else
return @actor.equip_type[index - 1] + 1
end
end
unless $imported["ExtendedEquipScene"]
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil)
elsif @item_window.active
temp_actor = Marshal.load(Marshal.dump(@actor))
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
end
@status_window.update
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias update_item_selection_KGC_EquipExtension update_item_selection
def update_item_selection
if Input.trigger?(Input::C)
# ????????
index = @equip_window.index
item = @item_window.item
unless item == nil ||
(@actor.equippable?(item))
Sound.play_buzzer
return
end
end
update_item_selection_KGC_EquipExtension
end
end
#=================================================#
#==============================================================================
# ? Scene_File
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ? ???????????
# file : ??????????????? (??????)
#--------------------------------------------------------------------------
alias read_save_data_KGC_EquipExtension read_save_data
def read_save_data(file)
read_save_data_KGC_EquipExtension(file)
KGC::Commands.restore_equip
Graphics.frame_reset
end
end