| 赞 | 0  | 
 
| VIP | 7 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 3983 | 
 
| 最后登录 | 2013-2-27 | 
 
| 在线时间 | 72 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 72 小时
 
        - 注册时间
 - 2010-10-18
 
        - 帖子
 - 104
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
 本帖最后由 迷路子 于 2010-10-24 05:32 编辑  
 
晚上看到帖子说脚本获得道具怎没弹提示 
因为自己本来也就有这个想法 
所以就趁这晚有空写出来了 
虽然翻了下论坛 
已经有前辈写出类似的脚本了 
phil前辈的脚本 
我还是写完才发现(汗) 
不过都写了   还是发上来了- =begin
 
 - 脚本名:脚本获得道具提示
 
 - 作者:迷路子
 
  
- 使用脚本获得道具时,还是会弹出获得道具的提示框
 
  
- =end
 
  
- module Miluko
 
 -   ITEM_GET_SW = 4  #提示是否显示的开关
 
 -   TIME    = 180  #提示显示的时间
 
 -   GET_SE = RPG::SE.new("Chime2", 80, 100)  #获得道具的音效
 
 -   LOSE_SE = RPG::SE.new("Cancel", 80, 100)
 
 -   OPACITY_CHANGE_RATE = 3  #透明度变化时间为显示时间的几分之一
 
 -   MONEY_TYPE = 0  #0为显示金钱名称  1为icon
 
 -   MONEY_ICON= 205 #金币的icon图
 
 - end
 
  
- class Window_GetItem < Window_Base
 
 -   
 
 -   def initialize(n,item = nil,lose = false)
 
 -     super(147,180,250,60)
 
 -     self.z = 10000
 
 -     self.contents_opacity = 0
 
 -     self.back_opacity = 0
 
 -     self.opacity = 0
 
 -     self.y = 180 + Miluko::TIME/4
 
 -     @item = item
 
 -     @count = 0
 
 -     @num = n
 
 -     @lose = lose
 
 -     refresh
 
 -     if @lose
 
 -       Miluko::LOSE_SE.play
 
 -     else
 
 -       Miluko::GET_SE.play
 
 -     end
 
 -   end
 
 -   
 
 -   def update
 
 -     @count += 1
 
 -     change_time = Miluko::TIME/Miluko::OPACITY_CHANGE_RATE
 
 -     if @count <= change_time
 
 -       self.y -= 1
 
 -       self.contents_opacity += 255/change_time
 
 -       self.back_opacity += 255/change_time
 
 -       self.opacity += 255/change_time
 
 -     elsif @count >= change_time*(Miluko::OPACITY_CHANGE_RATE-1)
 
 -       self.y += 1
 
 -       self.contents_opacity -= 255/change_time
 
 -       self.back_opacity -= 255/change_time
 
 -       self.opacity -= 255/change_time
 
 -     end
 
 -     if @count >= Miluko::TIME
 
 -       dispose
 
 -     end
 
 -   end
 
 -   
 
 -   def refresh
 
 -     draw_get_text(0,0)
 
 -     Graphics.frame_reset
 
 -   end
 
 -   
 
 -   def draw_get_text(x,y)
 
 -     self.contents.font.color = Color.new(120,120,255)
 
 -     self.contents.font.size = 24
 
 -     if @lose
 
 -       self.contents.draw_text(x, y, 60, WLH, "失去  ")
 
 -     else
 
 -       self.contents.draw_text(x, y, 60, WLH, "获得  ")
 
 -     end
 
 -     if @item != nil
 
 -       self.draw_icon(@item.icon_index, x+50, y)
 
 -       self.contents.font.color = Color.new(255,255,255)
 
 -       self.contents.draw_text(x+80, y, 100, WLH, @item.name)
 
 -       self.contents.font.color = Color.new(0,255,255)
 
 -       num_text = "x" + @num.to_s
 
 -       self.contents.draw_text(x+180, y, 30, WLH, num_text,2)
 
 -     else
 
 -       self.draw_icon(144, x+50, y)
 
 -       self.contents.font.color = Color.new(255,255,255)
 
 -       self.contents.draw_text(x+70, y, 100, WLH, @num,2)
 
 -       if Miluko::MONEY_TYPE
 
 -         self.draw_icon(Miluko::MONEY_ICON, x+190, y)
 
 -       else
 
 -         self.contents.draw_text(x+180, y, 40, WLH, Vocab::gold)
 
 -       end
 
 -     end
 
 -   end
 
 - end
 
  
- class Game_Party < Game_Unit
 
 -   
 
 -   def gain_gold(n)
 
 -     @gold = [[@gold + n, 0].max, 9999999].min
 
 -     get_num = n
 
 -     lose = true if n < 0
 
 -     if $game_switches[Miluko::ITEM_GET_SW]
 
 -       if lose
 
 -         get_window = Window_GetItem.new(0-get_num,nil,lose)
 
 -       else
 
 -         get_window = Window_GetItem.new(get_num)
 
 -       end
 
 -       for i in 1..Miluko::TIME
 
 -         get_window.update
 
 -         Graphics.update
 
 -       end
 
 -     end
 
 -   end
 
 -   
 
 -   def gain_item(item, n, include_equip = false)
 
 -     number = item_number(item)
 
 -     lose = true if n < 0
 
 -     get_num = n
 
 -     case item
 
 -     when RPG::Item
 
 -       @items[item.id] = [[number + n, 0].max, 99].min
 
 -     when RPG::Weapon
 
 -       @weapons[item.id] = [[number + n, 0].max, 99].min
 
 -     when RPG::Armor
 
 -       @armors[item.id] = [[number + n, 0].max, 99].min
 
 -     end
 
 -     n += number
 
 -     if include_equip and n < 0
 
 -       for actor in members
 
 -         while n < 0 and actor.equips.include?(item)
 
 -           actor.discard_equip(item)
 
 -           n += 1
 
 -         end
 
 -       end
 
 -     end
 
 -     if $game_switches[Miluko::ITEM_GET_SW]
 
 -       if lose
 
 -         get_window = Window_GetItem.new(0-get_num,item,lose)
 
 -       else
 
 -         get_window = Window_GetItem.new(get_num,item)
 
 -       end
 
 -       for i in 1..Miluko::TIME
 
 -         get_window.update
 
 -         Graphics.update
 
 -       end
 
 -     end
 
 -   end
 
 - end
 
  复制代码 使用方法- 设定一个开关控制是否显示物品获得提示,预设为4号开关
 
  
- 可设定提示显示时间,预设为3秒(180帧  设定时要注意单位为帧)
 
  
- 透明度变化时间  OPACITY_CHANGE_RATE为提示显示时间的几分之一   预设为3   即是1/3
 
  
- LOSE_SE和GET_SE分别是失去和获得时的音效  可以自行修改
 
  
- MONEY_TYPE是显示金钱时   金钱单位要以文字还是ICON方式显示
 
  
- MONEY_ICON  若是以ICON方式显示金钱单位   可修改此值设定想显示的ICON
 
 
  复制代码 截图 
 
 
提示框透明度变化和位移照不出来~哈 
 
 
 
 
$game_party.gain_item和用事件增减的结果是一样的 
 
工程 
 
Project1.rar
(239.94 KB, 下载次数: 162)
 |   
 
评分
- 
查看全部评分
 
 
 
 
 
 |