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

Project1

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

[已经解决] VX 求一个多功能全鼠标脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
62 小时
注册时间
2013-3-14
帖子
53
跳转到指定楼层
1
发表于 2013-6-1 16:24:43 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求一个多功能全鼠标脚本,就是按事件时会出现事有的指针,行走时会自动变成行走的指针....谁可以指针一下吖
远古之谜 ....<换了N次名>
无封面

Lv1.梦旅人

梦石
0
星屑
65
在线时间
123 小时
注册时间
2013-5-12
帖子
24
来自 2楼
发表于 2013-6-2 20:35:00 | 只看该作者
本帖最后由 名雪 于 2013-6-16 18:40 编辑

插入第一个脚本(输出模块)
  1. #==============================================================================
  2. # ** 鼠标输出模块 (修复)
  3. #------------------------------------------------------------------------------
  4. #   by DerVVulfman
  5. #   版本 1.2
  6. #   08-18-2007
  7. #------------------------------------------------------------------------------
  8. #   建立在鼠标输出模块...
  9. #
  10. #   by Near Fantastica
  11. #------------------------------------------------------------------------------
  12. #   Set_Pos feature by
  13. #   Freakboy
  14. #------------------------------------------------------------------------------
  15. #
  16. #   CALLS:
  17. #
  18. #   Mouse.click?
  19. #   判断鼠标是否真的按下(Ture/False).
  20. #   这个值控制您按下的是左/右键,还是中键

  21. #
  22. #   Mouse.press?
  23. #   判断鼠标是否真的按下/保持按下状态
  24. #   这个值控制您按下的是左/右键,还是中键
  25. #   Mouse.pixels
  26. #   Mouse.pixels
  27. #   这个值返回鼠标所在的坐标(640*480大小),如果鼠标超出游戏画面,这个值为空
  28. #
  29. #   Mouse.tiles
  30. #   This returns  the mouse's screen  coordinates  in map tiles.   Based on the
  31. #   system's 20x15 tile size,  this returns it in index values  (a 0-19 width &
  32. #   a 0-14 height).  This functions the same manner as Mouse.pixels.
  33. #
  34. #   Mouse.set_pos
  35. #   This allows you  to forcefully position the mouse at an x/y position within
  36. #   the game screen by pixel coordinates.  Given the game's normal screen width
  37. #   of 640x480, adding:  Mouse.set_pos(320,240)  should position the mouse dead
  38. #   center of the gaming window.
  39. #
  40. #   Mouse.update
  41. #   Add this routine  into your update routines  to update  the mouse position.
  42. #   It must be called otherwise you won't get valid mouse coordinates.
  43. #
  44. #==============================================================================

  45. module Mouse
  46.   @mouse_menu = 0
  47.   #--------------------------------------------------------------------------
  48.   # * 鼠标点击
  49.   #     button      : button
  50.   #--------------------------------------------------------------------------
  51.   def Mouse.click?(button)
  52.     return true if @keys.include?(button)
  53.     return false
  54.   end  
  55.   #--------------------------------------------------------------------------
  56.   # * 鼠标击键
  57.   #     button      : button
  58.   #--------------------------------------------------------------------------
  59.   def Mouse.press?(button)
  60.     return true if @press.include?(button)
  61.     return false
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # * 鼠标按下
  65.   #     button      : button
  66.   #--------------------------------------------------------------------------
  67.   def Mouse.area?(x, y, width=32, height=32)
  68.     return false if @pos == nil
  69.     return true if @pos[0] >= x and @pos[0] <= (x+width) and @pos[1] >= y and @pos[1] <= (y+height)
  70.     return false
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # * 坐标
  74.   #--------------------------------------------------------------------------
  75.   def Mouse.pixels
  76.     return @pos == nil ? [0, 0] : @pos
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # * 鼠标初始坐标
  80.   #--------------------------------------------------------------------------
  81.   def Mouse.tiles
  82.     return nil if @pos == nil
  83.     x = @pos[0] / 32
  84.     y = @pos[1] / 32
  85.     return [x, y]
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # * 设置鼠标初始坐标
  89.   #--------------------------------------------------------------------------
  90.   def Mouse.set_pos(x_pos=0, y_pos=0)
  91.     width, height = Mouse.client_size
  92.     if (x_pos.between?(0, width) && y_pos.between?(0, height))
  93.       x = Mouse.client_pos[0] + x_pos; y = Mouse.client_pos[1] + y_pos
  94.       Win32API.new('user32', 'SetCursorPos', 'NN', 'N').call(x, y)
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # * Mouse Update
  99.   #--------------------------------------------------------------------------
  100.   def Mouse.update
  101.     @pos            = Mouse.pos
  102.     @keys, @press   = [], []
  103.     @keys.push(1)   if Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(1) & 0X01 == 1
  104.     @keys.push(2)   if Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(2) & 0X01 == 1
  105.     @keys.push(3)   if Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(4) & 0X01 == 1
  106.     @press.push(1)  if Win32API.new("user32","GetKeyState",['i'],'i').call(1) & 0X01 == 1
  107.     @press.push(2)  if Win32API.new("user32","GetKeyState",['i'],'i').call(2) & 0X01 == 1
  108.     @press.push(3)  if Win32API.new("user32","GetKeyState",['i'],'i').call(4) & 0X01 == 1
  109.   end  
  110.   #--------------------------------------------------------------------------
  111.   # * Automatic functions below
  112.   #--------------------------------------------------------------------------
  113.   #
  114.   #--------------------------------------------------------------------------
  115.   # * Obtain Mouse position in screen
  116.   #--------------------------------------------------------------------------
  117.   def Mouse.global_pos
  118.     pos = [0, 0].pack('ll')
  119.     if Win32API.new('user32', 'GetCursorPos', 'p', 'i').call(pos) != 0
  120.       return pos.unpack('ll')
  121.     else
  122.       return nil
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * 返回鼠标坐标
  127.   #--------------------------------------------------------------------------
  128.   def Mouse.pos
  129.     x, y = Mouse.screen_to_client(*Mouse.global_pos)
  130.     width, height = Mouse.client_size
  131.     begin
  132.       if (x >= 0 and y >= 0 and x < width and y < height)
  133.         return x, y
  134.       else
  135.         return nil
  136.       end
  137.     rescue
  138.       return nil
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   #  * Pass Screen to Game System
  143.   #--------------------------------------------------------------------------
  144.   def Mouse.screen_to_client(x, y)
  145.     return nil unless x and y
  146.     pos = [x, y].pack('ll')
  147.     if Win32API.new('user32', 'ScreenToClient', %w(l p), 'i').call(Mouse.hwnd, pos) != 0
  148.       return pos.unpack('ll')
  149.     else
  150.       return nil
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # * 得到游戏屏幕高度
  155.   #--------------------------------------------------------------------------
  156.   def Mouse.hwnd
  157.     game_name = "\0" * 256
  158.     Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l').call('Game','Title','',game_name,255,".\\Game.ini")
  159.     game_name.delete!("\0")
  160.     return Win32API.new('user32', 'FindWindowA', %w(p p), 'l').call('RGSS Player',game_name)
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # * 得到游戏屏幕宽度
  164.   #--------------------------------------------------------------------------
  165.   def Mouse.client_size
  166.     rect = [0, 0, 0, 0].pack('l4')
  167.     Win32API.new('user32', 'GetClientRect', %w(l p), 'i').call(Mouse.hwnd, rect)
  168.     right, bottom = rect.unpack('l4')[2..3]
  169.     return right, bottom
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # * 得到窗口坐标
  173.   #--------------------------------------------------------------------------
  174.   def Mouse.client_pos
  175.     rect = [0, 0, 0, 0].pack('l4')
  176.     Win32API.new('user32', 'GetWindowRect', %w(l p), 'i').call(Mouse.hwnd, rect)
  177.     left, upper = rect.unpack('l4')[0..1]
  178.     return left+4, upper+30
  179.   end
  180. end
