WeissRaben
Member
Ok...I use the ammunition system by DerVVulfman, but it doesn't work with this Item script, the window to set the clips doesn't open.
Can anyone modify this script, making possible to use it with DerWulfman one? Thanks.
Code:
#Scripts from http://hartshorn-id.hp.infoseek.co.jp/index.html
#==============================================================================
# â– Harts_Window_ItemTitle
#------------------------------------------------------------------------------
#  アイテム画é¢ã§ã€ã‚¿ã‚¤ãƒˆãƒ«ã‚’表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã€‚
#==============================================================================
class Harts_Window_ItemTitle < Window_Base
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
end
end
#==============================================================================
# â– Harts_Window_ItemCommand
#------------------------------------------------------------------------------
#  アイテムã®ç¨®åˆ¥é¸æŠžã‚’è¡Œã†ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#==============================================================================
class Harts_Window_ItemCommand < Window_Selectable
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(0, 64, 160, 288)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 8
@commands = ["Item", "Battle Item", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "Event Item"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®æç”»
# index : é …ç›®ç•ªå·
# color : æ–‡å—色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
y = index * 32
self.contents.draw_text(4, y, 128, 32, @commands[index])
end
#--------------------------------------------------------------------------
# ◠ヘルプテã‚スト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@text = @commands[0]
when 1
@text = @commands[1]
when 2
@text = @commands[2]
when 3
@text = @commands[3]
when 4
@text = @commands[4]
when 5
@text = @commands[5]
when 6
@text = @commands[6]
when 7
@text = @commands[7]
end
@help_window.set_text(@text)
end
end
#==============================================================================
# â– Window_Item
#------------------------------------------------------------------------------
#  アイテム画é¢ã§ã€æ‰€æŒã‚¢ã‚¤ãƒ†ãƒ ã®ä¸€è¦§ã‚’表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#==============================================================================
class Harts_Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 416)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ◠アイテムã®å–å¾—
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
end
#--------------------------------------------------------------------------
# ◠アイテム一覧è¨å®š
# command : é¸æŠžä¸ã®ã‚³ãƒžãƒ³ãƒ‰
#--------------------------------------------------------------------------
def set_item(command)
refresh
case command
when 0
for i in 1...$data_items.size
if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
when 1
for i in 1...$data_items.size
if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
@data.push($data_items[i])
end
end
when 2
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
when 3
for i in 1...$data_armors.size
if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 4
for i in 1...$data_armors.size
if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 5
for i in 1...$data_armors.size
if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 6
for i in 1...$data_armors.size
if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 7
for i in 1...$data_items.size
if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
# é …ç›®æ•°ãŒ 0 ã§ãªã‘ã‚Œã°ãƒ“ットマップを作æˆã—ã€å…¨é …目をæç”»
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ◠種類別アイテム数ã®å–å¾—
#--------------------------------------------------------------------------
def item_number
return @item_max
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®æç”»
# index : é …ç›®ç•ªå·
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ◠ヘルプテã‚スト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# â– Harts_Scene_Item
#------------------------------------------------------------------------------
#  アイテム画é¢ã®å‡¦ç†ã‚’è¡Œã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚å†å®šç¾©
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ◠メイン処ç†
#--------------------------------------------------------------------------
def main
# タイトルウィンドウを作æˆ
@itemtitle_window = Harts_Window_ItemTitle.new
#コマンドウィンドウを作æˆ
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window.index
#アイテムウィンドウを作æˆ
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window.active = false
#ヘルプウィンドウを作æˆ
@help_window = Window_Help.new
@help_window.x = 0
@help_window.y = 416
# ヘルプウィンドウを関連付ã‘
@itemcommand_window.help_window = @help_window
@itemlist_window.help_window = @help_window
# ã‚¿ãƒ¼ã‚²ãƒƒãƒˆã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’ä½œæˆ (ä¸å¯è¦–・éžã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã«è¨å®š)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# アイテムウィンドウ内容表示
@itemlist_window.set_item(@command_index)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画é¢ã‚’æ›´æ–°
Graphics.update
# å…¥åŠ›æƒ…å ±ã‚’æ›´æ–°
Input.update
# フレーム更新
update
# ç”»é¢ãŒåˆ‡ã‚Šæ›¿ã‚ã£ãŸã‚‰ãƒ«ãƒ¼ãƒ—ã‚’ä¸æ–
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@itemtitle_window.dispose
@itemcommand_window.dispose
@itemlist_window.dispose
@help_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@itemtitle_window.update
@itemcommand_window.update
@itemlist_window.update
@help_window.update
@target_window.update
if @command_index != @itemcommand_window.index
@command_index = @itemcommand_window.index
@itemlist_window.set_item(@command_index)
end
# コマンドウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_itemcommand を呼ã¶
if @itemcommand_window.active
update_itemcommand
return
end
# アイテムウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_itemlist を呼ã¶
if @itemlist_window.active
update_itemlist
return
end
# ターゲットウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_target を呼ã¶
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (コマンドウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_itemcommand
# B ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
# メニュー画é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Menu.new(0)
return
end
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# é¸æŠžä¸ã®ã‚³ãƒžãƒ³ãƒ‰ã®ã‚¢ã‚¤ãƒ†ãƒ ãŒãªã„å ´åˆ
if @itemlist_window.item_number == 0
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE ã‚’æ¼”å¥
$game_system.se_play($data_system.decision_se)
# アイテムウィンドウをアクティブã«ã™ã‚‹
@itemcommand_window.active = false
@itemlist_window.active = true
@itemlist_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (アイテムウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_itemlist
# B ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
# アイテムウィンドウをアクティブã«ã™ã‚‹
@itemcommand_window.active = true
@itemlist_window.active = false
@itemlist_window.index = 0
@itemcommand_window.index = @command_index
return
end
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# アイテムウィンドウã§ç¾åœ¨é¸æŠžã•ã‚Œã¦ã„るデータをå–å¾—
@item = @itemlist_window.item
# 使用アイテムã§ã¯ãªã„å ´åˆ
unless @item.is_a?(RPG::Item)
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用ã§ããªã„å ´åˆ
unless $game_party.item_can_use?(@item.id)
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE ã‚’æ¼”å¥
$game_system.se_play($data_system.decision_se)
# 効果範囲ãŒå‘³æ–¹ã®å ´åˆ
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@itemlist_window.active = false
@target_window.x = 304
@target_window.visible = true
@target_window.active = true
# 効果範囲 (å˜ä½“/全体) ã«å¿œã˜ã¦ã‚«ãƒ¼ã‚½ãƒ«ä½ç½®ã‚’è¨å®š
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# 効果範囲ãŒå‘³æ–¹ä»¥å¤–ã®å ´åˆ
else
# コモンイベント ID ãŒæœ‰åŠ¹ã®å ´åˆ
if @item.common_event_id > 0
# コモンイベント呼ã³å‡ºã—予約
$game_temp.common_event_id = @item.common_event_id
# アイテムã®ä½¿ç”¨æ™‚ SE ã‚’æ¼”å¥
$game_system.se_play(@item.menu_se)
# 消耗å“ã®å ´åˆ
if @item.consumable
# 使用ã—ãŸã‚¢ã‚¤ãƒ†ãƒ ã‚’ 1 減らã™
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウã®é …目をå†æç”»
@itemlist_window.draw_item(@itemlist_window.index)
end
# マップ画é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (ターゲットウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_target
# B ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
# アイテム切れãªã©ã§ä½¿ç”¨ã§ããªããªã£ãŸå ´åˆ
unless $game_party.item_can_use?(@item.id)
# アイテムウィンドウã®å†…容をå†ä½œæˆ
@itemlist_window.refresh
end
# ターゲットウィンドウを消去
@itemlist_window.active = true
@target_window.visible = false
@target_window.active = false
@itemlist_window.set_item(@command_index)
return
end
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# アイテムを使ã„切ã£ãŸå ´åˆ
if $game_party.item_number(@item.id) == 0
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# ターゲットãŒå…¨ä½“ã®å ´åˆ
if @target_window.index == -1
# パーティ全体ã«ã‚¢ã‚¤ãƒ†ãƒ ã®ä½¿ç”¨åŠ¹æžœã‚’é©ç”¨
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ターゲットãŒå˜ä½“ã®å ´åˆ
if @target_window.index >= 0
# ターゲットã®ã‚¢ã‚¯ã‚¿ãƒ¼ã«ã‚¢ã‚¤ãƒ†ãƒ ã®ä½¿ç”¨åŠ¹æžœã‚’é©ç”¨
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# アイテムを使ã£ãŸå ´åˆ
if used
# アイテムã®ä½¿ç”¨æ™‚ SE ã‚’æ¼”å¥
$game_system.se_play(@item.menu_se)
# 消耗å“ã®å ´åˆ
if @item.consumable
# 使用ã—ãŸã‚¢ã‚¤ãƒ†ãƒ ã‚’ 1 減らã™
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウã®é …目をå†æç”»
@itemlist_window.draw_item(@itemlist_window.index)
@itemlist_window.set_item(@command_index)
end
# ターゲットウィンドウã®å†…容をå†ä½œæˆ
@target_window.refresh
# 全滅ã®å ´åˆ
if $game_party.all_dead?
# ゲームオーãƒãƒ¼ç”»é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Gameover.new
return
end
# コモンイベント ID ãŒæœ‰åŠ¹ã®å ´åˆ
if @item.common_event_id > 0
# コモンイベント呼ã³å‡ºã—予約
$game_temp.common_event_id = @item.common_event_id
# マップ画é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Map.new
return
end
end
# アイテムを使ã‚ãªã‹ã£ãŸå ´åˆ
unless used
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
Can anyone modify this script, making possible to use it with DerWulfman one? Thanks.