Project1

标题: 求助一個外國光標腳本問題 [打印本页]

作者: nanag    时间: 2015-5-12 22:37
标题: 求助一個外國光標腳本問題
你們好
我找到一個腳本能在菜單里的選項前加上一個ICON*圖一紅圈,就是白色三角形. 但是在事件里制作的選項沒有出現*圖二紅圈
可不可以幫我看看腳本,那麼出了問題?
或者有沒有別的方法呢?
謝謝





RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Menu Cursor v1.00
  4. # -- Last Updated: 2012.01.16
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-MenuCursor"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.16 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script creates visible menu cursors for your game. Whenever a window is
  22. # selectable and active, the menu cursor will appear for it. Menu cursors catch
  23. # the player's attention better and helps the player figure out quickly which
  24. # window became the active window. Also included with this script is the
  25. # ability to disable the highlighted selection bar since the window menu cursor
  26. # can replace it.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. # Make sure you have a cursor image within your project's Graphics\System\
  35. # folder. By default, the cursor's filename should be MenuCursor.
  36. #
  37. #==============================================================================
  38. # ▼ Compatibility
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  41. # it will run with RPG Maker VX without adjusting.
  42. #
  43. #==============================================================================
  44.  
  45. module YEA
  46.   module MENU_CURSOR
  47.  
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.     # - General Settings -
  50.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  51.     # Adjust the general settings here for the menu cursor, such as the
  52.     # filename used for the menu cursor, the x position buffer and the y
  53.     # position buffer for the cursor.
  54.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  55.     FILENAME = "MenuCursor"     # Filename used for cursor in Graphics\System\
  56.     BUFFER_X = 10               # X position buffer for icon.
  57.     BUFFER_Y = 16               # Y position buffer for icon.
  58.  
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.     # - Remove Highlighted Selection Bar -
  61.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  62.     # Normally, when an entry is selected, that entry is highlighted. You can
  63.     # opt to turn this effect off.
  64.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65.     REMOVE_HIGHLIGHTED_SELECTION_BAR = false
  66.  
  67.   end # MENU_CURSOR
  68. end # YEA
  69.  
  70. #==============================================================================
  71. # ▼ Editting anything past this point may potentially result in causing
  72. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  73. # halitosis so edit at your own risk.
  74. #==============================================================================
  75.  
  76. #==============================================================================
  77. # ■ Sprite_MenuCursor
  78. #==============================================================================
  79.  
  80. class Sprite_MenuCursor < Sprite_Base
  81.  
  82.   #--------------------------------------------------------------------------
  83.   # initialize
  84.   #--------------------------------------------------------------------------
  85.   def initialize(window)
  86.     super(window.viewport)
  87.     @window = window
  88.     create_bitmap
  89.   end
  90.  
  91.   #--------------------------------------------------------------------------
  92.   # create_bitmap
  93.   #--------------------------------------------------------------------------
  94.   def create_bitmap
  95.     self.bitmap = Cache.system(YEA::MENU_CURSOR::FILENAME)
  96.     self.z = @window.z + 201
  97.     self.opacity = 0
  98.   end
  99.  
  100.   #--------------------------------------------------------------------------
  101.   # update
  102.   #--------------------------------------------------------------------------
  103.   def update
  104.     super
  105.     update_visibility
  106.     update_position
  107.   end
  108.  
  109.   #--------------------------------------------------------------------------
  110.   # update_visibility
  111.   #--------------------------------------------------------------------------
  112.   def update_visibility
  113.     self.visible = visible_case
  114.     self.opacity += opacity_rate
  115.   end
  116.  
  117.   #--------------------------------------------------------------------------
  118.   # visible_case
  119.   #--------------------------------------------------------------------------
  120.   def visible_case
  121.     return @window.visible
  122.   end
  123.  
  124.   #--------------------------------------------------------------------------
  125.   # opacity_rate
  126.   #--------------------------------------------------------------------------
  127.   def opacity_rate
  128.     rate = 16
  129.     return -rate unless @window.active
  130.     return rate
  131.   end
  132.  
  133.   #--------------------------------------------------------------------------
  134.   # update_position
  135.   #--------------------------------------------------------------------------
  136.   def update_position
  137.     rect = @window.cursor_rect
  138.     self.x = @window.x + rect.x - @window.ox + YEA::MENU_CURSOR::BUFFER_X
  139.     self.y = @window.y + rect.y - @window.oy + YEA::MENU_CURSOR::BUFFER_Y
  140.   end
  141.  
  142. end # Sprite_MenuCursor
  143.  
  144. #==============================================================================
  145. # ■ Window
  146. #==============================================================================
  147.  
  148. class Window
  149.  
  150.   #--------------------------------------------------------------------------
  151.   # alias method: windowskin=
  152.   #--------------------------------------------------------------------------
  153.   alias window_windowskin_change_cursor windowskin=
  154.   def windowskin=(skin)
  155.     if YEA::MENU_CURSOR::REMOVE_HIGHLIGHTED_SELECTION_BAR
  156.       skin = skin.dup
  157.       skin.clear_rect(64, 64, 32, 32)
  158.     end
  159.     window_windowskin_change_cursor(skin)
  160.   end
  161.  
  162. end # Window
  163.  
  164. #==============================================================================
  165. # ■ Scene_Base
  166. #==============================================================================
  167.  
  168. class Scene_Base
  169.  
  170.   #--------------------------------------------------------------------------
  171.   # alias method: post_start
  172.   #--------------------------------------------------------------------------
  173.   alias scene_base_post_start_cursor post_start
  174.   def post_start
  175.     create_menu_cursors
  176.     scene_base_post_start_cursor
  177.   end
  178.  
  179.   #--------------------------------------------------------------------------
  180.   # new method: create_menu_cursors
  181.   #--------------------------------------------------------------------------
  182.   def create_menu_cursors
  183.     @menu_cursors = []
  184.     instance_variables.each do |varname|
  185.       ivar = instance_variable_get(varname)
  186.       create_cursor_sprite(ivar) if ivar.is_a?(Window_Selectable)
  187.     end
  188.   end
  189.  
  190.   #--------------------------------------------------------------------------
  191.   # new method: create_cursor_sprite
  192.   #--------------------------------------------------------------------------
  193.   def create_cursor_sprite(window)
  194.     @menu_cursors.push(Sprite_MenuCursor.new(window))
  195.   end
  196.  
  197.   #--------------------------------------------------------------------------
  198.   # alias method: pre_terminate
  199.   #--------------------------------------------------------------------------
  200.   alias scene_base_pre_terminate_cursor pre_terminate
  201.   def pre_terminate
  202.     dispose_menu_cursors
  203.     scene_base_pre_terminate_cursor
  204.   end
  205.  
  206.   #--------------------------------------------------------------------------
  207.   # new method: dispose_menu_cursors
  208.   #--------------------------------------------------------------------------
  209.   def dispose_menu_cursors
  210.     @menu_cursors.each { |cursor| cursor.dispose }
  211.   end
  212.  
  213.   #--------------------------------------------------------------------------
  214.   # alias method: update_basic
  215.   #--------------------------------------------------------------------------
  216.   alias scene_base_update_basic_cursor update_basic
  217.   def update_basic
  218.     scene_base_update_basic_cursor
  219.     update_menu_cursors
  220.   end
  221.  
  222.   #--------------------------------------------------------------------------
  223.   # new method: update_menu_cursors
  224.   #--------------------------------------------------------------------------
  225.   def update_menu_cursors
  226.     @menu_cursors.each { |cursor| cursor.update }
  227.   end
  228.  
  229. end # Scene_Base
  230.  
  231. #==============================================================================
  232. #
  233. # ▼ End of File
  234. #
  235. #==============================================================================

作者: VIPArcher    时间: 2015-5-12 23:00
加入这段补丁试试
  1. # VIPArcher 不负责任的修改
  2. class Scene_Map < Scene_Base
  3.   alias vip20150512_create_menu_cursors create_menu_cursors
  4.   def create_menu_cursors
  5.     vip20150512_create_menu_cursors
  6.     window = @message_window.instance_variable_get(:@choice_window)
  7.     create_cursor_sprite(window)
  8.   end
  9. end
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1