class Game_Character attr_accessor :move_speed end class Game_Map attr_accessor :oldroute attr_accessor :oldeventsnums attr_reader :map alias initialize_old initialize def initialize initialize_old @oldroute = [] @oldeventsnums = 0 end end class Game_Player < Game_Character alias update_old update def update last_moving = moving? unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing case Input.dir4 when 2 if passable?(@x, @y, 2) $game_map.oldroute.push([@x,@y,2]) if $game_map.oldroute.size == $game_party.actors.size $game_map.oldroute.shift end end move_down when 4 if passable?(@x, @y, 4) $game_map.oldroute.push([@x,@y,4]) if $game_map.oldroute.size == $game_party.actors.size $game_map.oldroute.shift end end move_left when 6 if passable?(@x, @y, 6) $game_map.oldroute.push([@x,@y,6]) if $game_map.oldroute.size == $game_party.actors.size $game_map.oldroute.shift end end move_right when 8 if passable?(@x, @y, 8) $game_map.oldroute.push([@x,@y,8]) if $game_map.oldroute.size == $game_party.actors.size $game_map.oldroute.shift end end move_up end end update_old end end class Interpreter def command_129 actor = $game_actors[@parameters[0]] if actor != nil if @parameters[1] == 0 if @parameters[2] == 1 $game_actors[@parameters[0]].setup(@parameters[0]) end $game_party.add_actor(@parameters[0]) $scene.del_follow $scene.follow_system else $game_party.remove_actor(@parameters[0]) $scene.del_follow $scene.follow_system end end return true end end class Scene_Map alias main_old main def main @spriteset = Spriteset_Map.new if $game_variables[1000] == 0 follow_system $game_variables[1000] = 1 end main_old end alias update_old update def update follow_system_update update_old end alias transfer_player_old transfer_player def transfer_player $game_temp.player_transferring = false if $game_map.map_id != $game_temp.player_new_map_id del_follow $game_map.setup($game_temp.player_new_map_id) end $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y) follow_system transfer_player_old end def follow_system $game_map.oldeventsnums = $game_map.events.size if $game_party.actors.size>=2 for i in 2..$game_party.actors.size # 为事件加上名字考虑做srpg用 name = "我军,"+i.to_s character_name = $game_party.actors[i-1].character_name party_event($game_player.x,$game_player.y,name,character_name) $game_map.oldroute.push([$game_player.x,$game_player.y,$game_player.direction]) end end end def del_follow $game_map.oldroute.clear for i in 1..($game_map.events.size-$game_map.oldeventsnums) $game_map.events.delete($game_map.oldeventsnums+i) end end def party_event(x,y,name,character_name) $game_map.events[$game_map.events.size+1] = Game_Event.new($game_map.map_id,produce_party_event(x,y,name,character_name)) $game_map.map.events[$game_map.events.size] = produce_party_event(x,y,name,character_name) @spriteset.dispose @spriteset = Spriteset_Map.new end def produce_party_event(x,y,name,character_name) e = RPG::Event.new(x,y) e.id = $game_map.events.size e.name = name e.pages = [RPG::Event::Page.new] e.pages[0].graphic = RPG::Event::Page::Graphic.new e.pages[0].graphic.character_name = character_name e.pages[0].through = true return e end def follow_system_update num = $game_map.oldeventsnums n = $game_player.move_speed s=$game_map.oldroute.size-1 if s>=0 $game_map.events[num+1].move_speed = n if $game_map.events[num+1].x>$game_map.oldroute[s][0] $game_map.events[num+1].move_left elsif $game_map.events[num+1].x<$game_map.oldroute[s][0] $game_map.events[num+1].move_right elsif $game_map.events[num+1].y>$game_map.oldroute[s][1] $game_map.events[num+1].move_up elsif $game_map.events[num+1].y<$game_map.oldroute[s][1] $game_map.events[num+1].move_down end end if s>=1 $game_map.events[num+2].move_speed = n if $game_map.events[num+2].x>$game_map.oldroute[s-1][0] $game_map.events[num+2].move_left elsif $game_map.events[num+2].x<$game_map.oldroute[s-1][0] $game_map.events[num+2].move_right elsif $game_map.events[num+2].y>$game_map.oldroute[s-1][1] $game_map.events[num+2].move_up elsif $game_map.events[num+2].y<$game_map.oldroute[s-1][1] $game_map.events[num+2].move_down end end if s>=2 $game_map.events[num+3].move_speed = n if $game_map.events[num+3].x>$game_map.oldroute[s-2][0] $game_map.events[num+3].move_left elsif $game_map.events[num+3].x<$game_map.oldroute[s-2][0] $game_map.events[num+3].move_right elsif $game_map.events[num+3].y>$game_map.oldroute[s-2][1] $game_map.events[num+3].move_up elsif $game_map.events[num+3].y<$game_map.oldroute[s-2][1] $game_map.events[num+3].move_down end end end end
|