Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Can anyone take a look at this script and see if they can fix it?

Status
Not open for further replies.
When you try to change a modified weapons name (with Z) the game crashes with this error:

Script 'KGC - Equipment Modification' line 1654: NoMethodError occurred.

undefined method 'name=' for nil:NilClass

Can some help me out?

Credit goes to twilight and KGC

Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ â—† Equipmen Alteration - KGC_AlterEquipment â—†
#_/----------------------------------------------------------------------------
#_/ Alters the equipment and gives added effects or increases parameters in specified areas
# Call Script: call_equip_alter
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

$data_states = load_data("Data/States.rxdata") if $data_states == nil

#================================================= =============================
# ★ カスタマイズ項目 ★
#================================================= =============================

module KGC
# â—†The Maximum number of Weapons that can be altered
# More than 300 can possibly cause errors so be careful.
AEQ_WEAPON_MAX = 50
# â—†Maximum number of aloud Armors that can be altered
AEQ_ARMOR_MAX = 50
# â—†Add a number suffix to the altered item
# If true it will add a +1, +2 to the equipment to show how many times it has been altered
AEQ_SHOW_ALTER_COUNT = false
# â—†Prescribed form of frequency of remodelling
# <{n}?Frequency of remodelling>
AEQ_ALTER_COUNT_FORMAT = "+{n}"

# â—†Actor ID used for renaming equipment
AEQ_RENAME_ACTOR_ID = 13
# â—†The maximum number of letters of equipment name (MAX: 16)
AEQ_RENAME_MAX_LENGTH = 16
# â—†The button which moves to the equipment name modification picture
# (A, X, recommending Y and Z. When it makes nil, there is no equipment name modification function)
AEQ_RENAME_BUTTON = Input::A

# â—†Alteration Max
# How many times the selected item can be altered
# When its set to a negative number then the item has a limitless alteration count
AEQ_ALTERABLE_COUNT = 3 # Setting this to 10 would limit it to only being altered 10 times.
# I would set it to a low number so as to prevent creating a overpowered weapon.
# â—†Exclusion equipment type
# Equipment ID's that cannot be altered
AEQ_EXCLUDE_EQUIP_TYPE = []
# â—†Exclusion weapon
# Insert the Weapon ID's for special weapons that cannot be altered (Such as a Ultima Weapon)
AEQ_EXCLUDE_WEAPONS = []
# â—†Exclusion guard
# Insert the Weapon ID's for special armos that cannot be altered (Such as the Genji Armor)
AEQ_EXCLUDE_ARMORS = []

# â—†Weapon factor summary
# "Alteration Name", "Information", [[Type, ID],... ], Default Cost, [Item ID, Amount], ...]
# I am not sure why the Fire is in the parenthesis, I just left it their in case it might cause an
# error if removed
# Type: 0 = Attribute Add on (IE. Fire Strike),
# Type: 1 = Status Infliction (IE. Poison Touch)
# Type: 2 = Status Removal, The skill removes a state from the target (IE.Poison Eater),
# Type: 3 = Power Increase (IE. Intelligence + 20)
#
# ID: The ID used when the Attribute or Status is Added. [Note uses the status menu to calculate the
# Increase in power. (IE. Intelligence + 20 for Status ID 25 which is Intel 20] power increase
# for the weapon/armor)]
#
# Alteration Cost: The ratio used to calculate the price of the weapon
#
# The Item ID's and amount that is required to perform the necessary modifications.
#
# Code
# ["[Effect] Strike", "Description", [[Type, ID]], Base Cost, [Item ID, Amount]],
AEQ_WEAPON_FACTORS = [
# Elemental Strikes
["[Fire] Strike", "Imbues weapon with the Fire Element.", [[0, 1]], 10, [13, 1]],
# Status Strikes
["[Poison] Touch", "Adds a venomous effect to your weapon.", [[1, 3]], 20, [10, 1], [13, 1]],
# Status Removals
["[Poison] Eater", "Removes the Poisoned State.", [[2, 3]], 10, [13, 1]],
# Weapon Increase
["[Mind] Boost", "Increase intelligence by 10", [[3, 27]], 10, [13, 1]],
["[Attack] Boost", "Increase Atk by 10", [[3, 28]], 10, [13, 1]],
] # ←DO NOT REMOVE
# â—†Armor Alteration
# ["Name", "Description", [[Type, ID], ...], Base Cost, [Item ID, Amount], ...]
# [Types] 0 = Element Protection, 1= Status Protection 3 = Parameter Increase
# ID = Same as weapons, choose the ID to add on to the selected armor
# Base Cost = The initial cost of the modification
AEQ_ARMOR_FACTORS = [
# Elemental Guard
["[Fire] Guard", "Reduces damage from Fire Base Attacks.", [[0, 1]], 10, [13, 1]],
# Status Guard
["[Poison] Guard", "Defends against poison", [[1, 3]], 20, [10, 1], [13, 1]],
# Parameter Boost
["[Attack] Boost", "Increase Atk by 10", [[3, 28]], 10, [13, 1]]
# Because (it is difficult, just this)
] # ←Do Not Remove
# â—†This is basically the formula for calculating the cost of the upgrade to a weapon
AEQ_WEAPON_PRICE_FORMULA =
"(atk + pdef + mdef + (str_p + dex_p + agi_p + int_p).abs) * 30"
# â—† Same as above but for armors
AEQ_ARMOR_PRICE_FORMULA =
"(pdef + mdef + (eva + str_p + dex_p + agi_p + int_p).abs) * 30"

