Transfer player on game start

Discussion in 'Learning Ruby and RGSSx' started by Yuuta Kirishima, Nov 4, 2016.

    Tags:
  1. Yuuta Kirishima

    Yuuta Kirishima Software Engineer/Professional Mayonnaise Player Veteran

    Messages:
    548
    Likes Received:
    131
    Location:
    North Carolina
    First Language:
    Engilsh
    Primarily Uses:
    RMMV
    Is there a method that when the game starts that it transfers the player to a certain location rather they load a save or not?


    For example, I save my game on a map, close it, open the game again, I load my save but instead of being on the map that I saved on I am on a predefined map.
     
    #1
  2. KingKraken

    KingKraken Veteran Veteran

    Messages:
    126
    Likes Received:
    29
    Location:
    Colorado, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm not in a position to go poke around my rpgmaker, but you could probably do something like a global condition branch, that when a game is saved and then exited, that it teleport the player to those specific coordinates before the exit/save.

    Otherwise you might have to have a script created that can do that.
     
    #2
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,184
    Likes Received:
    11,053
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    For new game, just put the player's starting location where you want them to be.


    When loading from a save file, I'd look at Scene_Load.prototype.reloadMapIfUpdated - comment out the condition and use values rather than variables for the reserveTransfer() call.
     
    #3
  4. Yuuta Kirishima

    Yuuta Kirishima Software Engineer/Professional Mayonnaise Player Veteran

    Messages:
    548
    Likes Received:
    131
    Location:
    North Carolina
    First Language:
    Engilsh
    Primarily Uses:
    RMMV
    Pretty sure that doesn't exist in ace ;) But thank you, gave me an idea where to look.
     
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,184
    Likes Received:
    11,053
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Sorry - for some reason I thought you were talking MV.  However, there IS a load_map_if_updated method in Ace, in the DataManager script.  And it's even easier than MV:

    Code:
      #--------------------------------------------------------------------------
      # * Reload Map if Data Is Updated
      #--------------------------------------------------------------------------
      def self.reload_map_if_updated
        if $game_system.version_id != $data_system.version_id
          $game_map.setup($game_map.map_id)
          $game_player.center($game_player.x, $game_player.y)
          $game_player.make_encounter_count
        end
      end
    
    Again, get rid of the conditions surrounding the block, and replace the map and player coordinates with the values you want to use.  Easy peasy :)
     
    #5
    Yuuta Kirishima likes this.
  6. Yuuta Kirishima

    Yuuta Kirishima Software Engineer/Professional Mayonnaise Player Veteran

    Messages:
    548
    Likes Received:
    131
    Location:
    North Carolina
    First Language:
    Engilsh
    Primarily Uses:
    RMMV
    Thanks, works perfectly!
     
    #6
  7. SaburoX

    SaburoX Veteran Veteran

    Messages:
    66
    Likes Received:
    7
    DP3 has a script snippet that lets you run a common event on loading. You could just use that and handle the transfer there. Maybe use a conditional branch so that you can change where the spawn point is.
     
    #7

Share This Page