Project1
标题:
【RMVA】道具提示系统 ...
[打印本页]
作者:
804173948
时间:
2013-3-8 22:01
标题:
【RMVA】道具提示系统 ...
本帖最后由 804173948 于 2013-3-8 22:05 编辑
(貌似发错区了…… 怎么改……)
有没有觉得那个“物品得失提示” 在一次获得很多道具时 会浪费很长时间……
反正我在测试我的游戏时就是这样
但这个可以一次性显示获得的道具
(我以为这个脚本很容易写,But 现实很残酷,整整用了三天写…… 时间紧迫,没弄声音上去 有兴趣的自己弄。。。 )
脚本(使用方法应该很清楚的了,还是不清楚的就下载范例吧):
=begin
================================================
道具提示系统 版本 1.0 By 804173948 QQ:同上
================================================
使用方法:
在事件-脚本里输入
1、获得/失去物品
获得:
get_item($data_items[物品id],数量)
失去:
lost_item($data_items[物品id],数量)
例如:
get_item($data_items[10],4) 获得10号物品 4个
lost_item($data_items[1],3) 丢失1号物品 3个
2、获得/失去武器
获得:
get_item($data_weapons[物品id],数量)
失去:
lost_item($data_weapons[物品id],数量,是否包括装备)
是否包括装备:是则 True 否则 false 或不写 下同
3、获得/失去防具
获得:
get_item($data_armors[物品id],数量)
失去:
lost_item($data_armors[物品id],数量,是否包括装备)
注意:最后要加一句 show_window 否则不显示提示窗口
详情看范例……
有疑问或BUG之类的 欢迎提出
=end
class Game_Interpreter
alias old_initialize initialize
def initialize
old_initialize
@get_item_var =[]
@get_amount =[]
end
def show_window
#~ Sound.play_ok
SceneManager.call(Scene_Get_Item)
SceneManager.scene.show_window(@get_item_var,@get_amount)
@get_item_var =[]
@get_amount =[]
end
def get_item(item,amount)
amount = 99 if amount > 99
@get_item_var.push(item)
@get_amount.push(amount)
$game_party.gain_item(item,amount)
end
def lost_item(item,amount,include_equip = false)
amount = 99 if amount > 99
@get_item_var.push(item)
@get_amount.push(-amount)
$game_party.gain_item(item,-amount,include_equip)
end
end
class Scene_Get_Item < Scene_MenuBase
def start
super
@get_item_var = []
@get_amount = []
end
def show_window(get_item_var,get_amount)
@get_item_var = get_item_var
@get_amount = get_amount
create_show_get_window
create_category_window
end
def create_show_get_window
@show_get_window = Window_Show_GetItem.new(145,88,250,200,@get_item_var,@get_amount) #窗口位置
@show_get_window.set_handler(:ok, method(:return_scene))
@show_get_window.set_handler(:cancel, method(:on_item_cancel))
end
def create_category_window
@show_getItem_category = Window_GetItem_Category.new
@show_getItem_category.x = 145
@show_getItem_category.y = 40
@show_getItem_category.item_window = @show_get_window
@show_getItem_category.set_handler(:ok, method(:on_category_ok))
@show_getItem_category.set_handler(:cancel, method(:return_scene))
end
def on_category_ok
@show_get_window.activate
end
def on_item_cancel
@show_getItem_category.activate
end
end
class Window_GetItem_Category < Window_ItemCategory
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 250
end
def make_command_list
add_command("获得物品", :get)
add_command("失去物品", :lost)
end
end
class Window_Show_GetItem < Window_ItemList
def initialize(x, y, width, height,data,amount)
super(x, y, width, height)
@category = :get
@data_save = data
@amount_save = amount
refresh
end
def col_max
return 1
end
def spacing
return 32
end
def include?(index)
if index
case @category
when :get
if index >= 0
true
else
false
end
when :lost
if index < 0
true
else
false
end
else
false
end
end
end
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
draw_item_number(rect, index)
end
end
def draw_item_number(rect, item)
if @amount[item] < 0
s1 = -@amount[item]
else
s1 = @amount[item]
end
draw_text(rect, sprintf(":%2d", s1), 2)
end
#--------------------------------------------------------------------------
# ● 查询此物品是否可用
#--------------------------------------------------------------------------
def enable?(item)
return true
end
#--------------------------------------------------------------------------
# ● 生成物品列表
#--------------------------------------------------------------------------
def make_item_list
@data = Array.new(@data_save)
@amount = Array.new(@amount_save)
for i in 0 ... @data.size
@data[i] = nil if include?(@amount_save[i]) == false
@amount[i] = nil if include?(@amount_save[i]) == false
end
@data.delete(nil)
@amount.delete(nil)
end
end
复制代码
图(网速太垃圾……本来有两张的……只有一张)
道具显示系统 2.png
(154.71 KB, 下载次数: 7)
下载附件
保存到相册
2013-3-8 21:44 上传
范例
(百度网盘) :
http://pan.baidu.com/share/link?shareid=344067&uk=1429098753
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1