# â—†Background
AEQ_BACK_TRANSPARENT = false

# â—†?Weapon remodelling? name
AEQ_COMMAND_WEAPON_ALTER = "Modify Weapon"
# â—†?Remodelling equipment cancellation? name
AEQ_COMMAND_WEAPON_DISPOSE = "Destroy Weapon"
# â—†?Guard remodelling? name
AEQ_COMMAND_ARMOR_ALTER = "Modify Armor"
# â—†?Remodelling guard cancellation? name
AEQ_COMMAND_ARMOR_DISPOSE = "Destroy Armor"
# Yes if you want to free up space, you must destroy an item

# â—†?Weapon remodelling? help
AEQ_HELP_WEAPON_ALTER = "What weapon do you want to modify?"
# ◆「改造装備破棄」ヘルプ
AEQ_HELP_WEAPON_DISPOSE = "What weapon do you want to destroy? (You won't get it back if you do)"
# ◆「防具改造」ヘルプ
AEQ_HELP_ARMOR_ALTER = "What armor do you want to modify"
# ◆「改造防具破棄」ヘルプ
AEQ_HELP_ARMOR_DISPOSE = "What armor do you want to destroy? (You won't get it back if you do)"

# ◆改造武器リスト空欄の表示文字列
AEQ_TEXT_NO_WEAPON = "- Open Slot -"
# ◆改造防具リスト空欄の表示文字列
AEQ_TEXT_NO_ARMOR = "- Open Slot -"

# â—†This defines the range of your elements
# ([Integer][Range]クラスの配列)
AEQ_ELEMENT_RANGE = [1..8]
# â—†This defines the range of your status
# (指定方法は AEQ_ELEMENT_RANGE と同様)
AEQ_STATE_RANGE = [1...$data_states.size]

# ◆武器改造確認コマンド
AEQ_ALTER_COMMAND = ["Modify", "Cancel"]
# ◆武器破棄確認コマンド
AEQ_DISPOSE_COMMAND = ["Destroy", "Cancel"]
# ◆ファクター付加確認コマンド
AEQ_FACTOR_COMMAND = ["Add", "Cancel"]
# ※↑3項目は、コマンド数を変更するとバグります。
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["AlterEquipment"] = true

#--------------------------------------------------------------------------
# ● 装備品改造画面呼び出し
#--------------------------------------------------------------------------
def call_equip_alter
# プレイヤーの姿勢を矯正
$game_player.straighten
# 装備品改造画面に切り替え
$scene = Scene_AlterEquipment.new
end

module AlteredEquipment
#--------------------------------------------------------------------------
# ● 改造武器破棄
# index : 改造武器番号 (1~AEQ_WEAPON_MAX)
#--------------------------------------------------------------------------
def self.dispose_weapon(index)
# 破棄できない場合は戻る
if index < 1 || index > KGC::AEQ_WEAPON_MAX ||
$game_party.alter_weapons[index - 1] == nil
return
end
# 指定武器を破棄
id = $game_party.alter_weapons[index - 1].id
$game_party.alter_weapons[index - 1] = nil
$data_weapons[id] = RPG::Weapon2.new
$game_party.lose_weapon(id, 99)
end
#--------------------------------------------------------------------------
# ● 改造防具破棄
# index : 改造防具番号 (1~AEQ_ARMOR_MAX)
#--------------------------------------------------------------------------
def self.dispose_armor(index)
# 破棄できない場合は戻る
if index < 1 || index > KGC::AEQ_ARMOR_MAX ||
$game_party.alter_armors[index - 1] == nil
return
end
# 指定防具を破棄
id = $game_party.alter_armors[index - 1].id
$game_party.alter_armors[index - 1] = nil
$data_armors[id] = RPG::Armor2.new
$game_party.lose_armor(id, 99)
end
#--------------------------------------------------------------------------
# ● 指定IDの武器と、それを改造した武器をすべて破棄
# id : 武器ID
#--------------------------------------------------------------------------
def self.dispose_all_weapon(id)
weapons = $game_party.alter_weapons.find_all { |w|
w != nil && w.original_id == id
}
weapons.each { |w|
index = $game_party.alter_weapons.index(w) + 1
dispose_weapon(index)
}
$game_party.lose_weapon(id, 99)
end
#--------------------------------------------------------------------------
# ● 指定IDの防具と、それを改造した防具をすべて破棄
# id : 防具ID
#--------------------------------------------------------------------------
def self.dispose_all_armor(id)
armors = $game_party.alter_armors.find_all { |a|
a != nil && a.original_id == id
}
armors.each { |a|
index = $game_party.alter_armors.index(a) + 1
dispose_armor(index)
}
$game_party.lose_armor(id, 99)
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# ■ 武器・防具 共用モジュール
#================================================= =============================

module KGC_AlterEquipment_WA
#--------------------------------------------------------------------------
# ● オリジナル名取得
#--------------------------------------------------------------------------
def original_name
return @name
end
#--------------------------------------------------------------------------
# ● 改造可能回数取得
#--------------------------------------------------------------------------
def alterable_count
return original_name =~ /\[ALT[ ]*(\d+)\]/i ? $1.to_i : KGC::AEQ_ALTERABLE_COUNT
end
end

