Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Storing players x, y an current map id to use in script?

Basicly at the start of this script I transfer the player to new map. How would i later in that script return the player to where he/she was before? What im asking is what is the syntax to store x, y and current map id for the player for later use in a script?

Thanks, SoBe
 
Essentially,
Code:
 

    @px     = $game_player.x            # Stores player's x-coordinate in @px

    @py     = $game_player.y            # Stores player's y-coordinate in @py

    @mid    = $game_map.map_id          # Stores current map id in @mid

 

And to teleport the player there:
Code:
 

          $game_temp.player_transferring = true

          $game_temp.player_new_map_id = @mid

          $game_temp.player_new_x = @px

          $game_temp.player_new_y = @py

           $game_temp.player_transferring = false

 
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top