查看: 2113|回复: 1

[RMVX发布] 一次显示获得多个物品,并且可以自定义颜色

[复制链接]
梦石
0
星屑
632
在线时间
921 小时
注册时间
2013-3-13
回帖
503
发表于 2014-9-17 23:21:04 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 crow2006 于 2014-9-18 13:41 编辑

1.jpg
脚本包含两个部分:
第一部分:
[pre lang="ruby" line="1"]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)
    end  
    for i in items
      $game_party.gain_item($data_items, 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[/pre]







梦石
0
星屑
632
在线时间
921 小时
注册时间
2013-3-13
回帖
503
 楼主| 发表于 2014-9-17 23:48:09 | 显示全部楼层
第二部分:
[pre lang="ruby" line="1"] #=======================================================
#★显示物品提示窗口
#=======================================================
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[/pre]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部