设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3785|回复: 0
打印 上一主题 下一主题

[讨论] 【RMVA】道具提示系统 ...

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2118
在线时间
740 小时
注册时间
2010-9-6
帖子
338
跳转到指定楼层
1
 楼主| 发表于 2013-3-8 22:01:25 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 804173948 于 2013-3-8 22:05 编辑

(貌似发错区了…… 怎么改……)
有没有觉得那个“物品得失提示” 在一次获得很多道具时 会浪费很长时间……
反正我在测试我的游戏时就是这样
但这个可以一次性显示获得的道具

(我以为这个脚本很容易写,But 现实很残酷,整整用了三天写…… 时间紧迫,没弄声音上去 有兴趣的自己弄。。。 )
脚本(使用方法应该很清楚的了,还是不清楚的就下载范例吧):
  1. =begin
  2. ================================================
  3. 道具提示系统 版本 1.0 By 804173948 QQ:同上
  4. ================================================
  5. 使用方法:
  6. 在事件-脚本里输入

  7. 1、获得/失去物品

  8. 获得:

  9. get_item($data_items[物品id],数量)

  10. 失去:

  11. lost_item($data_items[物品id],数量)

  12. 例如:

  13. get_item($data_items[10],4) 获得10号物品 4个

  14. lost_item($data_items[1],3) 丢失1号物品 3个

  15. 2、获得/失去武器

  16. 获得:

  17. get_item($data_weapons[物品id],数量)

  18. 失去:

  19. lost_item($data_weapons[物品id],数量,是否包括装备)

  20. 是否包括装备:是则 True 否则 false 或不写 下同

  21. 3、获得/失去防具

  22. 获得:

  23. get_item($data_armors[物品id],数量)

  24. 失去:

  25. lost_item($data_armors[物品id],数量,是否包括装备)


  26. 注意:最后要加一句 show_window 否则不显示提示窗口


  27. 详情看范例……
  28. 有疑问或BUG之类的 欢迎提出
  29. =end
  30. class Game_Interpreter
  31.   alias old_initialize initialize
  32.   def initialize
  33.     old_initialize
  34.     @get_item_var =[]
  35.     @get_amount =[]
  36.   end
  37.   def show_window
  38. #~     Sound.play_ok
  39.     SceneManager.call(Scene_Get_Item)
  40.     SceneManager.scene.show_window(@get_item_var,@get_amount)
  41.     @get_item_var =[]
  42.     @get_amount =[]
  43.   end
  44.   def get_item(item,amount)
  45.     amount = 99 if amount > 99
  46.     @get_item_var.push(item)
  47.     @get_amount.push(amount)
  48.     $game_party.gain_item(item,amount)
  49.   end
  50.   def lost_item(item,amount,include_equip = false)
  51.     amount = 99 if amount > 99
  52.     @get_item_var.push(item)
  53.     @get_amount.push(-amount)
  54.     $game_party.gain_item(item,-amount,include_equip)
  55.   end
  56. end
  57. class Scene_Get_Item < Scene_MenuBase
  58.   def start
  59.     super
  60.     @get_item_var = []
  61.     @get_amount = []
  62.   end
  63.   def show_window(get_item_var,get_amount)
  64.     @get_item_var = get_item_var
  65.     @get_amount = get_amount
  66.     create_show_get_window
  67.     create_category_window
  68.   end
  69.   def create_show_get_window
  70.     @show_get_window = Window_Show_GetItem.new(145,88,250,200,@get_item_var,@get_amount) #窗口位置
  71.     @show_get_window.set_handler(:ok,     method(:return_scene))
  72.     @show_get_window.set_handler(:cancel, method(:on_item_cancel))
  73.   end
  74.   def create_category_window
  75.     @show_getItem_category = Window_GetItem_Category.new
  76.     @show_getItem_category.x = 145
  77.     @show_getItem_category.y = 40
  78.     @show_getItem_category.item_window = @show_get_window
  79.     @show_getItem_category.set_handler(:ok,     method(:on_category_ok))
  80.     @show_getItem_category.set_handler(:cancel, method(:return_scene))
  81.   end
  82.   def on_category_ok
  83.     @show_get_window.activate
  84.   end
  85.   def on_item_cancel
  86.     @show_getItem_category.activate
  87.   end
  88. end
  89. class Window_GetItem_Category < Window_ItemCategory
  90.   def col_max
  91.     return 2
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ● 获取窗口的宽度
  95.   #--------------------------------------------------------------------------
  96.   def window_width
  97.     return 250
  98.   end
  99.   def make_command_list
  100.     add_command("获得物品",   :get)
  101.     add_command("失去物品",   :lost)
  102.   end
  103. end

  104. class Window_Show_GetItem < Window_ItemList
  105.   def initialize(x, y, width, height,data,amount)
  106.     super(x, y, width, height)
  107.     @category = :get
  108.     @data_save = data
  109.     @amount_save = amount
  110.     refresh
  111.   end
  112.   def col_max
  113.     return 1
  114.   end
  115.   def spacing
  116.     return 32
  117.   end
  118.   def include?(index)
  119.     if index
  120.       case @category
  121.       when :get
  122.         if index >= 0
  123.           true
  124.         else
  125.           false
  126.         end
  127.       when :lost
  128.         if index < 0
  129.           true
  130.         else
  131.           false
  132.         end
  133.       else
  134.         false
  135.       end
  136.     end
  137.   end
  138.   def draw_item(index)
  139.     item = @data[index]
  140.     if item
  141.       rect = item_rect(index)
  142.       rect.width -= 4
  143.       draw_item_name(item, rect.x, rect.y)
  144.       draw_item_number(rect, index)
  145.     end
  146.   end
  147.   def draw_item_number(rect, item)
  148.     if @amount[item] < 0
  149.       s1 = -@amount[item]
  150.     else
  151.       s1 = @amount[item]
  152.     end
  153.     draw_text(rect, sprintf(":%2d", s1), 2)
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 查询此物品是否可用
  157.   #--------------------------------------------------------------------------
  158.   def enable?(item)
  159.     return true
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 生成物品列表
  163.   #--------------------------------------------------------------------------
  164.   def make_item_list
  165.     @data = Array.new(@data_save)
  166.     @amount = Array.new(@amount_save)
  167.     for i in 0 ... @data.size
  168.     @data[i] = nil if include?(@amount_save[i]) == false
  169.     @amount[i] = nil if include?(@amount_save[i]) == false
  170.     end
  171.     @data.delete(nil)
  172.     @amount.delete(nil)
  173.   end
  174. end
复制代码
图(网速太垃圾……本来有两张的……只有一张)




范例
(百度网盘) :http://pan.baidu.com/share/link?shareid=344067&uk=1429098753
undefined
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 17:08

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表