Project1

标题: 【事件全地图自主移动】 [打印本页]

作者: VIPArcher    时间: 2015-1-18 15:53
标题: 【事件全地图自主移动】
很简单的脚本。默认脚本事件离开地图范围后就会停止自主移动。这脚本就是为了解除这种限制的
在事件里注释上 <move> 的事件就可以全地图自主移动。不会因为远离画面而停下。
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 事件全地图自主移动
  3. # By :VIPArcher
  4. #  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
  5. # 说明:
  6. #     事件内容里注释有 <move> 的事件可以全地图自主移动,不会因为不在视
  7. #     野范(画面)围内而停下,(默认事件是不在视野范围内就停止自主移动的。
  8. #==============================================================================
  9. $VIPArcherScript ||= {};$VIPArcherScript[:map_self_movem] = 20150118
  10. #-------------------------------------------------------------------------------
  11. class Game_Event
  12.   #--------------------------------------------------------------------------
  13.   # ● 自动移动的更新
  14.   #--------------------------------------------------------------------------
  15.   alias self_movement update_self_movement
  16.   def update_self_movement
  17.     return self_movement if note_move?
  18.     if @stop_count > stop_count_threshold
  19.       case @move_type
  20.       when 1;  move_type_random
  21.       when 2;  move_type_toward_player
  22.       when 3;  move_type_custom
  23.       end
  24.     end
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # ● 判定是否注释有全地图自主移动
  28.   #--------------------------------------------------------------------------
  29.   def note_move?
  30.     return true if @list.nil?
  31.     @list.each do |command|
  32.       if command.code == 108 or command.code == 408
  33.         command.parameters.each do |line|
  34.           return false if line.include?("<move>")
  35.         end
  36.       end
  37.     end
  38.   end
  39. end





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1