复制代码
插入第二个脚本(路径寻址)
  1. #==============================================================================
  2. #  ■ 路径寻址
  3. #==============================================================================
  4. # Near Fantastica
  5. # 版本 1
  6. # 29.11.05
  7. #==============================================================================
  8. # Lets the Player or Event draw a path from an desonation to the source. This
  9. # method is very fast and because the pathfinding is imbedded into the Game
  10. # Character the pathfinding can be interrupted or redrawn at any time.
  11. #==============================================================================
  12. # Player :: $game_player.find_path(x,y)
  13. # Event Script Call :: self.event.find_path(x,y)
  14. # Event Movement Script Call :: self.find_path(x,y)
  15. #==============================================================================
  16. # [VX] Simple Mouse System Note: I edited the method
  17. # character.passable?(x, y, direction) to character.passable?(x, y)
  18. # according to change of this method in VX.
  19. #------------------------------------------------------------------------------

  20. class Game_Character
  21.   #--------------------------------------------------------------------------
  22.   alias nf_pf_game_character_initialize initialize
  23.   alias nf_pf_game_character_update update
  24.   #--------------------------------------------------------------------------
  25.   attr_accessor :map
  26.   attr_accessor :runpath
  27.   #--------------------------------------------------------------------------
  28.   def initialize
  29.     nf_pf_game_character_initialize
  30.     @map = nil
  31.     @runpath = false
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   def update
  35.     run_path if @runpath == true
  36.     nf_pf_game_character_update
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   def run_path
  40.     return if moving?
  41.     step = @map[@x,@y]
  42.     if step == 1
  43.       @map = nil
  44.       @runpath = false
  45.       return
  46.     end
  47.     dir = rand(2)
  48.     case dir
  49.     when 0
  50.       move_right if @map[@x+1,@y] == step - 1 and step != 0
  51.       move_down if @map[@x,@y+1] == step - 1 and step != 0
  52.       move_left if @map[@x-1,@y] == step -1 and step != 0
  53.       move_up if @map[@x,@y-1] == step - 1 and step != 0
  54.     when 1
  55.       move_up if @map[@x,@y-1] == step - 1 and step != 0
  56.       move_left if @map[@x-1,@y] == step -1 and step != 0
  57.       move_down if @map[@x,@y+1] == step - 1 and step != 0
  58.       move_right if @map[@x+1,@y] == step - 1 and step != 0
  59.     end
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   def find_path(x,y)
  63.     sx, sy = @x, @y
  64.     result = setup_map(sx,sy,x,y)
  65.     @runpath = result[0]
  66.     @map = result[1]
  67.     @map[sx,sy] = result[2] if result[2] != nil
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   def clear_path
  71.     @map = nil
  72.     @runpath = false
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   def setup_map(sx,sy,ex,ey)
  76.     map = Table.new($game_map.width, $game_map.height)
  77.     map[ex,ey] = 1
  78.     old_positions = []
  79.     new_positions = []
  80.     old_positions.push([ex, ey])
  81.     depth = 2
  82.     depth.upto(100){|step|
  83.       loop do
  84.         break if old_positions[0] == nil
  85.         x,y = old_positions.shift
  86.         return [true, map, step] if x == sx and y+1 == sy
  87.         if $game_player.passable?(x, y) and map[x,y + 1] == 0
  88.           map[x,y + 1] = step
  89.           new_positions.push([x,y + 1])
  90.         end
  91.         return [true, map, step] if x-1 == sx and y == sy
  92.         if $game_player.passable?(x, y) and map[x - 1,y] == 0
  93.           map[x - 1,y] = step
  94.           new_positions.push([x - 1,y])
  95.         end
  96.         return [true, map, step] if x+1 == sx and y == sy
  97.         if $game_player.passable?(x, y) and map[x + 1,y] == 0
  98.           map[x + 1,y] = step
  99.           new_positions.push([x + 1,y])
  100.         end
  101.         return [true, map, step] if x == sx and y-1 == sy
  102.         if $game_player.passable?(x, y) and map[x,y - 1] == 0
  103.           map[x,y - 1] = step
  104.           new_positions.push([x,y - 1])
  105.         end
  106.       end
  107.       old_positions = new_positions
  108.       new_positions = []
  109.     }
  110.     return [false, nil, nil]
  111.   end
  112. end
  113.   
  114. class Game_Map
  115.   #--------------------------------------------------------------------------
  116.   alias pf_game_map_setup setup
  117.   #--------------------------------------------------------------------------
  118.   def setup(map_id)
  119.     pf_game_map_setup(map_id)
  120.     $game_player.clear_path
  121.   end
  122. end
  123.   
  124. class Game_Player
  125.   #--------------------------------------------------------------------------
  126.   alias pf_game_player_update update
  127.   #--------------------------------------------------------------------------
  128.   def update
  129.     $game_player.clear_path if Input.dir4 != 0
  130.     pf_game_player_update
  131.   end
  132. end
  133.   
  134. class Interpreter
  135.   #--------------------------------------------------------------------------
  136.   def event
  137.     return $game_map.events[@event_id]
  138.   end
  139. end
