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

Project1

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

[已经解决] 物品得失脚本是否能不暂停

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1428
在线时间
1705 小时
注册时间
2011-8-17
帖子
818
跳转到指定楼层
1
发表于 2014-9-16 17:37:09 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
因为在做的游戏获取道具的频率非常高,如果一直弹这个会很浪费时间也很影响游戏体验,而如果不提示的话显然也不好,不知大神们能否帮忙改成不会暂停游戏只是弹出来能看到就行了?

下面贴脚本供大神研究
  1. #==============================================================================
  2. # ☆ HAR - 得失物品脚本 (v1.01a)
  3. # 日期:2012/09/23
  4. #==============================================================================
  5. # -- 作者:    Harinlen
  6. # -- 等级:    普通级
  7. # -- 依赖关系:  无
  8. # -- 适用范围:  RPG Maker VX Ace
  9. # -- 不兼容脚本: 暂无
  10. #==============================================================================
  11. # ☆ 声明
  12. # 此脚本参考了[PS0]双默认脚本的长度测量函数。
  13. #==============================================================================
  14. # ☆ 脚本使用说明
  15. # 此脚本无需额外代码即可使用,使用事件调用增减金钱、增减武器、增减防具和增减物品的
  16. # 时候会显示一个对话框显示得失物品情况。
  17. #
  18. # ☆ 脚本的启用
  19. # 修改对应等号后面对应的数值为对应的开关序号,在事件中直接对开关进行判定即可:
  20. #
  21. # $window_tips_gold = 10        #金钱窗口提示的开关
  22. # $window_tips_item = 11        #物品窗口提示的开关
  23. # $window_tips_weapon = 12      #武器窗口提示的开关
  24. # $window_tips_armor = 13       #防具窗口提示的开关
  25. #
  26. # ☆ 脚本的自定义
  27. # 请修改下方的音效设定部分,将对应的音效更改成自己想要的音效即可。
  28. # 音效名的获取请使用媒体库进行查看。只能使用SE中的音效。
  29. #==============================================================================

  30. #==============================================================================
  31. # ■ 提示开关定义
  32. #------------------------------------------------------------------------------
  33. #  用于定义是否显示Window
  34. #==============================================================================
  35. $window_tips_gold = 10
  36. $window_tips_item = 11
  37. $window_tips_weapon = 12
  38. $window_tips_armor = 13

  39. #==============================================================================
  40. # ■ 音效设定
  41. #------------------------------------------------------------------------------
  42. #  设定对应的音效播放效果
  43. #==============================================================================
  44. $SE_Gold_Gain   = "Shop"      # 获得金钱声效
  45. $SE_Gold_Loss   = "Blow2"     # 失去金钱声效

  46. $SE_Item_Gain   = "Item1"     # 获得物品声效
  47. $SE_Item_Loss   = "Blow2"     # 失去物品声效

  48. $SE_Weapon_Gain = "Item1"     # 获得武器声效
  49. $SE_Weapon_Loss = "Blow2"     # 失去武器声效

  50. $SE_Armor_Gain  = "Item1"     # 获得防具声效
  51. $SE_Armor_Loss  = "Blow2"     # 失去防具声效
  52. #==============================================================================
  53. # ■ Window_Tips
  54. #------------------------------------------------------------------------------
  55. #  显示增减物品、金钱和装备的窗口
  56. #==============================================================================

  57. class Window_Tips < Window_Base
  58.   #--------------------------------------------------------------------------
  59.   # ● 初始化对象
  60.   #--------------------------------------------------------------------------
  61.   def initialize(x = 170, y = 128, width = 300, height = 96)
  62.     super
  63.   end
  64.   
  65.   #--------------------------------------------------------------------------
  66.   # ● 增强绘制物品名称
  67.   #--------------------------------------------------------------------------
  68.   def adv_draw_item_name(item, x, y)
  69.     return unless item
  70.     draw_icon(item.icon_index, x, y, true)
  71.     change_color(normal_color, true)
  72.     draw_text(x + 24, y, width, line_height, item.name)
  73.   end
  74.   
  75. end

  76. class Game_Interpreter
  77.   
  78.   #--------------------------------------------------------------------------
  79.   # ● 增减金钱
  80.   #--------------------------------------------------------------------------
  81.   def command_125
  82.     value = operate_value(@params[0], @params[1], @params[2])
  83.     $game_party.gain_gold(value)
  84.     if $game_switches[$window_tips_gold] == true
  85.       show_tips_window(0, value)
  86.     end
  87.     return true
  88.   end
  89.   
  90.   #--------------------------------------------------------------------------
  91.   # ● 增减物品
  92.   #--------------------------------------------------------------------------
  93.   def command_126
  94.     value = operate_value(@params[1], @params[2], @params[3])
  95.     $game_party.gain_item($data_items[@params[0]], value)
  96.     if $game_switches[$window_tips_item] == true
  97.       show_tips_window(1, value)
  98.     end
  99.     $game_map.need_refresh = true
  100.     return true
  101.   end
  102.   
  103.   #--------------------------------------------------------------------------
  104.   # ● 增减武器
  105.   #--------------------------------------------------------------------------
  106.   def command_127
  107.     value = operate_value(@params[1], @params[2], @params[3])
  108.     $game_party.gain_item($data_weapons[@params[0]], value, @params[4])
  109.     if $game_switches[$window_tips_weapon] == true
  110.       show_tips_window(2, value)
  111.     end
  112.     return true
  113.   end
  114.   
  115.   #--------------------------------------------------------------------------
  116.   # ● 增减防具
  117.   #--------------------------------------------------------------------------
  118.   def command_128
  119.     value = operate_value(@params[1], @params[2], @params[3])
  120.     $game_party.gain_item($data_armors[@params[0]], value, @params[4])
  121.     if $game_switches[$window_tips_armor] == true
  122.       show_tips_window(3, value)
  123.     end
  124.     return true
  125.   end
  126.   
  127.   #--------------------------------------------------------------------------
  128.   # ● 显示增减提示窗口
  129.   #--------------------------------------------------------------------------
  130.   def show_tips_window(type, value)
  131.     case type
  132.       when 0
  133.         item_type = Vocab::currency_unit
  134.         if value >= 0
  135.           Audio.se_play("Audio/SE/" + $SE_Gold_Gain, 100, 100)
  136.         else
  137.           Audio.se_play("Audio/SE/" + "Item1", 100, 100)
  138.       end
  139.       when 1
  140.         item_type = Vocab::item
  141.         processed_items = $data_items[@params[0]]
  142.         if value >= 0
  143.           Audio.se_play("Audio/SE/" + $SE_Item_Gain, 100, 100)
  144.         else
  145.           Audio.se_play("Audio/SE/" + $SE_Item_Loss, 100, 100)
  146.       end
  147.       when 2
  148.         item_type = Vocab::weapon
  149.         processed_items = $data_weapons[@params[0]]
  150.         if value >= 0
  151.           Audio.se_play("Audio/SE/" + $SE_Weapon_Gain, 100, 100)
  152.         else
  153.           Audio.se_play("Audio/SE/" + $SE_Weapon_Loss, 100, 100)
  154.       end
  155.       when 3
  156.         item_type = Vocab::armor
  157.         processed_items = $data_armors[@params[0]]
  158.         if value >= 0
  159.           Audio.se_play("Audio/SE/" + $SE_Armor_Gain, 100, 100)
  160.         else
  161.           Audio.se_play("Audio/SE/" + $SE_Armor_Loss, 100, 100)
  162.       end
  163.     end
  164.   
  165.     if value >= 0
  166.       tips_processed_text = "获得"   
  167.     else
  168.       tips_processed_text = "失去"
  169.     end
  170.    
  171.     if type != 0
  172.       text_value = "×" + value.abs.to_s
  173.       bitmap = Bitmap.new(100, 100)
  174.       itemwidth = bitmap.text_size(processed_items.name).width + 95
  175.       valuewidth = bitmap.text_size(text_value).width
  176.       itempop_window = Window_Tips.new((544 - itemwidth - valuewidth) / 2, 128, itemwidth + valuewidth, 88)
  177.       itempop_window.contents = Bitmap.new(itempop_window.width - 32, itempop_window.height - 32)
  178.       
  179.       itempop_window.contents.draw_text(0, 0, 160, 32, tips_processed_text + item_type+":")
  180.       itempop_window.adv_draw_item_name(processed_items, 28, 32)
  181.       itempop_window.contents.draw_text(0, 30, itemwidth, 32, "×" + value.abs.to_s, 2)
  182.     else
  183.       text_value = value.abs.to_s + " " + Vocab::currency_unit
  184.       bitmap = Bitmap.new(100, 100)
  185.       textwidth = bitmap.text_size(text_value).width + 95
  186.       itempop_window = Window_Tips.new(170, 128, textwidth, 88)
  187.       itempop_window.contents = Bitmap.new(itempop_window.width - 32, itempop_window.height - 32)
  188.       
  189.       itempop_window.contents.draw_text(0, 0, 160, 32, tips_processed_text + item_type+":")
  190.       itempop_window.contents.draw_text(32, 32, 240, 32, value.abs.to_s + "  " + Vocab::currency_unit)
  191.     end
  192.    
  193.     for i in 0..60
  194.       Graphics.update
  195.     end
  196.     for i in 0..10
  197.       itempop_window.opacity -= 30
  198.       itempop_window.contents_opacity -= 30
  199.       Graphics.update
  200.     end
  201.     itempop_window.dispose
  202.    
  203.     for i in 0..3
  204.       Graphics.update
  205.     end
  206.   end
  207. end
