查看: 1621|回复: 3

[已经解决] 有没有XAS跟随的脚本?

  [复制链接]
梦石
0
星屑
63
在线时间
246 小时
注册时间
2012-4-4
回帖
198
发表于 2012-4-11 13:29:48 | 显示全部楼层 |阅读模式

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

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

×
有没有XAS跟随的脚本?XAS里没附带啊!
梦石
0
星屑
55
在线时间
134 小时
注册时间
2010-7-1
回帖
44
发表于 2012-4-11 18:35:50 | 显示全部楼层
什么是XAS……
回复

使用道具 举报

梦石
0
星屑
672
在线时间
2184 小时
注册时间
2009-12-6
回帖
571

开拓者

发表于 2012-4-11 20:56:16 | 显示全部楼层
本帖最后由 ML4455739 于 2012-4-11 21:02 编辑

[pre lang="ruby"]class Game_Event < Game_Character
  
  $事件ID的变量号 = 10
  
   def event_toward_player
    $game_variables[$事件ID的变量号] > 0 ? judge = true : judge = false
    $game_map.events[$game_variables[$事件ID的变量号]] != nil ? judge = true : judge = false
    sx, sy = 0, 0
    sx = $game_map.events[$game_variables[$事件ID的变量号]].x - $game_player.x if judge
    sy = $game_map.events[$game_variables[$事件ID的变量号]].y - $game_player.y if judge
    if sx == 0 and sy == 0
      return
    end
   
    abs_sx2 = sx.abs
    abs_sy2 = sy.abs
    if abs_sx2 == abs_sy2
      rand(2) == 0 ? abs_sx2 += 1 : abs_sy2 += 1
    end
    if abs_sx2 > abs_sy2
      sx > 0 ? move_left : move_right
      if not moving? and sy != 0
        sy > 0 ? move_up : move_down
      end
    else
      sy > 0 ? move_up : move_down
      if not moving? and sx != 0
        sx > 0 ? move_left : move_right
      end
    end # if
   
  end # def
end # class[/pre]$事件ID的变量号 = 10
即10号变量的值等于跟随主角的事件的事件ID。

自行新建一个出现条件带开关的事件,其移动规则为自定义-脚本:event_toward_player
需要关闭跟随时,先将10号变量归零,再关闭事件条件的开关即可。

虽然我语文不好但是如果无法理解便不必再纠结这个跟随问题了= =||。
往事简直不堪回首,稍微做点想做的事吧
回复

使用道具 举报

梦石
0
星屑
63
在线时间
246 小时
注册时间
2012-4-4
回帖
198
 楼主| 发表于 2012-4-12 18:44:07 | 显示全部楼层
嗯,很好用,谢谢!
6R,好久不见。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部