复制代码
插入第三个脚本(鼠标系统)
  1. #==============================================================================
  2. # [VX] SMS - Simple Mouse System
  3. #------------------------------------------------------------------------------
  4. # ◦ by Woratana [[email][email protected][/email]]
  5. # ◦ Released on: 14/04/2008 (D-M-Y)
  6. # ◦ Version: 1.5
  7. #
  8. # ◦ Credit: DerVVulfman, Near Fantastica, and Freak Boy [Mouse Input Module]
  9. # lambchop, shun, Cybersam, Astro_mech, and Mr.Mo [Super Simple Mouse System]
  10. # - Modern Algebra, Zeriab, Patrick Lester [Path Finding]
  11. # - Near Fantastica, Fuso [Path Finding]
  12. #
  13. # - I will not be able to script this without those people and scripts above
  14. #-----------------------------------------------------------------------------
  15. #====[REQUIRE]=====
  16. # - DerVVulfman's Mouse Input Module
  17. # ([url]http://rmxp.org/forums/index.php?topic=26993[/url])
  18. # It's XP script, but also works in VX!
  19. #
  20. # - Near Fantastica's Path Finding [version 1.0]
  21. # ([url]http://www.rmxp.org/forums/index.php?topic=26661.0[/url])
  22. # with a little fix to make it works in VX.
  23. # (get fixed version from Simple Mouse System demo)
  24. #
  25. #====[FEATURE]=====
  26. # - Support to use mouse in many scenes / windows
  27. # - Click on map to move player with Path Finding
  28. # - Mouse Pointer
  29. #
  30. #====[PLAN in next version]=====
  31. # - Cursor change when put on other event
  32. # - Better event trigger check by click mouse
  33. #
  34. #------------------------------------------------------------------------------

  35. #==============================================================================
  36. # **鼠标输出模块
  37. #==============================================================================
  38. class << Mouse
  39.   show_cursor = Win32API.new('user32', 'ShowCursor', 'l', 'l')
  40.   show_cursor.call(0)

  41.   $mousec = Sprite.new
  42.   $mousec.z = 10001
  43.   $mousec.x = $mousec.y = 1000
  44.   $mouse_icon = 'fox_cursor'
  45.   $mousec.bitmap = Cache.system($mouse_icon)
  46.   
  47.   alias wor_mouse_upd_mouse update unless $@
  48.   def Mouse.update
  49.     wor_mouse_upd_mouse
  50.     if $mouse_old_icon.nil? or $mouse_old_icon != $mouse_icon
  51.       $mouse_old_icon = $mouse_icon
  52.       $mousec.bitmap = Cache.system($mouse_old_icon)
  53.     end
  54.     if @pos.nil?
  55.       $mousec.x = 1000 if $mousec.x != 1000
  56.       $mousec.y = 1000 if $mousec.y != 1000
  57.     else
  58.       $mousec.x = @pos[0] if $mousec.x != @pos[0]
  59.       $mousec.y = @pos[1] if $mousec.y != @pos[1]
  60.     end
  61.   end
  62.   
  63.   def Mouse.map_pos
  64.     return nil if @pos == nil
  65.     x = ($game_map.display_x / 256) + (@pos[0] / 32)
  66.     y = ($game_map.display_y / 256) + (@pos[1] / 32)
  67.     return [x, y]
  68.   end
  69. end

  70. #==============================================================================
  71. # ** 输出
  72. #==============================================================================
  73. class << Input
  74.   alias wor_input_upd_mouse update unless $@
  75.   alias wor_input_trig_mouse trigger? unless $@
  76.   alias wor_input_rep_mouse repeat? unless $@
  77.   def Input.update
  78.     wor_input_upd_mouse
  79.     Mouse.update
  80.   end
  81.   
  82.   def Input.trigger?(input)
  83.     return wor_input_trig_mouse(input) if Mouse.pos.nil?
  84.     case input
  85.     when Input::B
  86.       return (wor_input_trig_mouse(input) or Mouse.click?(2))
  87.     when Input::C
  88.       if $scene.is_a?(Scene_Map) and !$game_message.visible
  89.         return wor_input_trig_mouse(input)
  90.       else
  91.         return (wor_input_trig_mouse(input) or Mouse.click?(1))
  92.       end
  93.     else
  94.       return wor_input_trig_mouse(input)
  95.     end
  96.   end
  97.   
  98.   def Input.repeat?(input)
  99.     if input == Input::B
  100.       return (wor_input_rep_mouse(input) or Mouse.click?(2))
  101.     else
  102.       return wor_input_rep_mouse(input)
  103.     end
  104.   end
  105. end
  106. #==============================================================================
  107. # ** 图形
  108. #==============================================================================
  109. class << Graphics
  110.   alias wor_graph_fadeout_mouse fadeout unless $@
  111.   def Graphics.fadeout(frames = 1)
  112.     $mousec.visible = false if !$mousec.nil?
  113.     wor_graph_fadeout_mouse(frames)
  114.   end
  115. end
  116. #==============================================================================
  117. # ** Window_Selectable
  118. #==============================================================================
  119. class Window_Selectable < Window_Base
  120.   alias wor_winsel_ini_mouse initialize
  121.   alias wor_winsel_upd_mouse update
  122.   def initialize(*args)
  123.     wor_winsel_ini_mouse(*args)
  124.     @scroll_wait = 0
  125.     @cursor_wait = 0
  126.   end

  127.   def update
  128.     wor_winsel_upd_mouse
  129.     update_mouse if self.active and self.visible
  130.   end
  131.   
  132.   def update_mouse
  133.     @cursor_wait -= 1 if @cursor_wait > 0
  134.     (0..@item_max - 1).each do |i|
  135.       irect = item_rect(i)
  136.       irx = self.x + 16 + irect.x - self.ox
  137.       iry = self.y + 16 + irect.y - self.oy
  138.       move_cursor(i) if Mouse.area?(irx, iry, irect.width, irect.height)
  139.     end
  140.   end

  141.   def move_cursor(index)
  142.     return if @index == index
  143.     @scroll_wait -= 1 if @scroll_wait > 0
  144.     row1 = @index / @column_max
  145.     row2 = index / @column_max
  146.     bottom = self.top_row + (self.page_row_max - 1)
  147.     if row1 == self.top_row and row2 < self.top_row
  148.       return if @scroll_wait > 0
  149.       @index = [@index - @column_max, 0].max
  150.       @scroll_wait = 4
  151.     elsif row1 == bottom and row2 > bottom
  152.       return if @scroll_wait > 0
  153.       @index = [@index + @column_max, @item_max - 1].min
  154.       @scroll_wait = 4
  155.     else
  156.       @index = index
  157.     end
  158.     return if @cursor_wait > 0
  159.     Sound.play_cursor
  160.     @cursor_wait += 2
  161.   end
  162. end
  163. #==============================================================================
  164. # ** Window_MenuStatus
  165. #==============================================================================
  166. class Window_MenuStatus < Window_Selectable
  167.   def item_rect(index)
  168.     return Rect.new(0, index * 96, contents.width, 96)
  169.   end
  170. end
  171. #==============================================================================
  172. # ** Window_NameInput
  173. #==============================================================================
  174. class Window_NameInput < Window_Base
  175.   alias wor_winnam_upd_mouse update
  176.   def update
  177.     wor_winnam_upd_mouse
  178.     if self.active and self.visible
  179.       (0..TABLE[@mode].size - 1).each do |i|
  180.       irect = item_rect(i)
  181.       irx = self.x + 16 + irect.x - self.ox
  182.       iry = self.y + 16 + irect.y - self.oy
  183.       @index = i if Mouse.area?(irx, iry, irect.width, irect.height)
  184.       end
  185.     end
  186.   end
  187. end
  188. #==============================================================================
  189. # ** Window_PartyCommand
  190. #==============================================================================
  191. class Window_PartyCommand < Window_Command
  192.   def update_mouse
  193.     (0..@item_max - 1).each do |i|
  194.     irect = item_rect(i)
  195.     irx = self.viewport.ox + 16 + irect.x - self.ox
  196.     iry = 288 + 16 + irect.y - self.oy
  197.     self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
  198.     end
  199.   end
  200. end
  201. #==============================================================================
  202. # ** Window_ActorCommand
  203. #==============================================================================
  204. class Window_ActorCommand < Window_Command
  205.   def update_mouse
  206.     (0..@item_max - 1).each do |i|
  207.     irect = item_rect(i)
  208.     irx = self.viewport.ox + 288 + 16 + irect.x
  209.     iry = 288 + 16 + irect.y
  210.     self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
  211.     end
  212.   end
  213. end
  214. #==============================================================================
  215. # ** Window_Message
  216. #==============================================================================
  217. class Window_Message < Window_Selectable
  218.   def update_mouse
  219.     (0..@item_max - 1).each do |i|
  220.       irect = item_rect(i)
  221.       irx = self.x + 16 + irect.x - self.ox
  222.       iry = self.y + 16 + irect.y - self.oy + ($game_message.choice_start * WLH)
  223.       self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
  224.     end
  225.   end
  226. end

  227. #==============================================================================
  228. # ** Scene_Base
  229. #==============================================================================
  230. class Scene_Base
  231.   alias wor_scebase_posstr_mouse post_start
  232.   alias wor_scebase_preter_mouse pre_terminate
  233.   def post_start
  234.     $mousec.visible = true if !$mousec.nil?
  235.     wor_scebase_posstr_mouse
  236.   end
  237.   
  238.   def pre_terminate
  239.     $mousec.visible = false if !$mousec.nil?
  240.     wor_scebase_preter_mouse
  241.   end
  242. end
  243. #==============================================================================
  244. # ** Scene_File
  245. #==============================================================================
  246. class Scene_File < Scene_Base
  247.   alias wor_scefil_upd_mouse update
  248.   def update
  249.     (0..@item_max - 1).each do |i|
  250.       ix = @savefile_windows[i].x
  251.       iy = @savefile_windows[i].y
  252.       iw = @savefile_windows[i].width
  253.       ih = @savefile_windows[i].height
  254.       if Mouse.area?(ix, iy, iw, ih)
  255.         @savefile_windows[@index].selected = false
  256.         @savefile_windows[i].selected = true
  257.         @index = i
  258.       end
  259.     end
  260.     wor_scefil_upd_mouse
  261.   end
  262. end
  263. #==============================================================================
  264. # ** Scene_Map
  265. #==============================================================================
  266. class Scene_Map < Scene_Base
  267.   alias wor_scemap_ini_mouse initialize
  268.   alias wor_scemap_upd_mouse update
  269.   def initialize
  270.     @last_click = [nil, nil]
  271.     wor_scemap_ini_mouse
  272.   end
  273.   
  274.   def update
  275.     wor_scemap_upd_mouse
  276.     mouse_xy = Mouse.map_pos
  277.     if Mouse.click?(1) and !mouse_xy.nil? and !$game_message.visible and
  278.       !$game_map.interpreter.running?
  279.       $game_player.turn_toward_pos(mouse_xy[0], mouse_xy[1])
  280.       if $game_player.close?(mouse_xy[0],mouse_xy[1]) and
  281.         $game_player.check_action_event
  282.         $game_player.clear_path
  283.         return
  284.       end
  285.       if $game_map.passable?(mouse_xy[0], mouse_xy[1])
  286.         $game_player.find_path(mouse_xy[0], mouse_xy[1])
  287.       end
  288.       @last_click = mouse_xy
  289.     end
  290.     if Mouse.click?(3) and !mouse_xy.nil? and !$game_message.visible and
  291.       !$game_map.interpreter.running?
  292.       $game_player.clear_path
  293.       $game_player.turn_toward_pos(mouse_xy[0], mouse_xy[1])
  294.     end
  295.   end
  296. end
  297. #==============================================================================
  298. # ** Game_Character
  299. #==============================================================================
  300. class Game_Character
  301.   def turn_toward_pos(x,y)
  302.     sx = distance_x_from_pos(x)
  303.     sy = distance_y_from_pos(y)
  304.     if sx.abs > sy.abs
  305.       sx > 0 ? turn_left : turn_right
  306.     elsif sx.abs < sy.abs
  307.       sy > 0 ? turn_up : turn_down
  308.     end
  309.   end
  310.   
  311.   def distance_x_from_pos(x)
  312.     sx = @x - x
  313.     if $game_map.loop_horizontal?
  314.       if sx.abs > $game_map.width / 2
  315.         sx -= $game_map.width
  316.       end
  317.     end
  318.     return sx
  319.   end
  320.   
  321.   def distance_y_from_pos(y)
  322.     sy = @y - y
  323.     if $game_map.loop_vertical?
  324.       if sy.abs > $game_map.height / 2
  325.         sy -= $game_map.height
  326.       end
  327.     end
  328.     return sy
  329.   end
  330.   
  331.   def close?(x,y)
  332.     sx = (@x - x).abs
  333.     sy = (@y - y).abs
  334.     if sx + sy == 1
  335.       return true
  336.     end
  337.     return false
  338.   end
  339. end