复制代码
roguelike求生RPG研发中....

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

2
发表于 2014-9-16 17:42:41 | 只看该作者
本帖最后由 taroxd 于 2014-9-16 17:47 编辑

就这个脚本而言,不行。因为脚本作者比较偷懒,是将窗口以及等待都放在 Game_Interpreter 里面进行了。事实上我不喜欢这种风格。

我也写过一个类似的脚本,但是也并没有把窗口的更新与游戏的进行分离,只是自动在获取物品后加入一个[显示文字]指令而已。因此这个提示可以用确定键跳过,可以稍微加快一些节奏,但仍然做不到楼主想要的游戏与提示并行处理的功能。

如果要完成楼主所说的功能,在场景中新添一个窗口,并在事件指令中与场景进行交互,控制这个窗口的显示与否及其内容会比较好吧。这样的话,窗口的坐标、透明度、风格也都会更加易于控制和管理。

And finally, 不要问我具体怎么做



话说……Glimmer 系列的第一款游戏里的效果似乎挺符合楼主的要求的……?
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
22713
在线时间
8623 小时
注册时间
2011-12-31
帖子
3367
3
发表于 2014-9-16 17:48:15 | 只看该作者
換這個




# ● メッセージ表示の強制停止(全停止)
# stop_msg
#   ※強制停止中は解除されるまで簡易メッセージ表示を行いません。
#     強制停止中にshow_msgが実行された場合はrestart_msg実行まで待たされます
#------------------------------------------------------------------------------
# ● メッセージ表示の強制停止解除
# restart_msg
  1. #==============================================================================
  2. # ■ VXAce-RGSS3-41 簡易メッセージ [Ver.1.1.0]            by Claimh
  3. #------------------------------------------------------------------------------
  4. #   マップ上に簡易メッセージを表示します。
  5. #------------------------------------------------------------------------------
  6. # ● 簡易メッセージ表示実行(push型)
  7. # show_msg(type, msg, num)
  8. #   [argument]
  9. #    type  :項目番号
  10. #               0  .. msgの内容を表示(制御文字も使用可能)
  11. #               1  .. アイテムを入手(msgにアイテムID、numに個数を指定)
  12. #               2  .. 武器を入手(msgに武器ID、numに個数を指定)
  13. #               3  .. 防具を入手(msgに防具ID、numに個数を指定)
  14. #               4  .. スキルを習得(msgにスキルID, numにアクターIDを指定)
  15. #               5  .. レベルアップ(msgにアクターIDを指定)
  16. #               6  .. 加入(msgにアクターIDを指定)
  17. #               7  .. 離脱(msgにアクターIDを指定)
  18. #               8  .. お金を入手(msgに金額を入れる)
  19. #               20 .. クエスト開始(msgにIDを指定) ※「クエストシステム」必須
  20. #               21 .. クエスト完了(msgにIDを指定) ※「クエストシステム」必須
  21. #               22 .. 用語登録(msgにカテゴリ、numに用語IDを指定)※「用語辞典」必須
  22. #    msg   :表示文字、ID情報(アイテム等)など
  23. #    num   :個数(省略可能)
  24. #   [note]
  25. #    画面にいっぱいまで表示されている場合、表示が消えるまで遅延します。
  26. #------------------------------------------------------------------------------
  27. # ● メッセージ表示の強制停止(全停止)
  28. # stop_msg
  29. #   ※強制停止中は解除されるまで簡易メッセージ表示を行いません。
  30. #     強制停止中にshow_msgが実行された場合はrestart_msg実行まで待たされます
  31. #------------------------------------------------------------------------------
  32. # ● メッセージ表示の強制停止解除
  33. # restart_msg
  34. #------------------------------------------------------------------------------
  35. # ● 簡易メッセージ表示実行(refresh型)
  36. # draw_msg(type, msg, num)  
  37. #   [argument]  push型と同じ
  38. #   [note]      表示中メッセージを消去してから表示します。
  39. #------------------------------------------------------------------------------
  40. # ● 表示状態取得
  41. # msg_state
  42. #   [return]    true : 表示中, false : 表示なし
  43. #   [exsample]  draw_msg(type, msg, num) unless msg_state
  44. #==============================================================================

  45. module ShtMsg
  46.   # スキンタイプ
  47.   #    0 .. ウィンドウ
  48.   #    1 .. 半透明ブラックボックス
  49.   #    2 .. ピクチャ
  50.   SKIN = 1
  51.   # ウィンドウ背景の不透明度
  52.   OPACITY = 160
  53.   # ピクチャファイル(Graphics/System)
  54.   PICT = "msg_skin"

  55.   # メッセージ矩形サイズ(x,yは未参照)
  56.   RECT = Rect.new(0, 0, 160, 20)
  57.   # 表示矩形(x,widthは未参照。yは最初のy位置, heightは表示する範囲)
  58.   VIEW = Rect.new(0, Graphics.height * 2 / 3, 0, Graphics.height / 3) # 下のほう
  59. #~   VIEW = Rect.new(0, 0, 0, Graphics.height / 3)  # 上のほう
  60.   # 表示位置(高さ)のずらし幅
  61.   OFST = 0
  62.   
  63.   # スライドイン方向(true:左端から / false:右端から)
  64.   SLD_DIR = false
  65.   # スライド時間
  66.   SLD_FRM = 8
  67.   # 表示ウェイト時間
  68.   WAIT = 100

  69.   # 固有名の着色(色index)   0..normal_color
  70.   COLOR = 2
  71.   # フォントサイズ
  72.   FSZ = 14
  73.   # 文字描画開始X位置
  74.   STX = 4

  75.   # SE音(鳴らさない場合はnilにする)
  76.   SE = RPG::SE.new("Chime2")

  77.   # メッセージ表示と同時に本処理(アイテム入手等)を実行する
  78.   EXE = false
  79. end



  80. #==============================================================================
  81. # ■ Game_Interpreter
  82. #==============================================================================
  83. class Game_Interpreter
  84.   #--------------------------------------------------------------------------
  85.   # ● 簡易メッセージ表示(push型)
  86.   #     type  : 項目番号
  87.   #     msg   : メッセージ
  88.   #     num   : 個数(省略可能)
  89.   #--------------------------------------------------------------------------
  90.   def show_msg(type, msg, num=0)
  91.     if SceneManager.scene_is?(Scene_Map)
  92.       SceneManager.scene.show_msg(type, msg, num)
  93.     end
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 簡易メッセージ表示(refresh型)
  97.   #     type  : 項目番号
  98.   #     msg   : メッセージ
  99.   #     num   : 個数(省略可能)
  100.   #--------------------------------------------------------------------------
  101.   def draw_msg(type, msg, num=0)
  102.     if SceneManager.scene_is?(Scene_Map)
  103.       SceneManager.scene.draw_msg(type, msg, num)
  104.     end
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 簡易メッセージの強制停止
  108.   #--------------------------------------------------------------------------
  109.   def stop_msg
  110.     if SceneManager.scene_is?(Scene_Map)
  111.       SceneManager.scene.stop_msg
  112.     end
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 簡易メッセージの強制停止解除
  116.   #--------------------------------------------------------------------------
  117.   def restart_msg
  118.     if SceneManager.scene_is?(Scene_Map)
  119.       SceneManager.scene.restart
  120.     end
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 簡易メッセージの状態取得
  124.   #--------------------------------------------------------------------------
  125.   def msg_state
  126.     if SceneManager.scene_is?(Scene_Map)
  127.       return SceneManager.scene.msg_state
  128.     end
  129.     false
  130.   end
  131. end


  132. #==============================================================================
  133. # ■ ShtMsg::Messenger
  134. #==============================================================================
  135. class ShtMsg::Messenger
  136.   #--------------------------------------------------------------------------
  137.   # ● オブジェクト初期化
  138.   #--------------------------------------------------------------------------
  139.   def initialize(type, msg, num)
  140.     @type = type; @msg = msg; @num = num
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 簡易メッセージ表示内容
  144.   #--------------------------------------------------------------------------
  145.   def text
  146.     exe if ShtMsg::EXE
  147.     c = ShtMsg::COLOR
  148.     n = @num > 1 ? "#{@num}個" : ""
  149.     case @type
  150.     when 0;  return @msg
  151.     when 1;  return "\\C[#{c}]#{$data_items[@msg].name}\\C[0]を#{n}入手"
  152.     when 2;  return "\\C[#{c}]#{$data_weapons[@msg].name}\\C[0]を#{n}入手"
  153.     when 3;  return "\\C[#{c}]#{$data_armors[@msg].name}\\C[0]を#{n}入手"
  154.     when 4;  return "\\C[#{c}]#{$data_skills[@msg].name}\\C[0]を習得"
  155.     when 5;  return "\\C[#{c}]#{$game_actors[@msg].name}\\C[0]がレベルアップ"
  156.     when 6;  return "\\C[#{c}]#{$game_actors[@msg].name}\\C[0]が仲間になった"
  157.     when 7;  return "\\C[#{c}]#{$game_actors[@msg].name}\\C[0]が離脱した…"
  158.     when 8;  return "\\C[#{c}]#{@msg}#{Vocab::currency_unit}\\C[0]入手"
  159.     when 20; return "『\\C[#{c}]#{$game_system.quest[@msg].name}\\C[0]』開始"
  160.     when 21; return "『\\C[#{c}]#{$game_system.quest[@msg].name}\\C[0]』クリア"
  161.     when 22; return "新語『\\C[#{c}]#{$game_system.dictionary[@msg][@num].name}\\C[0]』"
  162.     end
  163.     return "type error<#{@type},#{@msg}>"
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 本処理実行
  167.   #--------------------------------------------------------------------------
  168.   def exe
  169.     case @type
  170.     when 1;  $game_party.gain_item($data_items[@msg], @num) if @num > 0
  171.     when 2;  $game_party.gain_item($data_weapons[@msg], @num) if @num > 0
  172.     when 3;  $game_party.gain_item($data_armors[@msg], @num) if @num > 0
  173.     when 4;  $game_actors[@num].learn_skill(@msg) if @num > 0
  174.     when 5;  $game_actors[@msg].level_up
  175.     when 6;  $game_party.add_actor(@msg)
  176.     when 7;  $game_party.remove_actor(@msg)
  177.     when 8;  $game_party.gain_gold(@msg)
  178.     when 20; $game_system.quest[@msg].quest_start
  179.     when 21; $game_system.quest[@msg].quest_clear
  180.     when 22; $game_system.dictionary[@msg][@num].show_flg = true if @num > 0
  181.     end
  182.   end
  183. end

  184. #==============================================================================
  185. # ■ Sprite_ShrtMsgrBack
  186. #==============================================================================
  187. class Sprite_ShrtMsgrBack < Sprite
  188.   #--------------------------------------------------------------------------
  189.   # ● オブジェクト初期化
  190.   #--------------------------------------------------------------------------
  191.   def initialize(x, y, z, bitmap)
  192.     super(nil)
  193.     self.bitmap = bitmap
  194.     self.x = x; self.y = y; self.z = z
  195.   end
  196. end

  197. #==============================================================================
  198. # ■ Window_ShrtMsgr
  199. #==============================================================================
  200. class Window_ShrtMsgr < Window_Base
  201.   #--------------------------------------------------------------------------
  202.   # ● オブジェクト初期化
  203.   #--------------------------------------------------------------------------
  204.   def initialize(msg, x, y, back)
  205.     @count = 0
  206.     @phase = 0
  207.     super(x, y, ShtMsg::RECT.width, fitting_height(1))
  208.     self.opacity = 0
  209.     self.back_opacity = ShtMsg::OPACITY
  210.     @sprite = Sprite_ShrtMsgrBack.new(x, y+4, z-1, back) if ShtMsg::SKIN != 0
  211.     refresh(msg)
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● 解放
  215.   #--------------------------------------------------------------------------
  216.   def dispose
  217.     @sprite.dispose if ShtMsg::SKIN != 0
  218.     super
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ● X位置の設定
  222.   #--------------------------------------------------------------------------
  223.   def x=(x)
  224.     super(x)
  225.     @sprite.x = x if ShtMsg::SKIN != 0
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● Y位置の設定
  229.   #--------------------------------------------------------------------------
  230.   def y=(y)
  231.     super(y)
  232.     @sprite.y = y if ShtMsg::SKIN != 0
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 行の高さを取得
  236.   #--------------------------------------------------------------------------
  237.   def line_height
  238.     ShtMsg::RECT.height
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 標準パディングサイズの取得
  242.   #--------------------------------------------------------------------------
  243.   def standard_padding
  244.     return 4
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● フォント設定のリセット
  248.   #--------------------------------------------------------------------------
  249.   def reset_font_settings
  250.     change_color(normal_color)
  251.     contents.font.size = ShtMsg::FSZ
  252.     contents.font.bold = false
  253.     contents.font.italic = false
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● リフレッシュ
  257.   #--------------------------------------------------------------------------
  258.   def refresh(msg)
  259.     contents.clear
  260.     draw_text_ex(ShtMsg::STX, 0, msg.text)
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 簡易メッセージの強制停止
  264.   #--------------------------------------------------------------------------
  265.   def stop
  266.     update_phase while @phase == 0
  267.     @count = ShtMsg::WAIT / 2
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● フレーム更新
  271.   #--------------------------------------------------------------------------
  272.   def update
  273.     return if self.disposed?
  274.     super
  275.     update_phase
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● フレーム更新
  279.   #--------------------------------------------------------------------------
  280.   def update_phase
  281.     case @phase
  282.     when 0
  283.       @phase += 1 if update_slidein and update_fadein
  284.     when 1
  285.       @phase += 1 if (@count += 1) >= ShtMsg::WAIT
  286.     when 2
  287.       dispose if update_slideout and update_fadeout
  288.     end
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● フレーム更新 : スライドイン
  292.   #--------------------------------------------------------------------------
  293.   def update_slidein
  294.     w = ShtMsg::RECT.width / ShtMsg::SLD_FRM
  295.     if ShtMsg::SLD_DIR
  296.       return true if self.x >= 0
  297.       self.x += w
  298.       self.x = 0 if self.x >= 0
  299.     else
  300.       xx = Graphics.width - ShtMsg::RECT.width
  301.       return true if self.x <= xx
  302.       self.x -= w
  303.       self.x = xx if self.x <= xx
  304.     end
  305.     return false
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● フレーム更新 : スライドアウト
  309.   #--------------------------------------------------------------------------
  310.   def update_slideout
  311.     w = ShtMsg::RECT.width / ShtMsg::SLD_FRM
  312.     if ShtMsg::SLD_DIR
  313.       xx = 0 - ShtMsg::RECT.width
  314.       return true if self.x <= xx
  315.       self.x -= w
  316.       self.x = xx if self.x <= xx
  317.     else
  318.       return true if self.x >= Graphics.width
  319.       self.x += w
  320.       self.x = Graphics.width if self.x >= Graphics.width
  321.     end
  322.     return false
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● フレーム更新 : フェードイン
  326.   #--------------------------------------------------------------------------
  327.   def update_fadein
  328.     op = 255 / ShtMsg::SLD_FRM
  329.     wp = ShtMsg::OPACITY / ShtMsg::SLD_FRM
  330.     if ShtMsg::SKIN == 0
  331.       return true if self.opacity = 255
  332.       self.opacity += op
  333.       self.opacity = 255 if self.opacity >= 255
  334.     else
  335.       return true
  336.     end
  337.     return false
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● フレーム更新 : フェードアウト
  341.   #--------------------------------------------------------------------------
  342.   def update_fadeout
  343.     op = 255 / ShtMsg::SLD_FRM
  344.     wp = ShtMsg::OPACITY / ShtMsg::SLD_FRM
  345.     if ShtMsg::SKIN == 0
  346.       return true if self.opacity = 0 and self.back_opacity == 0 and self.contents_opacity == 0
  347.       self.opacity -= op
  348.       self.back_opacity -= wp
  349.       self.contents_opacity -= op
  350.       self.opacity = 0 if self.opacity <= 0
  351.       self.back_opacity = 0 if self.back_opacity <= 0
  352.       self.contents_opacity = 0 if self.contents_opacity <= 0
  353.     else
  354.       return true if self.contents_opacity == 0 and @sprite.opacity == 0
  355.       self.contents_opacity -= op
  356.       @sprite.opacity -= wp
  357.       self.contents_opacity = 0 if self.contents_opacity <= 0
  358.       @sprite.opacity = 0 if @sprite.opacity <= 0
  359.     end
  360.     return false
  361.   end
  362. end

  363. #==============================================================================
  364. # ■ ShtMsg::MsgManager
  365. #==============================================================================
  366. class ShtMsg::MsgManager
  367.   #--------------------------------------------------------------------------
  368.   # ● オブジェクト初期化
  369.   #--------------------------------------------------------------------------
  370.   def initialize
  371.     @msg = []
  372.     [url=home.php?mod=space&uid=33409]@Stk[/url] = []
  373.     [url=home.php?mod=space&uid=76426]@stop[/url] = false
  374.     create_back_bitmap
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 解放
  378.   #--------------------------------------------------------------------------
  379.   def dispose
  380.     @msg.each {|m| m.dispose}
  381.     @bitmap.dispose if ShtMsg::SKIN == 1
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # ● 背景ビットマップの作成
  385.   #--------------------------------------------------------------------------
  386.   def create_back_bitmap
  387.     case ShtMsg::SKIN
  388.     when 1
  389.       width  = ShtMsg::RECT.width
  390.       height = ShtMsg::RECT.height
  391.       @bitmap = Bitmap.new(width, height)
  392.       rect1 = Rect.new(0, 0, width, 4)
  393.       rect2 = Rect.new(0, 4, width, height - 8)
  394.       rect3 = Rect.new(0, height - 4, width, 4)
  395.       @bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
  396.       @bitmap.fill_rect(rect2, back_color1)
  397.       @bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  398.     when 2
  399.       @bitmap = Cache.system(ShtMsg::PICT)
  400.     end
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # ● 背景色 1 の取得
  404.   #--------------------------------------------------------------------------
  405.   def back_color1
  406.     Color.new(0, 0, 0, 160)
  407.   end
  408.   #--------------------------------------------------------------------------
  409.   # ● 背景色 2 の取得
  410.   #--------------------------------------------------------------------------
  411.   def back_color2
  412.     Color.new(0, 0, 0, 0)
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 初期X位置
  416.   #--------------------------------------------------------------------------
  417.   def start_x
  418.     ShtMsg::SLD_DIR ? (0 - ShtMsg::RECT.width) : (Graphics.width)
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ● メッセージセットアップ
  422.   #--------------------------------------------------------------------------
  423.   def setup(type, msg, num=0)
  424.     search_y(ShtMsg::Messenger.new(type, msg, num))
  425.   end
  426.   #--------------------------------------------------------------------------
  427.   # ● メッセージRefresh
  428.   #--------------------------------------------------------------------------
  429.   def refresh(type, msg, num=0)
  430.     @msg.each {|m| m.dispose} # 表示中msgは消す
  431.     @msg = []
  432.     shift_stock # ストック分は押し出す
  433.     setup(type, msg, num)
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ● Y位置サーチ
  437.   #--------------------------------------------------------------------------
  438.   def search_y(msg)
  439.     y = ShtMsg::VIEW.y
  440.     loop do
  441.       break if @stop
  442.       if @msg.all? {|m| m.y != y }
  443.         push_msg(msg, y)  # 空き場所へ
  444.         return true
  445.       end
  446.       y += ShtMsg::RECT.height + ShtMsg::OFST
  447.       break if y > (ShtMsg::VIEW.y + ShtMsg::VIEW.height - ShtMsg::RECT.height)
  448.     end
  449.     @stk.push(msg)  # 空くまで保持
  450.     return false
  451.   end
  452.   #--------------------------------------------------------------------------
  453.   # ● メッセージ表示開始
  454.   #--------------------------------------------------------------------------
  455.   def push_msg(msg, y)
  456.     @msg.push(Window_ShrtMsgr.new(msg, start_x, y, @bitmap))
  457.     ShtMsg::SE.play unless ShtMsg::SE.nil?
  458.   end
  459.   #--------------------------------------------------------------------------
  460.   # ● ストックの再挿入
  461.   #--------------------------------------------------------------------------
  462.   def shift_stock
  463.     if [email protected]? # ストックある場合、空いたらmsg挿入
  464.       loop do
  465.         break unless search_y(@stk.shift)
  466.         break if @stk.empty?
  467.       end
  468.     end
  469.   end
  470.   #--------------------------------------------------------------------------
  471.   # ● フレーム更新
  472.   #--------------------------------------------------------------------------
  473.   def update
  474.     @msg = @msg.each {|m| m.update }.select {|m| !m.disposed? }
  475.     shift_stock unless @stop
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ● 簡易メッセージの強制停止
  479.   #--------------------------------------------------------------------------
  480.   def stop
  481.     @msg.each {|m| m.stop }
  482.     @stop = true
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ● 簡易メッセージの強制停止解除
  486.   #--------------------------------------------------------------------------
  487.   def restart
  488.     @stop = false
  489.     shift_stock
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # ● 簡易メッセージの状態取得
  493.   #--------------------------------------------------------------------------
  494.   def state
  495.     !(@msg.empty? and @stk.empty?)
  496.   end
  497. end


  498. #==============================================================================
  499. # ■ Scene_Map
  500. #==============================================================================
  501. class Scene_Map < Scene_Base
  502.   #--------------------------------------------------------------------------
  503.   # ● 開始処理
  504.   #--------------------------------------------------------------------------
  505.   alias start_shrtmsg start
  506.   def start
  507.     start_shrtmsg
  508.     @msgr = ShtMsg::MsgManager.new
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● 終了処理
  512.   #--------------------------------------------------------------------------
  513.   alias terminate_msg terminate
  514.   def terminate
  515.     terminate_msg
  516.     @msgr.dispose
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # ● 簡易メッセージ表示
  520.   #--------------------------------------------------------------------------
  521.   def show_msg(type, msg, num=0)
  522.     @msgr.setup(type, msg, num)
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● 簡易メッセージ表示
  526.   #--------------------------------------------------------------------------
  527.   def draw_msg(type, msg, num=0)
  528.     @msgr.refresh(type, msg, num)
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # ● 簡易メッセージの強制停止
  532.   #--------------------------------------------------------------------------
  533.   def stop_msg
  534.     @msgr.stop
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # ● 簡易メッセージの強制停止解除
  538.   #--------------------------------------------------------------------------
  539.   def restart
  540.     @msgr.restart
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # ● 簡易メッセージの状態取得
  544.   #--------------------------------------------------------------------------
  545.   def msg_state
  546.     @msgr.state
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # ● フレーム更新
  550.   #--------------------------------------------------------------------------
  551.   alias update_msg update
  552.   def update
  553.     update_msg
  554.     @msgr.update
  555.   end
  556. end
