本帖最后由 传说中di 于 2016-2-20 23:07 编辑
眼中目之瞳 发表于 2016-2-20 21:46
两个脚本不能同时响应,而且即使单用这一个脚本(“鼠标本体”的脚本不动),会报错。
...
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? mx,my = Mouse.get_mouse_pos lx = self.x - self.ox rx = lx + self.bitmap.width ty = self.y - self.oy by = ty + self.bitmap.height if mx < lx or mx > rx or my < ty or my > by or self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0 @picture.name = @picture.name.split(/_/)[0] return end if Mouse.trigger?(Mouse::LEFT) && @picture.name.split(/_/)[0] != nil @picture.name.split(/_/)[0].sub(/cmd([0-9]+)/,"") $game_temp.reserve_common_event($1.to_i) end end end
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?
mx,my = Mouse.get_mouse_pos
lx = self.x - self.ox
rx = lx + self.bitmap.width
ty = self.y - self.oy
by = ty + self.bitmap.height
if mx < lx or mx > rx or my < ty or my > by or
self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
@picture.name = @picture.name.split(/_/)[0]
return
end
if Mouse.trigger?(Mouse::LEFT) && @picture.name.split(/_/)[0] != nil
@picture.name.split(/_/)[0].sub(/cmd([0-9]+)/,"")
$game_temp.reserve_common_event($1.to_i)
end
end
end
可以了
附上两种例子。不行下载例子看就懂了
原版.rar
(1.44 MB, 下载次数: 32)
版本2.rar
(1.45 MB, 下载次数: 51)
|