Project1
标题: 一次显示获得多个物品,并且可以自定义颜色 [打印本页]
作者: crow2006 时间: 2014-9-17 23:21
标题: 一次显示获得多个物品,并且可以自定义颜色
本帖最后由 crow2006 于 2014-9-18 13:41 编辑
脚本包含两个部分:
第一部分:
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 一次显示所获得的多个物品,可自由设置物品颜色、数量
# 作者:crow999999
# 使用方法:在事件脚本中输入
# 范例: ddwp([1,1,1,1,2,2,2,3,3])
# 这样就能够一次获得编号为1的物品4个,编号为2的物品3个,编号为3的物品4个。
# 关于获得武器、防具,请自行搞定。
#--------------------------------------------------------------------------
def ddwp(items)
items2 = []
for i in items
items2.push($data_items[i])
end
for i in items
$game_party.gain_item($data_items[i], 1)
end
@wait_count = 30
@window_fuye = Window_fuye.new(items2)
@window_fuye.openness = 255
loop do
if Input.trigger?(Input::C) or Input.trigger?(Input::B)
@window_fuye.openness = 0
@window_fuye.dispose
@window_fuye = nil
break
end
@wait_count = 10
Graphics.update
Input.update
end
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 一次显示所获得的多个物品,可自由设置物品颜色、数量
# 作者:crow999999
# 使用方法:在事件脚本中输入
# 范例: ddwp([1,1,1,1,2,2,2,3,3])
# 这样就能够一次获得编号为1的物品4个,编号为2的物品3个,编号为3的物品4个。
# 关于获得武器、防具,请自行搞定。
#--------------------------------------------------------------------------
def ddwp(items)
items2 = []
for i in items
items2.push($data_items[i])
end
for i in items
$game_party.gain_item($data_items[i], 1)
end
@wait_count = 30
@window_fuye = Window_fuye.new(items2)
@window_fuye.openness = 255
loop do
if Input.trigger?(Input::C) or Input.trigger?(Input::B)
@window_fuye.openness = 0
@window_fuye.dispose
@window_fuye = nil
break
end
@wait_count = 10
Graphics.update
Input.update
end
end
end
作者: crow2006 时间: 2014-9-17 23:48
第二部分:
#=======================================================
#★显示物品提示窗口
#=======================================================
class Window_fuye<Window_Base
#====================================
#●初始化
#====================================
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
# width : 窗口宽度
# height : 窗口高度
#--------------------------------------------------------------------------
def initialize(item)
@item=item
@item_name = {}
n=0
m=0
if @item != nil
for itn in @item
if @item_name[itn.name]==nil
@item_name[itn.name]=[0,""]
@item_name[itn.name][1]=itn.icon_index
m+=1
end
@item_name[itn.name][0] += 1
end
end
super(200,15, 180,25*m+75 )
self.opacity = 150
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size=16
if @item_name.size != 0
self.contents.font.size = 16
self.contents.font.color = Color.new(255,255,0)
self.contents.draw_text(10,0,64,32,"获得物品:")
i=0
i=0
self.contents.font.size = 14
self.contents.font.color = Color.new(255,255,255,255)
for itn in @item_name
################################
#颜色自定
if itn[0].include?("多彩晶矿") or itn[0].include?("紫色夜魇草") or itn[0].include?("黄金果实") or itn[0].include?("蓝魔鱼") or itn[0].include?("魔力果")
self.contents.font.color = text_color(44) #颜色请自定义
draw_icon(itn[1][1] ,6 ,32+i*25 , true)
self.contents.draw_text(30,32+i*25,160,32,itn[0] + " × "+ itn[1][0].to_s)
i+=1
else
self.contents.font.color = Color.new(255,255,255,255)
draw_icon(itn[1][1] ,6 ,32+i*25 , true)
self.contents.draw_text(30,32+i*25,160,32,itn[0] + " × "+ itn[1][0].to_s)
i+=1
end
################################
end
end
end
end
#=======================================================
#★显示物品提示窗口
#=======================================================
class Window_fuye<Window_Base
#====================================
#●初始化
#====================================
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
# width : 窗口宽度
# height : 窗口高度
#--------------------------------------------------------------------------
def initialize(item)
@item=item
@item_name = {}
n=0
m=0
if @item != nil
for itn in @item
if @item_name[itn.name]==nil
@item_name[itn.name]=[0,""]
@item_name[itn.name][1]=itn.icon_index
m+=1
end
@item_name[itn.name][0] += 1
end
end
super(200,15, 180,25*m+75 )
self.opacity = 150
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size=16
if @item_name.size != 0
self.contents.font.size = 16
self.contents.font.color = Color.new(255,255,0)
self.contents.draw_text(10,0,64,32,"获得物品:")
i=0
i=0
self.contents.font.size = 14
self.contents.font.color = Color.new(255,255,255,255)
for itn in @item_name
################################
#颜色自定
if itn[0].include?("多彩晶矿") or itn[0].include?("紫色夜魇草") or itn[0].include?("黄金果实") or itn[0].include?("蓝魔鱼") or itn[0].include?("魔力果")
self.contents.font.color = text_color(44) #颜色请自定义
draw_icon(itn[1][1] ,6 ,32+i*25 , true)
self.contents.draw_text(30,32+i*25,160,32,itn[0] + " × "+ itn[1][0].to_s)
i+=1
else
self.contents.font.color = Color.new(255,255,255,255)
draw_icon(itn[1][1] ,6 ,32+i*25 , true)
self.contents.draw_text(30,32+i*25,160,32,itn[0] + " × "+ itn[1][0].to_s)
i+=1
end
################################
end
end
end
end
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |