Game Development Community

loading multiple missions

by Gary Roberson · in Torque Game Engine · 09/04/2018 (7:03 pm) · 4 replies

I'm looking for a way to load multiple mission files. Here is what I got so far :

function loadMyMission(int Mission)
{
   // make sure we are not connected to a server already
   disconnect();
   
   // Create the server and load the mission
   switch Mission
   {
		case 1 : createServer("SinglePlayer", expandFilename("./data/missions/MyWorld.mis")); break;
		case 2 : createServer("SinglePlayer", expandFilename("./data/missions/flat.mis"));
   }

I've modified the code in main.cs to add a parameter in the loadMyMission() function hoping that the variable will be used in the following switch selection statement.
At the moment my GUI consists of 2 buttons, Start and Continue one that will load the MyWorld.mis file while the other load in the flat file.

#1
09/05/2018 (11:39 am)
Why are you passing the Mission parameter as an int?
By the looks of it you're doing this in script, and I don't think there's such thing as int in Torque script.
Maybe it should be just the %missionVar instead.
Also, I don't think 'break' is needed.

function loadMyMission(%missionVar)
{
   // make sure we are not connected to a server already
   disconnect();
   
   // Create the server and load the mission
   switch(%missionVar)
   {
		case 1 : createServer("SinglePlayer", expandFilename("./data/missions/MyWorld.mis"));
		case 2 : createServer("SinglePlayer", expandFilename("./data/missions/flat.mis"));
   }
#2
09/05/2018 (11:43 pm)
Sorin,

Whatever I have, it goes to you (as long as it doesn't put me in the beggars house).

To respond to your comment, I use the int &??& due to my unfamiliarity with TorqueScript. I am primarily a C++ programmer, Borland (Embarcadero) style. I use VC primarily to test out code written by other programmers. I only have two books for the Torque engine, 3D Game Programming All-In-One and T3D Cookbook. The first one isn't very code heavy, its like a primer on the TGE interface, and I havn't looked at the cookbook very much.
#3
09/06/2018 (8:16 am)
@Gary - You might find this very useful: TorqueScript
#4
09/13/2018 (11:11 pm)
Thank you Mr. Perry.
Same compliments to you that I gave to Sorin!