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

Project1

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

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2681
在线时间
631 小时
注册时间
2009-1-21
帖子
273
跳转到指定楼层
1
发表于 2012-8-15 21:31:34 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

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

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

有人會使用這個嗎?
可以 教一下嗎 @ ~ @?
謝謝

Lv3.寻梦者

梦石
0
星屑
1143
在线时间
409 小时
注册时间
2012-8-7
帖子
1536
2
发表于 2012-8-16 19:04:17 | 只看该作者
为什么……这个链接打不开- -


回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
758
在线时间
2065 小时
注册时间
2011-10-3
帖子
1686
3
发表于 2012-8-16 19:09:34 | 只看该作者
同打不开,估计要翻墙,LZ直接把看上去像使用说明的东西也复制过来好了
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2681
在线时间
631 小时
注册时间
2009-1-21
帖子
273
4
 楼主| 发表于 2012-8-17 16:16:32 | 只看该作者


腳本

RUBY 代码复制
  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.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-EventChasePlayer"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.05 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script allows you to make events that will chase the player or flee from
  22. # the player when the player enters within range of the event or when the event
  23. # sees the player.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  30. #
  31. # -----------------------------------------------------------------------------
  32. # Move Script Call - Open up the script call in the event move menu and use:
  33. # -----------------------------------------------------------------------------
  34. # Add these variable changes to an event's move route to use them.
  35. #
  36. # @chase_range = x
  37. # Event will chase the player after reaching x range.
  38. #
  39. # @flee_range = x
  40. # Event will flee from player after reaching x range.
  41. #
  42. # @chase_speed = x
  43. # Event will move at x speed when chasing.
  44. #
  45. # @flee_speed = x
  46. # Event will move at x speed when fleeing.
  47. #
  48. # @sight_lock = x
  49. # Event will chase/flee from player for x frames.
  50. #
  51. # @alert_balloon = x
  52. # Event will show ballon ID x when chasing or fleeing.
  53. #
  54. # @see_player = true
  55. # For events that require them to see the player first, use this script call
  56. # inside the movement boxes. This does not follow line of sight rules, which
  57. # means if there's a rock blocking you and the event, it will still see you.
  58. #
  59. #==============================================================================
  60. # ▼ Compatibility
  61. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  62. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  63. # it will run with RPG Maker VX without adjusting.
  64. #
  65. #==============================================================================
  66.  
  67. module YEA
  68.   module EVENT_CHASE
  69.  
  70.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  71.     # - General Settings -
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # These settings adjust some general settings regarding chasing and fleeing
  74.     # events. Adjust them as you see fit.
  75.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  76.     # The number of frames before a balloon can show up again on the same
  77.     # event. This is to prevent a massive balloon spamming. 60 frames = 1 sec.
  78.     # By default, 120 frames is 2 seconds.
  79.     ALERT_TIMER = 120
  80.  
  81.     # This is the default number of frames for how long the event will chase or
  82.     # flee from the player if used with @see_player = true. To change the amount
  83.     # individually for each event, use @sight_lock = x where x is a number.
  84.     # By default, 300 frames is 5 seconds.
  85.     SIGHT_LOCK = 300
  86.  
  87.   end # EVENT_CHASE
  88. end # YEA
  89.  
  90. #==============================================================================
  91. # ▼ Editting anything past this point may potentially result in causing
  92. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  93. # halitosis so edit at your own risk.
  94. #==============================================================================
  95.  
  96. #==============================================================================
  97. # ■ Game_Event
  98. #==============================================================================
  99.  
  100. class Game_Event < Game_Character
  101.  
  102.   #--------------------------------------------------------------------------
  103.   # alias method: update_self_movement
  104.   #--------------------------------------------------------------------------
  105.   alias game_event_update_self_movement_ecp update_self_movement
  106.   def update_self_movement
  107.     return if $imported["YEA-StopAllMovement"] && Switch.stop_npc_movement
  108.     update_chase_distance
  109.     update_flee_distance
  110.     if @stop_count > 0 && @chase_player
  111.       move_type_toward_player
  112.     elsif @stop_count > 0 && @flee_player
  113.       move_type_away_player
  114.     else
  115.       game_event_update_self_movement_ecp
  116.     end
  117.     update_alert_balloon
  118.   end
  119.  
  120.   #--------------------------------------------------------------------------
  121.   # new method: update_chase_distance
  122.   #--------------------------------------------------------------------------
  123.   def update_chase_distance
  124.     return if @erased
  125.     return if @chase_range.nil?
  126.     dis = distance_x_from($game_player.x).abs
  127.     dis += distance_y_from($game_player.y).abs
  128.     if chase_conditions
  129.       @chase_player = true
  130.       @move_speed = @chase_speed unless @chase_speed.nil?
  131.     else
  132.       @chase_player = false
  133.       @move_speed = @page.move_speed
  134.       @alert_player = false if @alert_timer <= 0
  135.     end
  136.   end
  137.  
  138.   #--------------------------------------------------------------------------
  139.   # new method: chase_conditions
  140.   #--------------------------------------------------------------------------
  141.   def chase_conditions
  142.     dis = distance_x_from($game_player.x).abs
  143.     dis += distance_y_from($game_player.y).abs
  144.     return true if @alert_lock > 0
  145.     return true if dis <= @chase_range and see_player?
  146.     if dis <= @chase_range && @see_player != true
  147.       @alert_lock = @sight_lock if @sight_lock != nil && @sight_lock > 0
  148.       return true
  149.     end
  150.     return false
  151.   end
  152.  
  153.   #--------------------------------------------------------------------------
  154.   # new method: update_flee_distance
  155.   #--------------------------------------------------------------------------
  156.   def update_flee_distance
  157.     return if @erased
  158.     return if @flee_range.nil?
  159.     dis = distance_x_from($game_player.x).abs
  160.     dis += distance_y_from($game_player.y).abs
  161.     if flee_conditions
  162.       @flee_player = true
  163.       @move_speed = @flee_speed unless @flee_speed.nil?
  164.     else
  165.       @flee_player = false
  166.       @move_speed = @page.move_speed
  167.       @alert_player = false if @alert_timer <= 0
  168.     end
  169.   end
  170.  
  171.   #--------------------------------------------------------------------------
  172.   # new method: flee_conditions
  173.   #--------------------------------------------------------------------------
  174.   def flee_conditions
  175.     dis = distance_x_from($game_player.x).abs
  176.     dis += distance_y_from($game_player.y).abs
  177.     return true if @alert_lock > 0
  178.     return true if dis <= @flee_range and see_player?
  179.     if dis <= @flee_range && @see_player != true
  180.       @alert_lock = @sight_lock if @sight_lock != nil && @sight_lock > 0
  181.       return true
  182.     end
  183.     return false
  184.   end
  185.  
  186.   #--------------------------------------------------------------------------
  187.   # new method: update_alert_balloon
  188.   #--------------------------------------------------------------------------
  189.   def update_alert_balloon
  190.     return if @erased
  191.     @alert_timer = 0 if @alert_timer.nil?
  192.     @alert_lock = 0 if @alert_lock.nil?
  193.     @alert_lock -= 1 if @alert_lock >= 0
  194.     return if @alert_balloon == nil || @alert_balloon == 0
  195.     if (@chase_player || @flee_player) && !@alert_player
  196.       @balloon_id = @alert_balloon
  197.       @alert_player = true
  198.       @alert_timer = YEA::EVENT_CHASE::ALERT_TIMER
  199.     end
  200.     @alert_timer -= 1 if @alert_player
  201.   end
  202.  
  203.   #--------------------------------------------------------------------------
  204.   # new method: see_player?
  205.   #--------------------------------------------------------------------------
  206.   def see_player?
  207.     return false if @see_player != true
  208.     sx = distance_x_from($game_player.x)
  209.     sy = distance_y_from($game_player.y)
  210.     if sx.abs > sy.abs
  211.       direction = sx > 0 ? 4 : 6
  212.     else
  213.       direction = sy > 0 ? 8 : 2
  214.     end
  215.     if direction == @direction
  216.       if @sight_lock == nil || @sight_lock <= 0
  217.         @sight_lock = YEA::EVENT_CHASE::SIGHT_LOCK
  218.       end
  219.       @alert_lock = @sight_lock
  220.       return true
  221.     end
  222.     return false
  223.   end
  224.  
  225.   #--------------------------------------------------------------------------
  226.   # new method: move_type_away_player
  227.   #--------------------------------------------------------------------------
  228.   def move_type_away_player
  229.     sx = @x - $game_player.x
  230.     sy = @y - $game_player.y
  231.     if sx.abs + sy.abs >= 20
  232.       move_random
  233.     else
  234.       case rand(6)
  235.       when 0..3;  move_away_from_player
  236.       when 4;     move_random
  237.       when 5;     move_forward
  238.       end
  239.     end
  240.   end
  241.  
  242. end # Game_Event
  243.  
  244. #==============================================================================
  245. #
  246. # ▼ End of File
  247. #
  248. #==============================================================================



它的效果、使用圖



說明
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.

RUBY 代码复制
  1. @chase_range = x

Event will chase the player after reaching x range.

RUBY 代码复制
  1. @flee_range = x

Event will flee from player after reaching x range.

RUBY 代码复制
  1. @chase_speed = x

Event will move at x speed when chasing.

RUBY 代码复制
  1. @flee_speed = x

Event will move at x speed when fleeing.

RUBY 代码复制
  1. @sight_lock = x

Event will chase/flee from player for x frames.

RUBY 代码复制
  1. @alert_balloon = x

Event will show ballon ID x when chasing or fleeing.

RUBY 代码复制
  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
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
758
在线时间
2065 小时
注册时间
2011-10-3
帖子
1686
5
发表于 2012-8-17 16:33:01 | 只看该作者
本帖最后由 布里蓝 于 2012-8-17 16:34 编辑


自定义移动


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

点评

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-17 09:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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