Game Development Community

Loading specific missions

by Joseph Jonathan · in Torque Game Engine · 10/29/2006 (7:40 am) · 2 replies

Hello all I am a newer programmer and I am making a Special Forces game, and I need a little help.

On my Main Menu GUI I have the following code, as one of my button controls.

Quote: new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "top";
position = "400 137";
extent = "110 20";
minExtent = "8 8";
visible = "1";
command = "SM_StartMission(Training);";
text = "Training...";
groupNum = "-1";
buttonType = "PushButton";
helpTag = "0";
};

I have a mission file named training, and the map name is training. I am wondering what I have to put instead of "SM_StartMission(training);"; to allow players to click on this button and start the training map? Thanks for the help.

~Joseph-Jonathan Salzano

#1
10/29/2006 (4:46 pm)
Well you dould try..
new GuiButtonCtrl() {
   profile = "GuiButtonProfile";
   horizSizing = "right";
   vertSizing = "top";
   position = "400 137";
   extent = "110 20";
   minExtent = "8 8";
   visible = "1";
   command = "startServerWith("\Training\");";
   text = "Training...";
   groupNum = "-1";
   buttonType = "PushButton";
   helpTag = "0";
};

function startServerWith(%mission)
{
   createServer("MultiPlayer", expandFileName("~/data/missions/"@%mission@".mis"));
   %conn = new GameConnection(ServerConnection);
   RootGroup.add(ServerConnection);
   %conn.setConnectArgs($pref::Player::Name);
   %conn.setJoinPassword($Client::Password);
   %conn.connectLocal();
}
#2
10/30/2006 (8:04 am)
Wow Thanks It works!!!!