查看: 2775|回复: 4

[已经解决] 這個 國外的 事件觸發擴大 的腳本 要如何使用?

[复制链接]
梦石
0
星屑
5476
在线时间
761 小时
注册时间
2009-1-21
回帖
236
发表于 2012-8-15 21:31:34 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 御之嵐 于 2012-8-17 17:58 编辑

網址在這
http://yanflychannel.wordpress.c ... event-chase-player/

我照它圖上的方式 在移動路線 插入腳本
可是 事件並不會觸發

還是說 我事件的設定有問題?

有人會使用這個嗎?
可以 教一下嗎 @ ~ @?
謝謝
梦石
0
星屑
1643
在线时间
409 小时
注册时间
2012-8-7
回帖
1499
发表于 2012-8-16 19:04:17 | 显示全部楼层
为什么……这个链接打不开- -


回复

使用道具 举报

梦石
0
星屑
803
在线时间
2068 小时
注册时间
2011-10-3
回帖
1620
发表于 2012-8-16 19:09:34 | 显示全部楼层
同打不开,估计要翻墙,LZ直接把看上去像使用说明的东西也复制过来好了
回复

使用道具 举报

梦石
0
星屑
5476
在线时间
761 小时
注册时间
2009-1-21
回帖
236
 楼主| 发表于 2012-8-17 16:16:32 | 显示全部楼层


腳本

  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Event Chase Player v1.00
  4. # -- Last Updated: 2012.01.05
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-EventChasePlayer"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.05 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This script allows you to make events that will chase the player or flee from
  20. # the player when the player enters within range of the event or when the event
  21. # sees the player.
  22. #
  23. #==============================================================================
  24. # ▼ Instructions
  25. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  26. # To install this script, open up your script editor and copy/paste this script
  27. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  28. #
  29. # -----------------------------------------------------------------------------
  30. # Move Script Call - Open up the script call in the event move menu and use:
  31. # -----------------------------------------------------------------------------
  32. # Add these variable changes to an event's move route to use them.
  33. #
  34. # @chase_range = x
  35. # Event will chase the player after reaching x range.
  36. #
  37. # @flee_range = x
  38. # Event will flee from player after reaching x range.
  39. #
  40. # @chase_speed = x
  41. # Event will move at x speed when chasing.
  42. #
  43. # @flee_speed = x
  44. # Event will move at x speed when fleeing.
  45. #
  46. # @sight_lock = x
  47. # Event will chase/flee from player for x frames.
  48. #
  49. # @alert_balloon = x
  50. # Event will show ballon ID x when chasing or fleeing.
  51. #
  52. # @see_player = true
  53. # For events that require them to see the player first, use this script call
  54. # inside the movement boxes. This does not follow line of sight rules, which
  55. # means if there's a rock blocking you and the event, it will still see you.
  56. #
  57. #==============================================================================
  58. # ▼ Compatibility
  59. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  60. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  61. # it will run with RPG Maker VX without adjusting.
  62. #
  63. #==============================================================================

  64. module YEA
  65.   module EVENT_CHASE
  66.    
  67.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  68.     # - General Settings -
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     # These settings adjust some general settings regarding chasing and fleeing
  71.     # events. Adjust them as you see fit.
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # The number of frames before a balloon can show up again on the same
  74.     # event. This is to prevent a massive balloon spamming. 60 frames = 1 sec.
  75.     # By default, 120 frames is 2 seconds.
  76.     ALERT_TIMER = 120
  77.    
  78.     # This is the default number of frames for how long the event will chase or
  79.     # flee from the player if used with @see_player = true. To change the amount
  80.     # individually for each event, use @sight_lock = x where x is a number.
  81.     # By default, 300 frames is 5 seconds.
  82.     SIGHT_LOCK = 300
  83.    
  84.   end # EVENT_CHASE
  85. end # YEA

  86. #==============================================================================
  87. # ▼ Editting anything past this point may potentially result in causing
  88. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  89. # halitosis so edit at your own risk.
  90. #==============================================================================

  91. #==============================================================================
  92. # ■ Game_Event
  93. #==============================================================================

  94. class Game_Event < Game_Character
  95.   
  96.   #--------------------------------------------------------------------------
  97.   # alias method: update_self_movement
  98.   #--------------------------------------------------------------------------
  99.   alias game_event_update_self_movement_ecp update_self_movement
  100.   def update_self_movement
  101.     return if $imported["YEA-StopAllMovement"] && Switch.stop_npc_movement
  102.     update_chase_distance
  103.     update_flee_distance
  104.     if @stop_count > 0 && @chase_player
  105.       move_type_toward_player
  106.     elsif @stop_count > 0 && @flee_player
  107.       move_type_away_player
  108.     else
  109.       game_event_update_self_movement_ecp
  110.     end
  111.     update_alert_balloon
  112.   end
  113.   
  114.   #--------------------------------------------------------------------------
  115.   # new method: update_chase_distance
  116.   #--------------------------------------------------------------------------
  117.   def update_chase_distance
  118.     return if @erased
  119.     return if @chase_range.nil?
  120.     dis = distance_x_from($game_player.x).abs
  121.     dis += distance_y_from($game_player.y).abs
  122.     if chase_conditions
  123.       @chase_player = true
  124.       @move_speed = @chase_speed unless @chase_speed.nil?
  125.     else
  126.       @chase_player = false
  127.       @move_speed = @page.move_speed
  128.       @alert_player = false if @alert_timer <= 0
  129.     end
  130.   end
  131.   
  132.   #--------------------------------------------------------------------------
  133.   # new method: chase_conditions
  134.   #--------------------------------------------------------------------------
  135.   def chase_conditions
  136.     dis = distance_x_from($game_player.x).abs
  137.     dis += distance_y_from($game_player.y).abs
  138.     return true if @alert_lock > 0
  139.     return true if dis <= @chase_range and see_player?
  140.     if dis <= @chase_range && @see_player != true
  141.       @alert_lock = @sight_lock if @sight_lock != nil && @sight_lock > 0
  142.       return true
  143.     end
  144.     return false
  145.   end
  146.   
  147.   #--------------------------------------------------------------------------
  148.   # new method: update_flee_distance
  149.   #--------------------------------------------------------------------------
  150.   def update_flee_distance
  151.     return if @erased
  152.     return if @flee_range.nil?
  153.     dis = distance_x_from($game_player.x).abs
  154.     dis += distance_y_from($game_player.y).abs
  155.     if flee_conditions
  156.       @flee_player = true
  157.       @move_speed = @flee_speed unless @flee_speed.nil?
  158.     else
  159.       @flee_player = false
  160.       @move_speed = @page.move_speed
  161.       @alert_player = false if @alert_timer <= 0
  162.     end
  163.   end
  164.   
  165.   #--------------------------------------------------------------------------
  166.   # new method: flee_conditions
  167.   #--------------------------------------------------------------------------
  168.   def flee_conditions
  169.     dis = distance_x_from($game_player.x).abs
  170.     dis += distance_y_from($game_player.y).abs
  171.     return true if @alert_lock > 0
  172.     return true if dis <= @flee_range and see_player?
  173.     if dis <= @flee_range && @see_player != true
  174.       @alert_lock = @sight_lock if @sight_lock != nil && @sight_lock > 0
  175.       return true
  176.     end
  177.     return false
  178.   end
  179.   
  180.   #--------------------------------------------------------------------------
  181.   # new method: update_alert_balloon
  182.   #--------------------------------------------------------------------------
  183.   def update_alert_balloon
  184.     return if @erased
  185.     @alert_timer = 0 if @alert_timer.nil?
  186.     @alert_lock = 0 if @alert_lock.nil?
  187.     @alert_lock -= 1 if @alert_lock >= 0
  188.     return if @alert_balloon == nil || @alert_balloon == 0
  189.     if (@chase_player || @flee_player) && !@alert_player
  190.       @balloon_id = @alert_balloon
  191.       @alert_player = true
  192.       @alert_timer = YEA::EVENT_CHASE::ALERT_TIMER
  193.     end
  194.     @alert_timer -= 1 if @alert_player
  195.   end
  196.   
  197.   #--------------------------------------------------------------------------
  198.   # new method: see_player?
  199.   #--------------------------------------------------------------------------
  200.   def see_player?
  201.     return false if @see_player != true
  202.     sx = distance_x_from($game_player.x)
  203.     sy = distance_y_from($game_player.y)
  204.     if sx.abs > sy.abs
  205.       direction = sx > 0 ? 4 : 6
  206.     else
  207.       direction = sy > 0 ? 8 : 2
  208.     end
  209.     if direction == @direction
  210.       if @sight_lock == nil || @sight_lock <= 0
  211.         @sight_lock = YEA::EVENT_CHASE::SIGHT_LOCK
  212.       end
  213.       @alert_lock = @sight_lock
  214.       return true
  215.     end
  216.     return false
  217.   end
  218.   
  219.   #--------------------------------------------------------------------------
  220.   # new method: move_type_away_player
  221.   #--------------------------------------------------------------------------
  222.   def move_type_away_player
  223.     sx = @x - $game_player.x
  224.     sy = @y - $game_player.y
  225.     if sx.abs + sy.abs >= 20
  226.       move_random
  227.     else
  228.       case rand(6)
  229.       when 0..3;  move_away_from_player
  230.       when 4;     move_random
  231.       when 5;     move_forward
  232.       end
  233.     end
  234.   end
  235.   
  236. end # Game_Event

  237. #==============================================================================
  238. #
  239. # ▼ End of File
  240. #
  241. #==============================================================================