module KGC_AlterEquipment_WA2
attr_writer :change_name
#--------------------------------------------------------------------------
# ● 改造回数を除去した名称取得
#--------------------------------------------------------------------------
def plain_name
if KGC::AEQ_SHOW_ALTER_COUNT
rg = (KGC::AEQ_ALTER_COUNT_FORMAT.gsub(/(.*){n}/i) {
"[#{$1}]{#{$1.scan(/./).size}}\\d+"
}).gsub(/\-/) {"\-"}
return name.gsub(%r(#{rg}$)i) {""}
else
return name
end
end
#--------------------------------------------------------------------------
# ● 残り改造可能回数取得
#--------------------------------------------------------------------------
def alterable_count
return (@name =~ /\[ALT[ ]*(\d+)\]/i ? $1.to_i : KGC::AEQ_ALTERABLE_COUNT) - @alter_count
end
#--------------------------------------------------------------------------
# ● オリジナルID取得
#--------------------------------------------------------------------------
def original_id
return @original_id
end
#--------------------------------------------------------------------------
# ● 改造回数取得
#--------------------------------------------------------------------------
def alter_count
@alter_count = 0 if @alter_count == nil
return @alter_count
end
#--------------------------------------------------------------------------
# ● 改造回数加算
#--------------------------------------------------------------------------
def add_alter_count
@alter_count = 0 if @alter_count == nil
@alter_count += 1
self.show_alter_count
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  RPG::Weapon
#================================================= =============================

class RPG::Weapon
include KGC_AlterEquipment_WA
#--------------------------------------------------------------------------
# ● 名称取得
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  RPG::Armor
#================================================= =============================

class RPG::Armor
include KGC_AlterEquipment_WA
#--------------------------------------------------------------------------
# ● 名称取得
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  RPG::Weapon2
#================================================= =============================

class RPG::Weapon2 < RPG::Weapon
include KGC_AlterEquipment_WA2
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
@original_id = 0
@original_price = 0
@alter_count = 0
end
#--------------------------------------------------------------------------
# ● 名称取得
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# ● 改造費用算出
#--------------------------------------------------------------------------
def alter_cost(factor)
if @original_price == 0
formula = KGC::AEQ_WEAPON_PRICE_FORMULA.dup
formula.gsub!(/atk/i) {"@atk"}
formula.gsub!(/pdef/i) {"@pdef"}
formula.gsub!(/mdef/i) {"@mdef"}
formula.gsub!(/str_p/i) {"@str_plus"}
formula.gsub!(/dex_p/i) {"@dex_plus"}
formula.gsub!(/agi_p/i) {"@agi_plus"}
formula.gsub!(/int_p/i) {"@int_plus"}
cost = eval(formula)
else
cost = @original_price
end
cost = cost * factor[3] / 100
return Integer(cost)
end
#--------------------------------------------------------------------------
# ● ファクター付加可否
#--------------------------------------------------------------------------
def can_add_factor?(factor)
# 価格判定
if $game_party.gold < self.alter_cost(factor)
return false
end
# アイテム所持判定
(4...factor.size).each { |i|
if $game_party.item_number(factor[i][0]) < factor[i][1]
return false
end
}
(0...factor[2].size).each { |i|
# 付加済み判定
case factor[2][i][0]
when 0 # 属性
if @element_set.include?(factor[2][i][1])
return false
end
when 1 # ステート付加
if @plus_state_set.include?(factor[2][i][1])
return false
end
when 2 # ステート解除
if @minus_state_set.include?(factor[2][i][1])
return false
end
end
}
return true
end
#--------------------------------------------------------------------------
# ● ファクター付加
#--------------------------------------------------------------------------
def add_factor(factor)
(0...factor[2].size).each { |i|
# ファクターを付加
case factor[2][i][0]
when 0 # 属性
@element_set.push(factor[2][i][1])
@element_set.sort!
when 1 # ステート付加
@plus_state_set.push(factor[2][i][1])
@plus_state_set.sort!
when 2 # ステート解除
@minus_state_set.push(factor[2][i][1])
@minus_state_set.sort!
when 3 # 能力値
return if (state = $data_states[factor[2][i][1]]) == nil
if state.original_name =~ /\[EQAL[ ]*(?:%|ï¼…)\]/i
@atk += @atk * state.atk_rate / 100
@pdef += @pdef * state.pdef_rate / 100
@mdef += @mdef * state.mdef_rate / 100
@str_plus += @str_plus * state.str_rate / 100
@dex_plus += @dex_plus * state.dex_rate / 100
@agi_plus += @agi_plus * state.agi_rate / 100
@int_plus += @int_plus * state.int_rate / 100
else
@atk += state.atk_rate
@pdef += state.pdef_rate
@mdef += state.mdef_rate
@str_plus += state.str_rate
@dex_plus += state.dex_rate
@agi_plus += state.agi_rate
@int_plus += state.int_rate
end
end
}
# 金消費
$game_party.lose_gold(self.alter_cost(factor))
# アイテム消費
(4...factor.size).each { |i|
$game_party.lose_item(factor[i][0], factor[i][1])
}
# 改造回数加算
self.add_alter_count
end
#--------------------------------------------------------------------------
# ● 武器情報をコピー
#--------------------------------------------------------------------------
def copy_weapon(id)
weapon = $data_weapons[id]
@original_id = id
@change_name = nil
self.show_alter_count
@icon_name = weapon.icon_name.dup
@description = weapon.description.dup
@animation1_id = weapon.animation1_id
@animation2_id = weapon.animation2_id
@price = 0
@original_price = weapon.price
@atk = weapon.atk
@pdef = weapon.pdef
@mdef = weapon.mdef
@str_plus = weapon.str_plus
@dex_plus = weapon.dex_plus
@agi_plus = weapon.agi_plus
@int_plus = weapon.int_plus
@element_set = weapon.element_set.dup
@plus_state_set = weapon.plus_state_set.dup
@minus_state_set = weapon.minus_state_set.dup
# 装備可能者を設定
(1...$data_classes.size).each { |i|
actor_class = $data_classes[i]
# 改造対象の武器を装備できるクラスの場合
if actor_class.weapon_set.include?(id)
# 装備可能武器に追加
actor_class.weapon_set.push(@id)
else
# 装備できない場合は装備可能武器から削除
actor_class.weapon_set.delete(@id)
end
}
end
#--------------------------------------------------------------------------
# ● 改造回数表示
#--------------------------------------------------------------------------
def show_alter_count
@name = (@change_name != nil ? @change_name :
$data_weapons[@original_id].original_name).dup
if KGC::AEQ_SHOW_ALTER_COUNT
@name += KGC::AEQ_ALTER_COUNT_FORMAT.gsub(/{n}/i) {"#{@alter_count}"}
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  RPG::Armor2
#================================================= =============================

class RPG::Armor2 < RPG::Armor
include KGC_AlterEquipment_WA2
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super
@original_id = 0
@original_price = 0
@alter_count = 0
end
#--------------------------------------------------------------------------
# ● 名称取得
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# ● 改造費用算出
#--------------------------------------------------------------------------
def alter_cost(factor)
if @original_price == 0
formula = KGC::AEQ_ARMOR_PRICE_FORMULA.dup
formula.gsub!(/pdef/i) {"@pdef"}
formula.gsub!(/mdef/i) {"@mdef"}
formula.gsub!(/eva/i) {"@eva"}
formula.gsub!(/str_p/i) {"@str_plus"}
formula.gsub!(/dex_p/i) {"@dex_plus"}
formula.gsub!(/agi_p/i) {"@agi_plus"}
formula.gsub!(/int_p/i) {"@int_plus"}
cost = eval(formula)
else
cost = @original_price
end
cost = cost * factor[3] / 100
return Integer(cost)
end
#--------------------------------------------------------------------------
# ● ファクター付加可否
#--------------------------------------------------------------------------
def can_add_factor?(factor)
# 価格判定
if $game_party.gold < self.alter_cost(factor)
return false
end
# アイテム所持判定
(4...factor.size).each { |i|
if $game_party.item_number(factor[i][0]) < factor[i][1]
return false
end
}
(0...factor[2].size).each { |i|
# 付加済み判定
case factor[2][i][0]
when 0 # 防御属性
if @guard_element_set.include?(factor[2][i][1])
return false
end
when 1 # 防御ステート
if @guard_state_set.include?(factor[2][i][1])
return false
end
end
}
return true
end
#--------------------------------------------------------------------------
# ● ファクター付加
#--------------------------------------------------------------------------
def add_factor(factor)
# 金消費
$game_party.lose_gold(self.alter_cost(factor))
# アイテム消費
(4...factor.size).each { |i|
$game_party.lose_item(factor[i][0], factor[i][1])
}
(0...factor[2].size).each { |i|
# ファクターを付加
case factor[2][i][0]
when 0 # 防御属性
@guard_element_set.push(factor[2][i][1])
@guard_element_set.sort!
when 1 # 防御ステート
@guard_state_set.push(factor[2][i][1])
@guard_state_set.sort!
when 2 # 能力値
return if (state = $data_states[factor[2][i][1]]) == nil
if state.original_name =~ /\[EQAL[ ]*(?:%|ï¼…)\]/i
@pdef += @pdef * state.pdef_rate / 100
@mdef += @mdef * state.mdef_rate / 100
@eva += @eva * state.eva / 100
@str_plus += @str_plus * state.str_rate / 100
@dex_plus += @dex_plus * state.dex_rate / 100
@agi_plus += @agi_plus * state.agi_rate / 100
@int_plus += @int_plus * state.int_rate / 100
else
@pdef += state.pdef_rate
@mdef += state.mdef_rate
@eva += state.eva
@str_plus += state.str_rate
@dex_plus += state.dex_rate
@agi_plus += state.agi_rate
@int_plus += state.int_rate
end
end
}
# 改造回数加算
self.add_alter_count
end
#--------------------------------------------------------------------------
# ● 防具情報をコピー
#--------------------------------------------------------------------------
def copy_armor(id)
armor = $data_armors[id]
@original_id = id
@change_name = nil
self.show_alter_count
@icon_name = armor.icon_name.dup
@description = armor.description.dup
@kind = armor.kind
@auto_state_id = armor.auto_state_id
@price = 0
@original_price = armor.price
@pdef = armor.pdef
@mdef = armor.mdef
@eva = armor.eva
@str_plus = armor.str_plus
@dex_plus = armor.dex_plus
@agi_plus = armor.agi_plus
@int_plus = armor.int_plus
@guard_element_set = armor.guard_element_set.dup
@guard_state_set = armor.guard_state_set.dup
# 装備可能者を設定
(1...$data_classes.size).each { |i|
actor_class = $data_classes[i]
# 改造対象の武器を装備できるクラスの場合
if actor_class.armor_set.include?(id)
# 装備可能武器に追加
actor_class.armor_set.push(@id)
else
# 装備できない場合は装備可能武器から削除
actor_class.armor_set.delete(@id)
end
}
end
#--------------------------------------------------------------------------
# ● 改造回数表示
#--------------------------------------------------------------------------
def show_alter_count
@name = (@change_name != nil ? @change_name :
$data_armors[@original_id].original_name).dup
if KGC::AEQ_SHOW_ALTER_COUNT
@name += KGC::AEQ_ALTER_COUNT_FORMAT.gsub(/{n}/i) {"#{@alter_count}"}
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  RPG::State
#================================================= =============================

class RPG::State
#--------------------------------------------------------------------------
# ● 名前の取得
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# ● オリジナル名取得
#--------------------------------------------------------------------------
def original_name
return @name
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Game_Temp
#================================================= =============================

class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :equipment_alter_rename, :equipment_alter_rename_type,
:equipment_alter_rename_id
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_AlterEquipment initialize
def initialize
initialize_KGC_AlterEquipment

@equipment_alter_rename = false
@equipment_alter_rename_type = @equipment_alter_rename_id = 0
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Game_Party
#================================================= =============================

class Game_Party
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_AlterEquipment initialize
def initialize
# 元の処理を実行
initialize_KGC_AlterEquipment

@alter_weapons, @alter_armors = [], []
end
#--------------------------------------------------------------------------
# ● 改造装備取得
#--------------------------------------------------------------------------
def alter_weapons
@alter_weapons = [] if @alter_weapons == nil
return @alter_weapons
end
#--------------------------------------------------------------------------
# ● 改造装備設定
#--------------------------------------------------------------------------
def alter_weapons=(ary)
@alter_weapons = [] if @alter_weapons == nil
@alter_weapons = ary
end
#--------------------------------------------------------------------------
# ● 改造防具取得
#--------------------------------------------------------------------------
def alter_armors
@alter_armors = [] if @alter_armors == nil
return @alter_armors
end
#--------------------------------------------------------------------------
# ● 改造防具設定
#--------------------------------------------------------------------------
def alter_armors=(ary)
@alter_armors = [] if @alter_armors == nil
@alter_armors = ary
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Window_AlterEquipmentCommand
#------------------------------------------------------------------------------
#  装備改造画面で、操作を選択するウィンドウです。
#================================================= =============================

class Window_AlterEquipmentCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = [KGC::AEQ_COMMAND_WEAPON_ALTER, KGC::AEQ_COMMAND_WEAPON_DISPOSE,
KGC::AEQ_COMMAND_ARMOR_ALTER, KGC::AEQ_COMMAND_ARMOR_DISPOSE]
@item_max = @commands.size
@column_max = @commands.size
@item_width = (width - 32) / @commands.size
self.z = 1000
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
for i in [email=0...@commands.size]0...@commands.size[/email]
rect = Rect.new(@item_width * i, 0, @item_width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(rect, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
if index != -1
self.cursor_rect.set(@item_width * index, 0, @item_width, 32)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@help_window.set_text(KGC::AEQ_HELP_WEAPON_ALTER)
when 1
@help_window.set_text(KGC::AEQ_HELP_WEAPON_DISPOSE )
when 2
@help_window.set_text(KGC::AEQ_HELP_ARMOR_ALTER)
when 3
@help_window.set_text(KGC::AEQ_HELP_ARMOR_DISPOSE)
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Window_AlterEquipmentLeft
#------------------------------------------------------------------------------
#  装備改造画面で、改造する装備スロットの一覧を表示するウィンドウです。
#================================================= =============================

class Window_AlterEquipmentLeft < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 128, 320, 352)
self.active = false
self.index = -1
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
@column_max = 1
refresh
end
#--------------------------------------------------------------------------
# ● 装備の取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(type = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# スロット一覧を作成
case type
when 0
for i in 0...KGC::AEQ_WEAPON_MAX
weapon = $game_party.alter_weapons[i]
@data.push(weapon)
end
when 1
for i in 0...KGC::AEQ_ARMOR_MAX
armor = $game_party.alter_armors[i]
@data.push(armor)
end
end
# ビットマップを作成し、全項目を描画
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i, type)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index, type)
item = @data[index]
x = 36
y = index * 32
self.contents.font.color = text_color(6)
self.contents.draw_text(x - 32, y, 32, 32, (index + 1).to_s, 1)
if item != nil
case type
when 0
number = $game_party.weapon_number(item.id)
when 1
number = $game_party.armor_number(item.id)
end
ac = item.alterable_count
if number > 0 && ac != 0
self.contents.font.color = normal_color
opacity = 255
else
self.contents.font.color = disabled_color
opacity = ac != 0 ? 255 : 160
end
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, icon, icon.rect, opacity)
self.contents.draw_text(x + 28, y, 224, 32, item.name)
else
self.contents.font.color = disabled_color
case type
when 0
self.contents.draw_text(x, y, 256, 32, KGC::AEQ_TEXT_NO_WEAPON, 1)
when 1
self.contents.draw_text(x, y, 256, 32, KGC::AEQ_TEXT_NO_ARMOR, 1)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の再描画
#--------------------------------------------------------------------------
def redraw_item(index, type)
case type
when 0
@data[index] = $game_party.alter_weapons[index]
when 1
@data[index] = $game_party.alter_armors[index]
end
self.contents.fill_rect(0, index * 32, 288, 32, Color.new(0, 0, 0, 0))
self.draw_item(index, type)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Window_AlterEquipmentRight
#------------------------------------------------------------------------------
#  装備改造画面で、所持している装備一覧を表示するウィンドウです。
#================================================= =============================

