Project1
标题:
这两个脚本能并存吗……?不能的话有没有办法整合?
[打印本页]
作者:
午夜·剑客
时间:
2008-11-15 16:09
标题:
这两个脚本能并存吗……?不能的话有没有办法整合?
物品丢弃 + 物品种类数限制和VX版物品分类……
#==============================================================================
# ■ 物品丢弃 + 物品种类数限制 —— by 水镜风生
#------------------------------------------------------------------------------
LOSE_ITEM_SE_NAME = "Evasion"
$item_max = 25
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
# 处理物品画面的类。
#==============================================================================
class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@item_window = Window_Item.new(0, 67, 544, 280)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@target_window = Window_MenuStatus.new(0, 0)
@max_window = Window_Item_Max.new
@max_window.viewport = @viewport
@number_window = Window_LoseNumber.new(142, 156)
@number_window.viewport = @viewport
@command_window = Window_Command.new(145, [" 使用"," 丢弃"], 1, 2)
@command_window.x = 200
@command_window.y = 160
@over_window = Window_Help.new
@over_window.set_text("背包放不下了,丢弃一些没用的物品吧。")
@over_window.visible = false
hide_command_window
hide_number_window
hide_target_window
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@viewport.dispose
@help_window.dispose
@item_window.dispose
@target_window.dispose
@max_window.dispose
@command_window.dispose
@number_window.dispose
@over_window.dispose
end
#--------------------------------------------------------------------------
# ● 回到原画面
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(0)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@over_window.update
@help_window.update
@item_window.update
@target_window.update
@max_window.update
@command_window.update
@number_window.update
if @item_window.active
update_item_selection
elsif @target_window.active
update_target_selection
elsif @command_window.active
update_command_selection
elsif @number_window.active
update_number_selection
end
end
#--------------------------------------------------------------------------
# ● 更新物品选择
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
if $game_party.items.size > $item_max # 如果物品种类超过限制
Sound.play_buzzer
@over_window.visible = true
@item_window.help_window.visible = false
else
Sound.play_cancel
return_scene
end
elsif Input.trigger?(Input::C)
@item_window.help_window.visible = true
@over_window.visible = false
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
Sound.play_decision
if $game_party.item_can_use?(@item) # 物品是否可用
@command_window.draw_item(0,true)
else @command_window.draw_item(0,false) # 不可用的话【使用】选项颜色无效
end
if @item.price == 0 # 物品价格是否为0
@command_window.draw_item(1,false) # 是的话【丢弃】选项无效
else
@command_window.draw_item(1,true)
end
show_command_window
end
end
#--------------------------------------------------------------------------
# ● 更新目标选择
#--------------------------------------------------------------------------
def update_target_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if $game_party.item_number(@item) == 0 # 判断物品是否耗尽
@item_window.refresh # 刷新窗口内容
@max_window.refresh # 刷新物品种类窗口
end
hide_target_window
elsif Input.trigger?(Input::C)
if not $game_party.item_can_use?(@item)
Sound.play_buzzer
else
determine_target
end
end
end
#--------------------------------------------------------------------------
# ★ 更新指令选择
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
hide_command_window
elsif Input.trigger?(Input::C)
if @command_window.index == 0
if $game_party.item_can_use?(@item)
Sound.play_decision
@command_window.active = false
@command_window.visible =false
determine_item
else
Sound.play_buzzer
end
elsif @item == nil or @item.price == 0
Sound.play_buzzer
else
Sound.play_decision
@command_window.active = false
@command_window.visible =false
max = $game_party.item_number(@item)
@number_window.set(@item, max)
show_number_window
end
end
end
#--------------------------------------------------------------------------
# ★ 更新数量输入
#--------------------------------------------------------------------------
def update_number_selection
if Input.trigger?(Input::B)
Sound.play_cancel
hide_number_window
elsif Input.trigger?(Input::C)
Audio.se_play("Audio/SE/#{LOSE_ITEM_SE_NAME}", 80, 100)
$game_party.lose_item(@item, @number_window.number)
@item_window.refresh
@max_window.refresh
hide_number_window
end
end
#--------------------------------------------------------------------------
# ★ 显示指令选择窗口
#--------------------------------------------------------------------------
def show_command_window
@command_window.index = 0
@item_window.active = false
@command_window.visible = true
@command_window.active = true
end
#--------------------------------------------------------------------------
# ★ 显示数量窗口
#--------------------------------------------------------------------------
def show_number_window
@command_window.active = false
@number_window.visible = true
@number_window.active = true
end
#--------------------------------------------------------------------------
# ★ 隐藏指令选择窗口
#--------------------------------------------------------------------------
def hide_command_window
@item_window.active = true
@command_window.visible = false
@command_window.active = false
@viewport.rect.set(0, 0, 544, 416)
@viewport.ox = 0
end
#--------------------------------------------------------------------------
# ★ 隐藏数量窗口
#--------------------------------------------------------------------------
def hide_number_window
@item_window.active = true
@number_window.visible = false
@number_window.active = false
@viewport.rect.set(0, 0, 544, 416)
@viewport.ox = 0
end
end
#==============================================================================
# ■ Window_lost_item
#------------------------------------------------------------------------------
# 显示物品丢弃数量的窗口,仿 Window_ShopNumber。
#==============================================================================
class Window_LoseNumber < Window_Base
#--------------------------------------------------------------------------
# ★ 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 260, 104)
@item = nil
@max = 1
@number = 1
end
#--------------------------------------------------------------------------
# ★ 设置物品、最大数量
#--------------------------------------------------------------------------
def set(item, max)
@item = item
@max = max
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ★ 设置数量输入
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ★ 刷新
#--------------------------------------------------------------------------
def refresh
y = 24
self.contents.clear
draw_item_name(@item, 0, y)
self.contents.font.color = normal_color
self.contents.draw_text(164, y, 20, WLH, "×")
self.contents.draw_text(190, y, 20, WLH, @number, 2)
self.cursor_rect.set(186, y, 28, WLH)
end
#--------------------------------------------------------------------------
# ★ 更新画面
#--------------------------------------------------------------------------
def update
super
if self.active
last_number = @number
if Input.repeat?(Input::RIGHT) and @number < @max
@number += 1
end
if Input.repeat?(Input::LEFT) and @number > 1
@number -= 1
end
if Input.repeat?(Input::UP) and @number < @max
@number = [@number + 10, @max].min
end
if Input.repeat?(Input::DOWN) and @number > 1
@number = [@number - 10, 1].max
end
if @number != last_number
Sound.play_cursor
refresh
end
end
end
end
#==============================================================================
# ■ Window_Item_Max
#-----------------------------------------------------------------------------
# 显示背包容量和当前物品数的窗口
#============================================================================
class Window_Item_Max < Window_Base
#--------------------------------------------------------------------------
# ★ 初始化对像
#--------------------------------------------------------------------------
def initialize
super(290, 360, 254, 56)
refresh
end
#--------------------------------------------------------------------------
# ★ 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_icon(144, 0, 0)
self.contents.draw_text(36, 0, 100, 24, "背包容量:")
item = $game_party.items
string = item.size.to_s
self.contents.font.color = knockout_color if item.size > $item_max
self.contents.draw_text(135, 0, 30, 24, string, 2)
self.contents.font.color = normal_color
string = "/ " + $item_max.to_s
self.contents.draw_text(173, 0, 100, 24, string )
end
end
复制代码
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
module RPG
class Weapon
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def desc
desc = @description.split(/@/)[1]
return desc != nil ? desc : "普通物品"
end
end
class Item
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def desc
desc = @description.split(/@/)[1]
return desc != nil ? desc : "普通物品"
end
end
class Armor
def description
description = @description.split(/@/)[0]
return description != nil ? description : ''
end
def desc
desc = @description.split(/@/)[1]
return desc != nil ? desc : "普通物品"
end
end
end
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, Vocab::item, 1)
end
end
class Harts_Window_ItemCommand < Window_Selectable
attr_accessor :commands
def initialize
super(0, 64, 160, 296)
self.index = 0
refresh
end
def addcommand
@commands = []
for i in 1...$data_items.size
if $game_party.item_number($data_items[i]) > 0
push = true
for com in @commands
if com == $data_items[i].desc
push = false
end
end
if push == true
@commands.push($data_items[i].desc)
end
end
end
for i in 1...$data_weapons.size
if $game_party.item_number($data_weapons[i]) > 0
push = true
for com in @commands
if com == $data_weapons[i].desc
push = false
end
end
if push == true
@commands.push($data_weapons[i].desc)
end
end
end
for i in 1...$data_armors.size
if $game_party.item_number($data_armors[i]) > 0
push = true
for com in @commands
if com == $data_armors[i].desc
push = false
end
end
if push == true
@commands.push($data_armors[i].desc)
end
end
end
if @commands == []
@commands.push("普通物品")
end
@item_max = @commands.size
end
def refresh
addcommand
create_contents
for i in 0...@item_max
draw_item(i, normal_color)
end
end
def draw_item(index, color)
y = index * WLH
self.contents.font.color = color
if @commands[index] != nil
self.contents.draw_text(4,y, 172, WLH, @commands[index])
end
end
def update_help
@help_window.set_text(@commands[self.index])
end
end
class Harts_Window_ItemList < Window_Selectable
def initialize
super(160, 0, 384, 360)
self.index = 0
refresh
end
def item
return @data[self.index]
end
def refresh
@data = []
end
def set_item(command)
refresh
for i in 1...$data_items.size
if $game_party.item_number($data_items[i]) > 0 and $data_items[i].desc == command
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.item_number($data_weapons[i]) > 0 and $data_weapons[i].desc == command
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.item_number($data_armors[i]) > 0 and $data_armors[i].desc == command
@data.push($data_armors[i])
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)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = $game_party.item_can_use?(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enabled)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Harts_Window_Help < Window_Base
def initialize
super(0, 360, 544, WLH + 32)
end
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, WLH , text, align)
@text = text
@align = align
end
end
end
class Harts_Window_MenuStatus < Window_Selectable
def initialize(x, y)
super(x, y, 288, 416)
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
@item_max = $game_party.members.size
for actor in $game_party.members
x = 8
y = actor.index * 96 + WLH / 2
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 120, y)
draw_actor_level(actor, x, y + WLH * 1)
draw_actor_state(actor, x, y + WLH * 2)
draw_actor_hp(actor, x + 120, y + WLH * 1)
draw_actor_mp(actor, x + 120, y + WLH * 2)
end
end
def update_cursor
if @index < 0
self.cursor_rect.empty
elsif @index < @item_max
self.cursor_rect.set(0, @index * 96, contents.width, 96)
elsif @index >= 100
self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
else
self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
end
end
end
class Scene_Item < Scene_Base
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@itemtitle_window = Harts_Window_ItemTitle.new
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window.index
@itemcommand_window.refresh
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window.active = false
@help_window = Harts_Window_Help.new
@help_window.viewport = @viewport
@target_window = Harts_Window_MenuStatus.new(96, 0)
@itemcommand_window.help_window = @help_window
@itemlist_window.help_window = @help_window
@itemlist_window.set_item(@itemcommand_window.commands[@command_index])
hide_target_window
end
def terminate
super
dispose_menu_background
@viewport.dispose
@itemtitle_window.dispose
@itemcommand_window.dispose
@itemlist_window.dispose
@help_window.dispose
@target_window.dispose
end
def return_scene
$scene = Scene_Menu.new(0)
end
def update
super
update_menu_background
@help_window.update
@itemlist_window.update
@itemcommand_window.update
@target_window.update
@itemcommand_window.refresh
if @command_index != @itemcommand_window.index
@itemlist_window.index = 0
@command_index = @itemcommand_window.index
@itemcommand_window.update_help
@itemlist_window.set_item(@itemcommand_window.commands[@command_index])
end
if @itemcommand_window.active
@itemcommand_window.update_help
update_itemcommand
elsif @itemlist_window.active
update_itemlist
elsif @target_window.active
update_target_selection
end
end
def update_itemcommand
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
return
end
if Input.trigger?(Input::C)
if @itemlist_window.item_number == 0
Sound.play_buzzer
return
end
Sound.play_decision
@itemcommand_window.active = false
@itemlist_window.index = 0
@itemlist_window.active = true
return
end
end
def update_itemlist
if Input.trigger?(Input::B)
Sound.play_cancel
@itemcommand_window.active = true
@itemlist_window.active = false
@itemcommand_window.index = @command_index
elsif Input.trigger?(Input::C)
@item = @itemlist_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
def determine_item
if @item.for_friend?
show_target_window(@itemlist_window.index % 2 == 0)
if @item.for_all?
@target_window.index = 99
else
if $game_party.last_target_index < @target_window.item_max
@target_window.index = $game_party.last_target_index
else
@target_window.index = 0
end
end
else
use_item_nontarget
end
end
def update_target_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if $game_party.item_number(@item) == 0
@itemlist_window.refresh
end
@itemlist_window.active = true
@itemlist_window.set_item(@itemcommand_window.commands[@command_index])
hide_target_window
@itemlist_window.active = true
elsif Input.trigger?(Input::C)
if not $game_party.item_can_use?(@item)
Sound.play_buzzer
else
determine_target
end
end
end
def determine_target
used = false
if @item.for_all?
for target in $game_party.members
target.item_effect(target, @item)
used = true unless target.skipped
end
else
$game_party.last_target_index = @target_window.index
target = $game_party.members[@target_window.index]
target.item_effect(target, @item)
used = true unless target.skipped
end
if used
use_item_nontarget
else
Sound.play_buzzer
end
end
def show_target_window(right)
@itemlist_window.active = false
width_remain = 544 - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, 416)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, 416)
@viewport.ox = @target_window.width
end
end
def hide_target_window
@target_window.visible = false
@target_window.active = false
@itemlist_window.set_item(@itemcommand_window.commands[@command_index])
@viewport.rect.set(0, 0, 544, 416)
@viewport.ox = 0
end
def use_item_nontarget
Sound.play_use_item
$game_party.consume_item(@item)
@itemlist_window.draw_item(@itemlist_window.index)
@itemlist_window.set_item(@itemcommand_window.commands[@command_index])
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
elsif @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
[LINE]1,#dddddd[/LINE]
此贴于 2008-11-27 13:38:29 被版主木葬枫提醒,请楼主看到后对本贴做出回应。
[LINE]1,#dddddd[/LINE]
版务信息:版主帮忙结贴~
作者:
地龙
时间:
2008-11-15 19:23
提示:
作者被禁止或删除 内容自动屏蔽
作者:
午夜·剑客
时间:
2008-11-15 19:49
已编辑……{/jy}
作者:
木葬枫
时间:
2008-11-15 20:02
脚本
复制代码
请这样放上脚本
作者:
柳之一
时间:
2008-11-17 08:53
可以整合。
不过VX版物品分类是从xp移植的,没有使用note的vx新特性,导致冲突增加了不少。
直接参考沉影的note教学。
想找我整合请出大号 [LINE]1,#dddddd[/LINE]
系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
作者:
午夜·剑客
时间:
2008-11-30 03:45
大号?没有啊……
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1