Game Development Community

Auto Loading Levels

by Chris Everhart · in Torque Game Engine · 05/27/2010 (8:26 pm) · 3 replies

Hi guys! I've been toying around with TGE for a bit now and was wondering how to make it so that it autoloads a mission rather than kicking up to the mission select menu. Right now, I have a class selection menu that leads to the mission select but I've only got the one mission. I'm basically just looking to simplify the process of getting into the game.

About the author

I used to work in the auto racing industry, but I got tired of it. I'm going to college to learn more about game and simulation design. Hopefully someday, I'll land a job with a game company.


#1
05/28/2010 (5:14 am)
There is a function called "SM_StartMission".

function SM_StartMission()
{
   %id = SM_missionList.getSelectedId();
   %mission = getField(SM_missionList.getRowTextById(%id), 1);

   if ($pref::HostMultiPlayer)
      %serverType = "MultiPlayer";
   else
      %serverType = "SinglePlayer";

   createServer(%serverType, %mission);
   %conn = new GameConnection(ServerConnection);
   RootGroup.add(ServerConnection);
   %conn.setConnectArgs($pref::Player::Name);
   %conn.setJoinPassword($Client::Password);
   %conn.connectLocal();
}

The important part is "createServer..." and below. But be aware, loading a mission in TGE requires some knowledge.

Auto-loading a mission after startup:

Look into client/ui/StartupGui.gui. Somewhere around line 39 you will find the function "checkStartupDone". Comment out "loadMainMenu();" and execute your mission from there.

#2
05/28/2010 (5:23 am)
Hey Chris, you could try this, it should work in 1.5.2 also and you can load a mission from command line also.

www.torquepowered.com/community/forums/viewthread/37210
www.torquepowered.com/community/forums/viewthread/60155

Good luck and hope it helps.......
#3
05/28/2010 (11:36 am)
Thanks for the advice guys! It helped a lot!