查看: 2722|回复: 4

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

[复制链接]
梦石
0
星屑
5241
在线时间
760 小时
注册时间
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
星屑
5241
在线时间
760 小时
注册时间
2009-1-21
回帖
236
 楼主| 发表于 2012-8-17 16:16:32 | 显示全部楼层


腳本

[pre lang="ruby" line="1"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Event Chase Player v1.00
# -- Last Updated: 2012.01.05
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================

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

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.05 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script allows you to make events that will chase the player or flee from
# the player when the player enters within range of the event or when the event
# sees the player.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Move Script Call - Open up the script call in the event move menu and use:
# -----------------------------------------------------------------------------
# Add these variable changes to an event's move route to use them.
#
# @chase_range = x
# Event will chase the player after reaching x range.
#
# @flee_range = x
# Event will flee from player after reaching x range.
#
# @chase_speed = x
# Event will move at x speed when chasing.
#
# @flee_speed = x
# Event will move at x speed when fleeing.
#
# @sight_lock = x
# Event will chase/flee from player for x frames.
#
# @alert_balloon = x
# Event will show ballon ID x when chasing or fleeing.
#
# @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.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
  module EVENT_CHASE
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - General Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These settings adjust some general settings regarding chasing and fleeing
    # events. Adjust them as you see fit.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # The number of frames before a balloon can show up again on the same
    # event. This is to prevent a massive balloon spamming. 60 frames = 1 sec.
    # By default, 120 frames is 2 seconds.
    ALERT_TIMER = 120
   
    # This is the default number of frames for how long the event will chase or
    # flee from the player if used with @see_player = true. To change the amount
    # individually for each event, use @sight_lock = x where x is a number.
    # By default, 300 frames is 5 seconds.
    SIGHT_LOCK = 300
   
  end # EVENT_CHASE
end # YEA

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

#==============================================================================
# ■ Game_Event
#==============================================================================

class Game_Event < Game_Character
  
  #--------------------------------------------------------------------------
  # alias method: update_self_movement
  #--------------------------------------------------------------------------
  alias game_event_update_self_movement_ecp update_self_movement
  def update_self_movement
    return if $imported["YEA-StopAllMovement"] && Switch.stop_npc_movement
    update_chase_distance
    update_flee_distance
    if @stop_count > 0 && @chase_player
      move_type_toward_player
    elsif @stop_count > 0 && @flee_player
      move_type_away_player
    else
      game_event_update_self_movement_ecp
    end
    update_alert_balloon
  end
  
  #--------------------------------------------------------------------------
  # new method: update_chase_distance
  #--------------------------------------------------------------------------
  def update_chase_distance
    return if @erased
    return if @chase_range.nil?
    dis = distance_x_from($game_player.x).abs
    dis += distance_y_from($game_player.y).abs
    if chase_conditions
      @chase_player = true
      @move_speed = @chase_speed unless @chase_speed.nil?
    else
      @chase_player = false
      @move_speed = @page.move_speed
      @alert_player = false if @alert_timer <= 0
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: chase_conditions
  #--------------------------------------------------------------------------
  def chase_conditions
    dis = distance_x_from($game_player.x).abs
    dis += distance_y_from($game_player.y).abs
    return true if @alert_lock > 0
    return true if dis <= @chase_range and see_player?
    if dis <= @chase_range && @see_player != true
      @alert_lock = @sight_lock if @sight_lock != nil && @sight_lock > 0
      return true
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # new method: update_flee_distance
  #--------------------------------------------------------------------------
  def update_flee_distance
    return if @erased
    return if @flee_range.nil?
    dis = distance_x_from($game_player.x).abs
    dis += distance_y_from($game_player.y).abs
    if flee_conditions
      @flee_player = true
      @move_speed = @flee_speed unless @flee_speed.nil?
    else
      @flee_player = false
      @move_speed = @page.move_speed
      @alert_player = false if @alert_timer <= 0
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: flee_conditions
  #--------------------------------------------------------------------------
  def flee_conditions
    dis = distance_x_from($game_player.x).abs
    dis += distance_y_from($game_player.y).abs
    return true if @alert_lock > 0
    return true if dis <= @flee_range and see_player?
    if dis <= @flee_range && @see_player != true
      @alert_lock = @sight_lock if @sight_lock != nil && @sight_lock > 0
      return true
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # new method: update_alert_balloon
  #--------------------------------------------------------------------------
  def update_alert_balloon
    return if @erased
    @alert_timer = 0 if @alert_timer.nil?
    @alert_lock = 0 if @alert_lock.nil?
    @alert_lock -= 1 if @alert_lock >= 0
    return if @alert_balloon == nil || @alert_balloon == 0
    if (@chase_player || @flee_player) && !@alert_player
      @balloon_id = @alert_balloon
      @alert_player = true
      @alert_timer = YEA::EVENT_CHASE::ALERT_TIMER
    end
    @alert_timer -= 1 if @alert_player
  end
  
  #--------------------------------------------------------------------------
  # new method: see_player?
  #--------------------------------------------------------------------------
  def see_player?
    return false if @see_player != true
    sx = distance_x_from($game_player.x)
    sy = distance_y_from($game_player.y)
    if sx.abs > sy.abs
      direction = sx > 0 ? 4 : 6
    else
      direction = sy > 0 ? 8 : 2
    end
    if direction == @direction
      if @sight_lock == nil || @sight_lock <= 0
        @sight_lock = YEA::EVENT_CHASE::SIGHT_LOCK
      end
      @alert_lock = @sight_lock
      return true
    end
    return false
  end
  
  #--------------------------------------------------------------------------
  # new method: move_type_away_player
  #--------------------------------------------------------------------------
  def move_type_away_player
    sx = @x - $game_player.x
    sy = @y - $game_player.y
    if sx.abs + sy.abs >= 20
      move_random
    else
      case rand(6)
      when 0..3;  move_away_from_player
      when 4;     move_random
      when 5;     move_forward
      end
    end
  end
  
end # Game_Event

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]


它的效果、使用圖
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.

[pre lang="ruby" line="1"]@chase_range = x[/pre]
Event will chase the player after reaching x range.

[pre lang="ruby" line="1"]@flee_range = x[/pre]
Event will flee from player after reaching x range.

[pre lang="ruby" line="1"]@chase_speed = x[/pre]
Event will move at x speed when chasing.

[pre lang="ruby" line="1"]@flee_speed = x[/pre]
Event will move at x speed when fleeing.

[pre lang="ruby" line="1"]@sight_lock = x[/pre]
Event will chase/flee from player for x frames.

[pre lang="ruby" line="1"]@alert_balloon = x[/pre]
Event will show ballon ID x when chasing or fleeing.

[pre lang="ruby" line="1"]@see_player = true[/pre]
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.

在本版发帖返回顶部