复制代码
插入以上脚本后,请自己找一个鼠标,命名为fox_cursor
不知道你要找的是不是这个

点评

请用把代码括起来。。  发表于 2013-6-13 17:20

评分

参与人数 1梦石 +1 收起 理由
怪蜀黍 + 1 精品文章

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2013-5-8
帖子
18
3
发表于 2013-6-2 12:36:11 | 只看该作者
大神快出现把。。。我找了好久
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
123 小时
注册时间
2013-5-12
帖子
24
4
发表于 2013-6-16 18:42:48 | 只看该作者
已修改。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
55 小时
注册时间
2011-7-15
帖子
48
5
发表于 2013-6-20 15:56:47 | 只看该作者
名雪 发表于 2013-6-16 18:42
已修改。

第三个脚本(鼠标系统),一摁F12就会显示277行有问题,怎么回事?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
48
在线时间
95 小时
注册时间
2013-3-8
帖子
268
6
发表于 2013-6-21 09:43:44 | 只看该作者
本帖最后由 蓝焰。 于 2013-6-21 13:26 编辑


膜拜大神~
{:2_284:}


↑千万不要这样做QAQ

加张鼠标的图片。。不能水。。。
别扣我经验

fox_cursor.png (4.56 KB, 下载次数: 40)

fox_cursor.png

