查看: 2536|回复: 2

[已经解决] 在道具栏中加入丢弃道具怎么做?

[复制链接]
梦石
0
星屑
55
在线时间
9 小时
注册时间
2012-9-1
回帖
52
发表于 2012-9-3 18:52:28 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 吸血鬼之妻 于 2012-9-3 18:56 编辑

当使用道具时会弹出窗口
使用、丢弃和取消,要怎么做?
有脚本吗?
希望发发脚本或者范例

八宝粥的基叔

梦石
0
星屑
4957
在线时间
5234 小时
注册时间
2009-4-29
回帖
14054

贵宾

发表于 2012-9-4 14:39:48 | 显示全部楼层
嗷呜~~
范例在这里: Project3.rar (239.11 KB, 下载次数: 463)
  1. #==============================================================================
  2. # ■ 道具操作选项
  3. #------------------------------------------------------------------------------
  4. #
  5. #   本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  6. #
  7. #   作者:protosssonny   
  8. #
  9. #==============================================================================

  10. #==============================================================================
  11. # ■ Scene_Item
  12. #------------------------------------------------------------------------------
  13. #  处理物品画面的类。
  14. #==============================================================================

  15. class Scene_Item < Scene_Base
  16.   #--------------------------------------------------------------------------
  17.   # ● 开始处理
  18.   #--------------------------------------------------------------------------
  19.   def start
  20.     super
  21.     create_menu_background
  22.     @viewport = Viewport.new(0, 0, 544, 416)
  23.     @help_window = Window_Help.new
  24.     @help_window.viewport = @viewport
  25.     @item_window = Window_Item.new(0, 56, 544, 360)
  26.     @item_window.viewport = @viewport
  27.     @item_window.help_window = @help_window
  28.     @item_window.active = false
  29.     @target_window = Window_MenuStatus.new(0, 0)
  30.     @item_command_window = Window_Command.new(160, ["使用","丢弃","取消"])
  31.     @item_command_window.y = 56
  32.     @item_command_window.active = false
  33.     @item_command_window.visible = false
  34.     hide_target_window
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 结束处理
  38.   #--------------------------------------------------------------------------
  39.   def terminate
  40.     super
  41.     dispose_menu_background
  42.     @viewport.dispose
  43.     @help_window.dispose
  44.     @item_window.dispose
  45.     @target_window.dispose
  46.     @item_command_window.dispose
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 回到原画面
  50.   #--------------------------------------------------------------------------
  51.   def return_scene
  52.     $scene = Scene_Menu.new(0)
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● 更新画面
  56.   #--------------------------------------------------------------------------
  57.   def update
  58.     super
  59.     update_menu_background
  60.     @help_window.update
  61.     @item_window.update
  62.     @target_window.update
  63.     @item_command_window.update
  64.     if @item_window.active
  65.       update_item_selection
  66.     elsif @target_window.active
  67.       update_target_selection
  68.     elsif @item_command_window.active
  69.       update_item_command_selection
  70.     end
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 更新物品选择
  74.   #--------------------------------------------------------------------------
  75.   def update_item_selection
  76.     if Input.trigger?(Input::B)
  77.       Sound.play_cancel
  78.       return_scene
  79.     elsif Input.trigger?(Input::C)
  80.       Sound.play_decision
  81.       @item_window.active = false
  82.       @item_command_window.active = true
  83.       @item_command_window.visible = true
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # ● 更新物品选择
  88.   #--------------------------------------------------------------------------
  89.   def update_item_command_selection
  90.     if Input.trigger?(Input::B)
  91.       @item_command_window.active = false
  92.       @item_command_window.visible = false
  93.       @item_window.active = true
  94.       Sound.play_cancel
  95.     elsif Input.trigger?(Input::C)
  96.       case @item_command_window.index
  97.       when 0 # 使用
  98.         @item = @item_window.item
  99.         if @item != nil
  100.           $game_party.last_item_id = @item.id
  101.         end
  102.         if $game_party.item_can_use?(@item)
  103.           Sound.play_decision
  104.           determine_item
  105.         else
  106.           Sound.play_buzzer
  107.         end
  108.       when 1 # 丢弃
  109.         @item = @item_window.item
  110.         if @item == nil or @item.price == 0
  111.           Sound.play_buzzer
  112.         else
  113.           $game_party.lose_item(@item, 1)
  114.           Sound.play_decision
  115.           @item_window.refresh
  116.         end  
  117.       when 2 # 取消
  118.         @item_command_window.active = false
  119.         @item_command_window.visible = false
  120.         @item_window.active = true
  121.         Sound.play_cancel
  122.       end  
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 显示目标窗口
  127.   #     right : 靠又对齐标签(为false时则靠左)
  128.   #--------------------------------------------------------------------------
  129.   def show_target_window(right)
  130.     @item_command_window.active = false
  131.     width_remain = 544 - @target_window.width
  132.     @target_window.x = right ? width_remain : 0
  133.     @target_window.visible = true
  134.     @target_window.active = true
  135.     if right
  136.       @viewport.rect.set(0, 0, width_remain, 416)
  137.       @viewport.ox = 0
  138.     else
  139.       @viewport.rect.set(@target_window.width, 0, width_remain, 416)
  140.       @viewport.ox = @target_window.width
  141.     end
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 隐藏目标窗口
  145.   #--------------------------------------------------------------------------
  146.   def hide_target_window
  147.     if @item_command_window.visible
  148.       @item_command_window.active = true
  149.     else  
  150.       @item_window.active = true
  151.       @item_command_window.index = 0
  152.     end  
  153.     @target_window.visible = false
  154.     @target_window.active = false
  155.     @viewport.rect.set(0, 0, 544, 416)
  156.     @viewport.ox = 0
  157.   end
  158. end  
复制代码

点评

好东西收着再说,顶一下 O(∩_∩)O  发表于 2012-9-7 04:20

评分

参与人数 4星屑 +250 梦石 +2 收起 理由
吸血鬼之妻 + 10 感谢
Luciffer + 2 认可答案
八宝粥先生 + 40 万岁!
明特·布兰马修 + 200 认可答案

查看全部评分

《逝去的回忆3:四叶草之梦》真情发布,欢迎点击图片下载试玩喵。

《逝去的回忆3》的讨论群:
一群:192885514
二群:200460747
回复

使用道具 举报

梦石
0
星屑
50
在线时间
15 小时
注册时间
2013-7-15
回帖
6
发表于 2013-11-18 13:49:04 | 显示全部楼层
第17行发生 TrpeError superclass mismatch for class Scene_Item

评分

参与人数 1星屑 -20 收起 理由
铃仙·优昙华院·因幡 -20 收取挖坟工具租借费用.

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部