Fixed. See below for the script if you want it.
Code:
#===============================================================================
# Player-Event Swap, Original By PK8, Edited and adapted to a script by Tempus
#-------------------------------------------------------------------------------
# Details:
# Swaps the players position, sprite and direction with an event
# (default ID 10)
# When the player is in control of the event, $player is set to 2.
# for example, you can check if the player is currently controlling the
# event by checking against $player. ($player == 2 in a call script
# conditional branch)
#===============================================================================
EVENTID = 10
class Game_Actor < Game_Battler
attr_accessor :character_name
attr_accessor :character_hue
end
class Game_Event < Game_Character
attr_accessor :character_name
attr_accessor :character_hue
end
class Game_Character
attr_accessor :direction
attr_accessor :through
end
class Scene_Map
alias tsswap_main main
def main
tsswap_main
if $game_variables[EVENTID] == 0
$game_variables[EVENTID] = 1
end
@tsid = $game_variables[EVENTID]
@ts_x = $game_player.x
@ts_y = $game_player.y
@ts_d = $game_player.direction
@ts_s = $game_actors[1].character_name
@ts_sv = $game_map.events[@tsid].character_name
$player = 1
end
alias tsswap_update update
def update
tsswap_update
if $game_variables[EVENTID] == 0
$game_variables[EVENTID] = 1
end
@tsid = $game_variables[EVENTID]
if Input.trigger?(Input::A)
unless $game_system.map_interpreter.running?
@ts_x = $game_player.x
@ts_y = $game_player.y
@ts_d = $game_player.direction
@ts_s = $game_actors[1].character_name
@ts_sv = $game_map.events[@tsid].character_name
$game_player.moveto($game_map.events[@tsid].x, $game_map.events[@tsid].y)
$game_actors[1].character_name = @ts_sv
$game_player.direction = $game_map.events[@tsid].direction
$game_map.events[@tsid].moveto(@ts_x, @ts_y)
$game_map.events[@tsid].character_name = @ts_s
$game_map.events[@tsid].direction = @ts_d
if $player == 2
$player = 1
else
$player = 2
end
$game_player.refresh
end
end
end
end