点评

不是纯水了...... 我变成反面教材了......  发表于 2013-6-21 13:41

评分

参与人数 1星屑 -10 收起 理由
怪蜀黍 -10 提问区严禁纯水

查看全部评分

我也要给自己的群宣传~> <

RUBY-技术讨论群:126393968

欢迎新人或是触前来支持


阿里阿多~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
48
在线时间
95 小时
注册时间
2013-3-8
帖子
268
7
发表于 2013-6-21 13:28:20 | 只看该作者
本帖最后由 蓝焰。 于 2013-6-21 13:52 编辑

然后。。。
错误了
class Window_NameInput < Window_Base
好像以前测试的时候就有这个问题?
在大神的这里
#==============================================================================
# ** Window_NameInput
#==============================================================================
怎么会错吶nameinput是base的子类啊
哪里错了!!!!!!!





然后,不能连贴过3层...
就在这里说下吧
家里的ACE好像不能在类的名字里有大写
class Window_nameInput < Window_Base
这样就对了    把N变成n
后面的252行(没记清),也是大写         type error
然后...
这里又错了55555
138行
    (0..@item_max - 1).each do |i|
这个是nomethoderror
没有@iem_max的实例么?


好了我加上了一句
@item = Window_Selectable.new
生成个实例。。。
貌似没事了。。。
然后
126行错了!
    wor_winsel_ini_mouse(*args)
[argumenterror!
wrongnumber of number(0 for 4)]
为什么。。。  。。。

顺便说下每次回车中间一行都是回复编辑完了再想办法解决
能看懂也不错呐...感谢HAR君!(好像之前在哪里提到过......    ......   ......   !!!)
我也要给自己的群宣传~> <

RUBY-技术讨论群:126393968

欢迎新人或是触前来支持


阿里阿多~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 03:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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