Noob question - Move player "Set event location"-like

● ARCHIVED · READ-ONLY
Started by gufino2 5 posts View original ↗
  1. Hello guys,

    in an autorun event I want to "teleport" the main character to another location of the current map. I noticed I can't use "Set event location" to move the main player, and I'd like to know what's the correct way to do it. Should I simply use "Transfer player" targeting the same map and disabling fade? Won't this trigger some sort of map reload/events restart?

    Thanks :)

    EDIT: I looked into the Game_Player script:

     #--------------------------------------------------------------------------

      # * Execute Player Transfer

      #--------------------------------------------------------------------------

      def perform_transfer

        if transfer?

          set_direction(@new_direction)

          if @new_map_id != $game_map.map_id

            $game_map.setup(@new_map_id)

            $game_map.autoplay

          end

          moveto(@new_x, @new_y)

          clear_transfer_info

        end

      end

     

    So it looks like moving the player into the same map does not retrigger map's setup etc. etc.

     

    So I guess "Transfer player" is the right way to do it. Or use "script: $game_player.moveto(newx,newy)" maybe :)

     

    Feel free to post corrections if my assumptions are wrong. Thanks !
  2. gufino2 said:
    Hello guys,

    in an autorun event I want to "teleport" the main character to another location of the current map. I noticed I can't use "Set event location" to move the main player, and I'd like to know what's the correct way to do it. Should I simply use "Transfer player" targeting the same map and disabling fade? Won't this trigger some sort of map reload/events restart?

    Thanks :)
    I just set up a little experiment to check and I can say for sure that it does not "trigger some sort of map reload/events restart".

    I set up some dummy NPCs to talk to that "Erase Event" when triggered. I talked to them then teleported to another spot on the same map. They stayed gone which means the map was not reloaded.

    Saving on a map and restarting from the save file also will not "reload" it, but leaving the map and reentering it will.
  3. Transferring a player to the same map does not require the map to be reloaded. So no, the "startup" autorun/parallel events will not be reloaded and rerun.


    You could have just tried it and had your answer straight away :)
  4. Ehehe that's exactly what I did, but when my "coder-mind" kicked in, the best way to try it was to analyze the scripts to understand how it actually works :p
  5. :)


    Okay, for your coder-mind ...


    Autorun and parallel process events are kicked off from Game_Map's setup method. This is only called when the player transfers from one map to another (method in Game_Player, which I can't remember the name of and don't have in front of me). That Game_Player method checks to see if the current map number is the same as the last one, and it only calls Game_Map.setup if they are different.


    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.