#———— 刷新 ————
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]
end
@help_window.set_text(@text)
end
end # Window_ItemCommand的
#—— 取得现在选择的物品 ——
def item
return @data[self.index]
end
#—— 刷新 ———
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
end
#—— 设置不同类别的物品 ———
def set_item(command)
refresh
#—— 根据现在的选项决定物品 ——
case command
when 0 #药品,特点是分散度为0
for i in 1...$data_items.size
if ($data_items.variance == 0 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 1 #食物类,特点是分散度为1
for i in 1...$data_items.size
if ($data_items.variance == 1 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 2 #杂货类,特点是分散度为2
for i in 1...$data_items.size
if ($data_items.variance == 2 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 3 #各种装备:根据原本类push
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons)
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors)
end
end
when 4 #各类曲谱:特点是分散度为3
for i in 1...$data_items.size
if ($data_items.variance == 3 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 5 #特殊物品:特点是分散度为4
for i in 1...$data_items.size
if ($data_items.variance == 4 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
end
@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
#——— 项目内容的描画 ————
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 = half_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
#—— update的定义 ——
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
#—— 当某窗体在active的时候,更新之 ——
if @itemcommand_window.active
update_itemcommand
return
end
if @itemlist_window.active
update_itemlist
return
end
if @target_window.active
update_target
return
end
end # update的
#————具体更新定义————
def update_itemcommand
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0,1)
return
end
if Input.trigger?(Input::C)
if @itemlist_window.item_number == 0
$game_system.se_play($data_system.buzzer_se)
return
end
$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
if Input.trigger?(Input::B)
$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
if Input.trigger?(Input::C)
@item = @itemlist_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$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
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
if @item.consumable
$game_party.lose_item(@item.id, 1)
end
$game_switches[25] = true
$scene = Scene_Map.new
return
else
@target_window.index = -1
end
else
@target_window.index = 0
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable #——消耗品的情况
$game_party.lose_item(@item.id, 1)
@itemlist_window.draw_item(@itemlist_window.index) #——重新描绘
end
$game_switches[25] = true
$scene = Scene_Map.new
return
end
end
return
end
end
#———— 更新target窗口————
def update_target
if Input.trigger?(Input::B)
$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
if Input.trigger?(Input::C)
if $game_party.item_number(@item.id) == 0
$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
$game_system.se_play(@item.menu_se)
if @item.consumable
$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
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end #target窗口的
end #Class Scene_Item的
怎么加多一个选项……可以的话把思路跟我说说 [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~作者: ★_茄孓 时间: 2008-8-18 06:09
when 5 #特殊物品:特点是分散度为4
for i in 1...$data_items.size
if ($data_items.variance == 4 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 6 #你想分类的物品:特点是分散度为5
for i in 1...$data_items.size
if ($data_items.variance == 5 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end作者: 「旅」 时间: 2008-8-18 06:11
还要改着:
@commands = ["药物类", "食物类", "书报杂志", "各种装备", "曲谱乐谱", "特殊道具","新建"]
应该没错{/gg}作者: 玄月 时间: 2008-8-18 07:22
不行,还是报错,这种方法我试过了,没用作者: 「旅」 时间: 2008-8-18 07:26
@item_max = 6
改为
@item_max = 7作者: 玄月 时间: 2008-8-18 07:28
一样,还是报错,我把积分提到200了大家帮帮忙作者: 「旅」 时间: 2008-8-18 07:33
def update_help
case self.index
when 0
@text = @commands[0]
when 1
@text = @commands[1]
…………
when 6
@text = @commands[6]作者: 玄月 时间: 2008-8-18 07:41
还是没用,麻烦测试一下再回帖好吗?作者: 「旅」 时间: 2008-8-18 07:47
顶楼的脚本没法用…是在哪拿的…说明一下作者: 玄月 时间: 2008-8-18 07:54
就在黑剑里,额……忘了说了,用的时候把
225,229,270行也就是出错的那几行注释掉或删掉,因为没有黑剑的那2个脚本作者: 「旅」 时间: 2008-8-18 08:07
#把171行前的内容,也就是"#——— 单类物品的个数 ————"这行字以上全换成以下内容
#==============================================================================
# ■ Window_ItemTitle
#------------------------------------------------------------------------------
# 选择类别
#==============================================================================
class 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
#==============================================================================
# ■ Window_ItemCommand
#------------------------------------------------------------------------------
# 选择类别
#==============================================================================
class Window_ItemCommand < Window_Selectable
#———— 刷新 ————
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]
end
@help_window.set_text(@text)
end
end # Window_ItemCommand的
#—— 取得现在选择的物品 ——
def item
return @data[self.index]
end
#—— 刷新 ———
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
end
#—— 设置不同类别的物品 ———
def set_item(command)
refresh
#—— 根据现在的选项决定物品 ——
case command
when 0 #药品,特点是分散度为0
for i in 1...$data_items.size
if ($data_items.variance == 0 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 1 #食物类,特点是分散度为1
for i in 1...$data_items.size
if ($data_items.variance == 1 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 2 #杂货类,特点是分散度为2
for i in 1...$data_items.size
if ($data_items.variance == 2 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 3 #各种装备:根据原本类push
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons)
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors)
end
end
when 4 #各类曲谱:特点是分散度为3
for i in 1...$data_items.size
if ($data_items.variance == 3 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 5 #特殊物品:特点是分散度为4
for i in 1...$data_items.size
if ($data_items.variance == 4 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
when 6
for i in 1...$data_items.size
if ($data_items.variance == 5 and $game_party.item_number(i) > 0)
@data.push($data_items)
end
end
end
@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 [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~