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.

[Resolved] Map transfering

Status
Not open for further replies.
What would be the code to transfer the player to another map eg. from map 001 to map 002.

I know almost all map syntax there is except for transfering from one map to another.
 
If you look under Interpreter 5, there's the code for transferring a player:
Code:
#--------------------------------------------------------------------------
  # * Transfer Player
  #--------------------------------------------------------------------------
  def command_201
    # If in battle
    if $game_temp.in_battle
      # Continue
      return true
    end
    # If transferring player, showing message, or processing transition
    if $game_temp.player_transferring or
       $game_temp.message_window_showing or
       $game_temp.transition_processing
      # End
      return false
    end
    # Set transferring player flag
    $game_temp.player_transferring = true
    # If appointment method is [direct appointment]
    if @parameters[0] == 0
      # Set player move destination
      $game_temp.player_new_map_id = @parameters[1]
      $game_temp.player_new_x = @parameters[2]
      $game_temp.player_new_y = @parameters[3]
      $game_temp.player_new_direction = @parameters[4]
    # If appointment method is [appoint with variables]
    else
      # Set player move destination
      $game_temp.player_new_map_id = $game_variables[@parameters[1]]
      $game_temp.player_new_x = $game_variables[@parameters[2]]
      $game_temp.player_new_y = $game_variables[@parameters[3]]
      $game_temp.player_new_direction = @parameters[4]
    end
    # Advance index
    @index += 1
    # If fade is set
    if @parameters[5] == 0
      # Prepare for transition
      Graphics.freeze
      # Set transition processing flag
      $game_temp.transition_processing = true
      $game_temp.transition_name = ""
    end
    # End
    return false
  end

Do you need help figuring out what any part does?  (I haven't really looked through it yet, so I'm not going to decipher and explain it if I don't need to)

I think there's also another way in which you create a new scene_map or something, but as I'm still new to this stuff, I'm not really sure.  Maybe someone else can answer?
 
No thats fine I understand, thanks moogleking.
Code:
      $game_temp.player_new_map_id = @parameters[1]
      $game_temp.player_new_x = @parameters[2]
      $game_temp.player_new_y = @parameters[3]
      $game_temp.player_new_direction = @parameters[4]

For example would turn into
Code:
      $game_temp.player_new_map_id = 2 # number of desired map
      $game_temp.player_new_x = 20 # desired x co-ordinate
      $game_temp.player_new_y = 20 # desired y co-ordinate
      $game_temp.player_new_direction = 8 # desired facing direction in this case "UP"

Just incase people look at this page and go "I don't understand" there are quite a few of those where nobody posts what they figured out.
 
Ah I never thought about that I just quickly read the code moogleking provided from interpreter 5 and worked out what it did I didn't actually test it out, thanks to you and moogleking for helping me out.

Oh and thanks for the code to add to my mini script package 2 and thanks for the blacksmith module.
 
Status
Not open for further replies.

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