# 移動ルート記憶スクリプト v1.00 by tonbi # # ・使用方法 #  新規セッションにコピペ # イベントのスクリプトコマンドで、以下のスクリプトで制御する。 # # route_capture_start(id) # 取得の開始 # route_capture_end # 取得の終了 # route_capture_play(id,skippable,repeat) # 再生する # # id 対象イベントのID (-1:プレイヤー 0:そのイベント) # skippable 移動できない場合は無視 (true:オン false:オフ) # repeat 指定動作を繰り返す (true:オン false:オフ) # # 省略時は、id = 0 , skippable = false , repeat = false # # ・注意事項 # ななめ移動や、その場での向き変更などは取得できません。 # #========================================================================== # ■ Game_System #========================================================================== class Game_System attr_accessor :routechara # 取得対象のキャラ attr_accessor :routelist # 取得したリスト #-------------------------------------------------------------------------- # ● 続・初期化 #-------------------------------------------------------------------------- alias initialize_tonbi7 initialize def initialize initialize_tonbi7 @routechara = nil @routelist = [] end end #========================================================================== # ■ Game_Character #========================================================================== class Game_Character #-------------------------------------------------------------------------- # ● 続・歩数増加 #-------------------------------------------------------------------------- alias increase_steps_tonbi7 increase_steps def increase_steps increase_steps_tonbi7 # 取得対象のIDと同じなら、向きから直前の移動方向取得 if @id == $game_system.routechara # 記憶変数に記憶 $game_system.routelist.push(@direction) end end end #========================================================================== # ■ Game_System #========================================================================== class Interpreter #-------------------------------------------------------------------------- # ● キャプチャー開始 # id = [0:このイベント] [-1:プレイヤー] [それ以外:そのイベント] #-------------------------------------------------------------------------- def route_capture_start(id = @event_id) if id == 0 id = @event_id elsif id == -1 id = 0 end $game_system.routechara = id $game_system.routelist=[] return true end #-------------------------------------------------------------------------- # ● キャプチャー終了 #-------------------------------------------------------------------------- def route_capture_end $game_system.routechara = nil return true end #-------------------------------------------------------------------------- # ● 動作を再生 # id = 対象 [0:このイベント] [-1:プレイヤー] [それ以外:そのイベント] # skippable = 移動できない場合は無視 [true:オン] [false:オフ] # repeat = 指定動作を繰り返す [true:オン] [false:オフ] #-------------------------------------------------------------------------- def route_capture_play(id = 0, skippable = false, repeat = false) # ルート用変数作成 route = RPG::MoveRoute.new route.repeat = repeat route.skippable = skippable # ルートを作成 for i in 0...$game_system.routelist.size case $game_system.routelist[i] when 2 route.list[i] = RPG::MoveCommand.new(1,[]) when 4 route.list[i] = RPG::MoveCommand.new(2,[]) when 6 route.list[i] = RPG::MoveCommand.new(3,[]) when 8 route.list[i] = RPG::MoveCommand.new(4,[]) end end route.list.push(RPG::MoveCommand.new(0,[])) # キャラクターを取得 character = get_character(id) # キャラクターが存在しない場合 if character == nil # 継続 return true end # 移動ルートを強制 character.force_move_route(route) # 継続 return true end end