复制代码



它的效果、使用圖
ecp-01.jpg
ecp-02.jpg

說明
Insert these lines into the script call window within the Movement Route event to give an event the chase or flee flag. This doesn’t work with players.

  1. @chase_range = x
复制代码

Event will chase the player after reaching x range.

  1. @flee_range = x
复制代码

Event will flee from player after reaching x range.

  1. @chase_speed = x
复制代码

Event will move at x speed when chasing.

  1. @flee_speed = x
复制代码

Event will move at x speed when fleeing.

  1. @sight_lock = x
复制代码

Event will chase/flee from player for x frames.

  1. @alert_balloon = x
复制代码

Event will show ballon ID x when chasing or fleeing.

  1. @see_player = true
复制代码

For events that require them to see the player first, use this script call inside the movement boxes. This does not follow line of sight rules, which means if there’s a rock blocking you and the event, it will still see you
回复

使用道具 举报

梦石
0
星屑
803
在线时间
2068 小时
注册时间
2011-10-3
回帖
1620
发表于 2012-8-17 16:33:01 | 显示全部楼层
本帖最后由 布里蓝 于 2012-8-17 16:34 编辑

1.jpg
自定义移动


然后点击右下的脚本选项输入相应脚本,英文什么的就算看不懂,在线翻译一下也能看懂个大概吧
2.jpg

点评

不過 我發現 這個超難用的=.= ,找到另外一個 日本的 VX 事件接觸擴張 VA版 的  发表于 2012-8-17 18:06
了解了 我以為是 要在事件裡面設定 原來是要在 路線那邊設定  发表于 2012-8-17 17:58
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部