复制代码

点评

我也看了一遍,出来论坛BUG出现的瞎艾特以外,没找到command_xxx  发表于 2014-9-16 18:17
我記錯了,自動弾出不是這個  发表于 2014-9-16 18:13
基本是自動弾出,也可手動  发表于 2014-9-16 17:53
就我所见,这个脚本貌似并没有将弹出提示与事件指令相关联,而是要手工调用脚本的样子……  发表于 2014-9-16 17:51

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1428
在线时间
1705 小时
注册时间
2011-8-17
帖子
818
4
 楼主| 发表于 2014-9-16 19:40:06 | 只看该作者
tseyik 发表于 2014-9-16 17:48
換這個

额。。。怎么用啊,直接用得到东西没反应..看脚本..日语看不懂.........

点评

这个脚本没有自动提示的功能,只能手动在需要的部分设置信息提示。(相当于加入一个 显示文字 的功能)  发表于 2014-9-16 21:36
这个要手动设置的 事件脚本 show_msg(type, msg, num)其中参数的意思看上面脚本备注,看不懂就谷歌  发表于 2014-9-16 19:43
roguelike求生RPG研发中....
回复 支持 1 反对 0

使用道具 举报

Lv3.寻梦者

闇吼者の災悪眷族
不気味存在締造者

梦石
0
星屑
1366
在线时间
2881 小时
注册时间
2014-7-29
帖子
6491
5
发表于 2014-9-16 22:05:29 | 只看该作者
本帖最后由 三途亚梦 于 2014-9-16 22:11 编辑

我这里有一个在刚开始玩RM时从合集脚本中翻出来的

它是自动提示,并且不会暂停游戏。
效果比较好,
缺点是如果一次获得多种道具,那么只会提示最后获得的那一种。

脚本本体在折叠中

评分

参与人数 2星屑 +60 梦石 +1 收起 理由
黑舞嗜 + 60 虽然有缺陷但是依然很赞!
VIPArcher + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-26 01:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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