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.

Script Transfer

What is the code in order to transfer the character to map from inside a script?

Say I want the character to start on the map instead of the title screen? Something to the like.
 
The title screen handles a lot of the initialization stuff for the database and such.

You'd first of all need to run this code at least at some point prior to going to the title map/screen:

Code:
if $BTEST
      battle_test
      return
    end
    # Load database
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    # Make system object
    $game_system = Game_System.new

You'll also need this:

Code:
$game_system.se_play($data_system.decision_se)
    # Stop BGM
    Audio.bgm_stop
    # Reset frame count for measuring play time
    Graphics.frame_count = 0
    # Make each type of game object
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    # Set up initial party
    $game_party.setup_starting_members

This is the code to actually setup the map and get started.
Code:
$game_map.setup($data_system.start_map_id)
    # Move player to initial position
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    # Refresh player
    $game_player.refresh
    # Run automatic change for BGM and BGS set with map
    $game_map.autoplay
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $scene = Scene_Map.new
 
YOu should've entitled your post TRANSFER PLAYER script... I thought this topic discusses about how to.... TRANSFER SCRIPTS?... :D

Uhmm, you can BYPASS the title screen so that when you open the game, it will automatically transfer the player on your first map...

Search for PUNKID's dynamic title screen...
 

Ter13

Member

Aye indeed, basically don't think of the Map, menus, and the title screen as seperate places in the game. In essence, they all derive from one object. The scene. Essentially, every modern game programmed in a practical way executes in a linear procedure:

<START>
game_init()
game_run()
game_title()
game_map()
<END>

Of course, as all functions in one thread run in a linear way, game_map() does not stop running until all subfunctions of that procedure come to an end, so having a conditional scene, such as the menu, or the game_over screen, which are activated by certain circumstances, is a continuation of the game_map function.

Maybe a bit technical, but I just kind of figured a little explanation could further help you be confused by the amazing world that is programming... Even though Ruby isn't REAL programming by any stretch...
 
If you are using the SDK, all you have to do is this:

Code:
class Scene_Title
  alias seph_titleskip_scnttl_mdb main_database
  def main_database
    seph_titleskip_scnttl_mdb
    command_new_game
  end
end

This actually maintains the most compatability, as scripts that add $game data to your game will use the command_new_game method to add those in.

This will load the data from the database, then immediately jump and load all the new game session data.

Most people just use the "eplace main with this" method, which works fine and dandy for default scripts, but and $game_blah objects added in the Title menu will never be initialized.
 

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