赞 | 0 |
VIP | 136 |
好人卡 | 4 |
积分 | 1 |
经验 | 2058 |
最后登录 | 2013-1-17 |
在线时间 | 142 小时 |
Lv1.梦旅人 辉瑞中国首席研究员<
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 142 小时
- 注册时间
- 2008-1-18
- 帖子
- 2129
|
先把下面脚本替换原来的鼠标响应图片脚本
我先声明这只是个简单实现功能的脚本 = =
- $lock = false
- class Game_Picture
-
- def name=(str)
- @name = str
- end
-
- end
- class Sprite_Picture
- alias update_old update
- def update
- update_old
- return if @picture_name == "" or @picture_name[/cmd/].nil?
- xy = Mouse.pixels
- mx = xy[0]
- my = xy[1]
- lx = self.x - self.ox
- rx = lx + self.bitmap.width
- ty = self.y - self.oy
- by = ty + self.bitmap.height
-
- if mx > lx and mx < rx and my > ty and my < by then
- $lock = true
- @picture.name.split(/_/)[0] =~ /cmd([0-9]+)/
- s = $1
- if Mouse.click?(1) then
- $game_temp.common_event_id = s.to_i
- else $lock = false
- end
- end
-
- end
-
- end
复制代码
class Scene_Map < Scene_Base
alias wor_scemap_ini_mouse initialize
alias wor_scemap_upd_mouse update
def initialize
@last_click = [nil, nil]
wor_scemap_ini_mouse
end
def update
wor_scemap_upd_mouse
mouse_xy = Mouse.map_pos
if Mouse.click?(1) and !mouse_xy.nil? and !$game_message.visible and
!$game_map.interpreter.running?
$game_player.turn_toward_pos(mouse_xy[0], mouse_xy[1])
if $game_player.close?(mouse_xy[0],mouse_xy[1]) and
$game_player.check_action_event
$game_player.clear_path
return
end
if $game_map.passable?(mouse_xy[0], mouse_xy[1])
$game_player.find_path(mouse_xy[0], mouse_xy[1])
end
@last_click = mouse_xy
end
if Mouse.click?(3) and !mouse_xy.nil? and !$game_message.visible and
!$game_map.interpreter.running?
$game_player.clear_path
$game_player.turn_toward_pos(mouse_xy[0], mouse_xy[1])
end
end
end
找到if Mouse.click?(1) and !mouse_xy.nil? and !$game_message.visible and
!$game_map.interpreter.running?
改为if Mouse.click?(1) and !mouse_xy.nil? and !$game_message.visible and
!$game_map.interpreter.running? and !$lock
这是为了解决点击图片,人物回寻路的问题
忘记讲命名规则cmd1_1
cmd+公共事件编号_+图片名字 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|