class Window_AlterEquipmentRight < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(320, 128, 320, 352)
self.active = false
self.visible = false
self.index = 0
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
@column_max = 1
refresh
end
#--------------------------------------------------------------------------
# ● 装備の取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(type = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
case type
when 0
unless KGC::AEQ_EXCLUDE_EQUIP_TYPE.include?(0)
# 所持している武器を追加
(1...$alter_weapon_start).each { |i|
if $game_party.weapon_number(i) > 0 &&
$data_weapons[i].alterable_count != 0 &&
!KGC::AEQ_EXCLUDE_WEAPONS.include?(i)
@data << $data_weapons[i]
end
}
end
when 1
# 所持している防具を追加
(1...$alter_armor_start).each { |i|
if $game_party.armor_number(i) > 0 &&
$data_armors[i].alterable_count != 0 &&
!KGC::AEQ_EXCLUDE_ARMORS.include?(i) &&
!KGC::AEQ_EXCLUDE_EQUIP_TYPE.include?($data_armors[i].kind + 1)
@data << $data_armors[i]
end
}
end
# 個数が 0 の場合は nil を追加
@data.push(nil) if @data.size == 0
# ビットマップを作成し、全項目を描画
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i, type)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index, type)
item = @data[index]
return if item == nil
x = 4
y = index * 32
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, icon, icon.rect)
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 216, 32, item.name)
case type
when 0
number = $game_party.weapon_number(item.id)
when 1
number = $game_party.armor_number(item.id)
end
self.contents.draw_text(x + 244, y, 16, 32, ":", 1)
self.contents.draw_text(x + 260, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Window_AlterEquipmentStatus
#------------------------------------------------------------------------------
#  装備改造画面で、選択した装備の能力を表示するウィンドウです。
#================================================= =============================

class Window_AlterEquipmentStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(320, 128, 320, 352)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
self.z = 500
refresh(nil)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(item, factor = nil)
self.contents.clear
if factor == nil # アイテムステータス
return if item == nil || item.name == ""
# 項目描画
self.contents.font.size = 20
self.contents.font.color = system_color
case item
when RPG::Weapon
self.contents.draw_text(4, 0, 80, 32, $data_system.words.atk)
self.contents.draw_text(148, 0, 80, 32, $data_system.words.pdef)
self.contents.draw_text(4, 32, 80, 32, $data_system.words.mdef)
when RPG::Armor
self.contents.draw_text(4, 0, 80, 32, $data_system.words.pdef)
self.contents.draw_text(148, 0, 80, 32, $data_system.words.mdef)
self.contents.draw_text(4, 32, 80, 32, "回避修正")
end
self.contents.draw_text(148, 32, 80, 32, $data_system.words.str)
self.contents.draw_text(4, 64, 80, 32, $data_system.words.dex)
self.contents.draw_text(148, 64, 80, 32, $data_system.words.agi)
self.contents.draw_text(4, 96, 80, 32, $data_system.words.int)
self.contents.font.color = normal_color
case item
when RPG::Weapon
self.contents.draw_text(84, 0, 48, 32, item.atk.to_s, 2)
self.contents.draw_text(228, 0, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(84, 32, 48, 32, item.mdef.to_s, 2)
when RPG::Armor
self.contents.draw_text(84, 0, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(228, 0, 48, 32, item.mdef.to_s, 2)
self.contents.draw_text(84, 32, 48, 32, item.eva.to_s, 2)
end
self.contents.draw_text(228, 32, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(84, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(228, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(84, 96, 48, 32, item.int_plus.to_s, 2)

# 属性描画
ix, iy = 4, 148
self.contents.font.size = 18
self.contents.font.color = system_color
case item
when RPG::Weapon
self.contents.draw_text(32, 128, 160, 20, "攻撃属性")
elements = item.element_set.dup
when RPG::Armor
self.contents.draw_text(32, 128, 160, 20, "防御属性")
elements = item.guard_element_set.dup
end
self.contents.font.color = normal_color
skip = true
elements.each { |element|
KGC::AEQ_ELEMENT_RANGE.each { |rng|
case rng
when Integer
skip = element != rng
when Range
skip = !rng.member?(element)
end
}
next if skip
text = "[#{$data_system.elements[element]}]"
cx = self.contents.text_size(text).width
self.contents.draw_text(ix, iy, cx + 8, 20, text)
ix += cx
if ix >= 264
ix = 4
iy += 20
if iy >= 192
break
end
end
}
# 付加/防御ステート描画
ix, iy = 4, 212
self.contents.font.color = system_color
case item
when RPG::Weapon
self.contents.draw_text(32, 192, 160, 20, "付加ステート")
states = item.plus_state_set.dup
when RPG::Armor
self.contents.draw_text(32, 192, 160, 20, "防御ステート")
states = item.guard_state_set.dup
end
self.contents.font.color = normal_color
self.contents.font.size = 18
skip = true
states.each { |state|
KGC::AEQ_STATE_RANGE.each { |rng|
case rng
when Integer
skip = state != rng
when Range
skip = !rng.member?(state)
end
}
next if skip
text = "[#{$data_states[state].name}]"
cx = self.contents.text_size(text).width
self.contents.draw_text(ix, iy, cx + 8, 20, text)
ix += cx
if ix >= 264
ix = 4
iy += 24
if iy >= 256
break
end
end
}
return if item.is_a?(RPG::Armor)
# 解除ステート描画
ix, iy = 4, 276
self.contents.font.color = system_color
self.contents.draw_text(32, 256, 160, 20, "解除ステート")
self.contents.font.color = normal_color
self.contents.font.size = 18
skip = true
item.minus_state_set.each { |state|
KGC::AEQ_STATE_RANGE.each { |rng|
case rng
when Integer
skip = state != rng
when Range
skip = !rng.member?(state)
end
}
next if skip
text = "[#{$data_states[state].name}]"
cx = self.contents.text_size(text).width
self.contents.draw_text(ix, iy, cx + 8, 20, text)
ix += cx
if ix >= 264
ix = 4
iy += 24
if iy >= 320
break
end
end
}
else # 素材アイテム数
return if factor == nil
self.contents.font.size = 22
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 128, 32, "改造費用")
self.contents.draw_text(232, 0, 48, 32, $data_system.words.gold)
self.contents.font.color = normal_color
self.contents.draw_text(104, 0, 128, 32, item.alter_cost(factor).to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 32, 128, 32, "所持金")
self.contents.draw_text(232, 32, 48, 32, $data_system.words.gold)
self.contents.font.color = normal_color
self.contents.draw_text(104, 32, 128, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 128, 32, "消費アイテム")
for i in 4...factor.size
self.contents.font.color = system_color
self.contents.draw_text(4, 128 + (i - 4) * 64, 80, 32, "必要数")
self.contents.draw_text(144, 128 + (i - 4) * 64, 80, 32, "所持数")
self.contents.font.color = normal_color
text = $data_items[factor[i][0]].name
icon = RPG::Cache.icon($data_items[factor[i][0]].icon_name)
self.contents.blt(4, 100 + (i - 4) * 64, icon, icon.rect)
self.contents.draw_text(32, 96 + (i - 4) * 64, 256, 32, text)
self.contents.draw_text(84, 128 + (i - 4) * 64, 48, 32, factor[i][1].to_s, 2)
self.contents.draw_text(224, 128 + (i - 4) * 64, 48, 32, $game_party.item_number(factor[i][0]).to_s, 2)
end
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Window_AlterEquipmentFactor
#------------------------------------------------------------------------------
#  装備改造画面で、付加要素一覧を表示するウィンドウです。
#================================================= =============================

class Window_AlterEquipmentFactor < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(320, 128, 320, 352)
@column_max = 1
self.active = false
self.visible = false
self.index = 0
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
end
#--------------------------------------------------------------------------
# ● ファクターの取得
#--------------------------------------------------------------------------
def factor
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(item)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item = item
@data = []
# 付加できるファクターを追加
case item
when RPG::Weapon
factors = KGC::AEQ_WEAPON_FACTORS
when RPG::Armor
factors = KGC::AEQ_ARMOR_FACTORS
end
for i in 0...factors.size
factor = factors[i]
next if factor == nil
@data.push(factor)
end
# 個数が 0 の場合は nil を追加
@data.push(nil) if @data.size == 0
# ビットマップを作成し、全項目を描画
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
factor = @data[index]
return if factor == nil
x = 4
y = index * 32
if @item.can_add_factor?(factor)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x, y, 280, 32, factor[0], 0)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.factor == nil ? "" : self.factor[1])
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Scene_Title
#================================================= =============================

class Scene_Title
#--------------------------------------------------------------------------
# ● コマンド : ニューゲーム
#--------------------------------------------------------------------------
alias command_new_game_KGC_AlterEquipment command_new_game
def command_new_game
# 元の処理を実行
command_new_game_KGC_AlterEquipment

# 改造装備を初期化
$alter_weapon_start = $data_weapons.size
for i in 0...KGC::AEQ_WEAPON_MAX
$data_weapons[$alter_weapon_start + i] = RPG::Weapon2.new
end
$alter_armor_start = $data_armors.size
for i in 0...KGC::AEQ_ARMOR_MAX
$data_armors[$alter_armor_start + i] = RPG::Armor2.new
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Scene_Load
#================================================= =============================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ● 決定時の処理
#--------------------------------------------------------------------------
alias on_decision_KGC_AlterEquipment on_decision
def on_decision(filename)
# 元の処理を実行
on_decision_KGC_AlterEquipment(filename)

# ファイルが存在しない場合は戻る
return unless FileTest.exist?(filename)
# 改造装備を取得
$alter_weapon_start = $data_weapons.size
for i in 0...KGC::AEQ_WEAPON_MAX
if $game_party.alter_weapons[i] == nil
$data_weapons[$alter_weapon_start + i] = RPG::Weapon2.new
else
$data_weapons[$alter_weapon_start + i] = $game_party.alter_weapons[i]
weapon = $game_party.alter_weapons[i]
weapon.show_alter_count
# 装備可能者を設定
for i in 1...$data_classes.size
actor_class = $data_classes[i]
# 改造対象の武器を装備できるクラスの場合
if actor_class.weapon_set.include?(weapon.original_id )
# 装備可能武器に追加
actor_class.weapon_set.push(weapon.id)
else
# 装備できない場合は装備可能武器から削除
actor_class.weapon_set.delete(weapon.id)
end
end
end
end
$alter_armor_start = $data_armors.size
for i in 0...KGC::AEQ_ARMOR_MAX
if $game_party.alter_armors[i] == nil
$data_armors[$alter_armor_start + i] = RPG::Armor2.new
else
$data_armors[$alter_armor_start + i] = $game_party.alter_armors[i]
armor = $game_party.alter_armors[i]
armor.show_alter_count
# 装備可能者を設定
for i in 1...$data_classes.size
actor_class = $data_classes[i]
# 改造対象の武器を装備できるクラスの場合
if actor_class.armor_set.include?(armor.original_id)
# 装備可能武器に追加
actor_class.armor_set.push(armor.id)
else
# 装備できない場合は装備可能武器から削除
actor_class.armor_set.delete(armor.id)
end
end
end
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Scene_Name
#================================================= =============================

class Scene_Name
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias main_KGC_AlterEquipment main
def main
# 元の処理を実行
main_KGC_AlterEquipment

# 装備名変更の場合
if $game_temp.equipment_alter_rename
case $game_temp.equipment_alter_rename_type
when 0
type = "weapon"
when 1
type = "armor"
end
equip = eval("$data_#{type}s[$game_temp.equipment_alter_rename_id]")
equip.change_name = @actor.name.dup
equip.show_alter_count
$game_temp.equipment_alter_rename_type = 0
$game_temp.equipment_alter_rename_id = 0
$game_temp.equipment_alter_rename = false
# 装備品改造画面に切り替え
$scene = Scene_AlterEquipment.new
end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#================================================= =============================
# â–  Scene_AlterEquipment
#------------------------------------------------------------------------------
#  装備改造画面の処理を行うクラスです。
#================================================= =============================

class Scene_AlterEquipment
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new if KGC::AEQ_BACK_TRANSPARENT
# ウィンドウを作成
if $imported["HelpExtension"]
@help_window = Window_HelpExtension.new
else
@help_window = Window_Help.new
end
@help_window.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
@command_window = Window_AlterEquipmentCommand.new
@left_window = Window_AlterEquipmentLeft.new
@right_window = Window_AlterEquipmentRight.new
@factor_window = Window_AlterEquipmentFactor.new
@status_window = Window_AlterEquipmentStatus.new
# ヘルプウィンドウを関連付け
@command_window.help_window = @help_window
@left_window.help_window = @help_window
@right_window.help_window = @help_window
@factor_window.help_window = @help_window
# カーソル位置を設定
@left_window.index = 0
@status_window.refresh(@left_window.item)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@help_window.dispose
@command_window.dispose
@left_window.dispose
@right_window.dispose
@factor_window.dispose
@status_window.dispose
@left_command_window.dispose if @left_command_window != nil
@right_command_window.dispose if @right_command_window != nil
@factor_command_window.dispose if @factor_command_window != nil
@spriteset.dispose if KGC::AEQ_BACK_TRANSPARENT
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@command_window.refresh
@left_window.refresh
@right_window.refresh
@factor_window.refresh(nil)
@status_window.refresh(nil)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@command_window.update
@left_window.update
@right_window.update
@factor_window.update
# コマンドウィンドウがアクティブの場合: update_command を呼ぶ
if @command_window.active
update_command
return
end
# レフトウィンドウがアクティブの場合: update_left を呼ぶ
if @left_window.active
@status_window.x = 320
update_left
return
end
# ライトウィンドウがアクティブの場合: update_right を呼ぶ
if @right_window.active
@status_window.x = 0
update_right
return
end
# ファクター追加ウィンドウがアクティブの場合: update_factor を呼ぶ
if @factor_window.active
@status_window.x = 0
update_factor
return
end
# レフトコマンドウィンドウがアクティブの場合: update_left_command を呼ぶ
if @left_command_window != nil && @left_command_window.active
update_left_command
return
end
# ライトコマンドウィンドウがアクティブの場合: update_right_command を呼ぶ
if @right_command_window != nil && @right_command_window.active
update_right_command
return
end
# ファクターコマンドウィンドウがアクティブの場合: update_factor_command を呼ぶ
if @factor_command_window != nil && @factor_command_window.active
update_factor_command
return
end
end
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top