Game Development Community

Having multiple missions in Torque?

by Shane09 · in General Discussion · 10/13/2008 (7:06 pm) · 6 replies

Hello. As you all know, games have levels, or missions. I have done some searching but I did not find what I was looking for. I hope someone can point me to a resource or something on this topic.

Ok. I want my game to have multiple levels. When you beat, or complete, one level, you can move on to the next one. I have a few questions on how to do this. How I think you do this is you make a GUI called "Campaign" and in that you have the listed missions. Would I script the GUIs so that when you click on the mission level name, it loads the level? Also, how would I make the levels so they are locked, so that way you can not access them until you beat the previous ones. Or at least the required ones. I would like to add some bonus ones. Also, some games, are not like the way I described. There is no missions / campaign GUI. They are set up so you complete the mission. Then there is a cut-scene, and bang. The next mission automatically loads itself. Is Torque capable of this? I am looking forward to some responses on how to do this for both my ideas.

Thank you for your time. Thank you x2 for answering this ( if you do ).

EDIT: A example is kind of like GTA: Vice City and all the other recent ones, like GTA: 4, etc... I like how they go to a place, do a mission, they finish the mission, a quick movie type scene, and then they can do another mission. And the beauty of this is that, the player himself does not have to save and go back and load the next mission. It loads up for them. Of course they have to drive to it though. But hey, I figured after the player does the actual mission, they start a mission where they drive around to find a mission. I guess that counts as a mission too, eh? That would be the smart way of doing it while using Torque.

EDIT: Also, this is probably off topic, but... When a mission loads, it says "this is the tutorial.base example mission" or it says "this is the starter.racing vehicle demo example". How do I change those so If I use my first method, I can describe the mission?

#1
10/13/2008 (8:11 pm)
Torque has this functionality built in. If you look in "server/scipts/game.cs" there is a function:
[code]
function onMissionEnded()
{
// Called by endMission(), right before the mission is destroyed

// Normally the game should be ended first before the next
// mission is loaded, this is here in case loadMission has been
// called directly. The mission will be ended if the server
// is destroyed, so we only need to cleanup here.
// deactivatePackage($Server::GameType @ "Game");
cancel($Game::Schedule);
$Game::Running = false;
$Game::Cycling = false;
}
[/quote]
Cycling is what you are after. It automatically loads the next mission in the list once a mission has ended due to elapsed time or max points reached. (look at the top of game.cs)
You can set up your cycling code, (located further down in game.cs) to load a splash screen while it loads the next mission. Just give your missions a number at the beginning of the name to arange them the way you want. (otherwise, torque will arange them alphabetically.)

Quote:
how would I make the levels so they are locked, so that way you can not access them until you beat the previous ones. Or at least the required ones.
Change the start mission gui so it doesn't show the mission list to accomplish this.
#2
10/13/2008 (9:36 pm)
Yes, you can pretty much control it all from script and and visualized in the gui. It will be up to you to write your mission goals and and requirements for advancement. Locking the missions to prevent access is as simple as setting a variable to true or false once these goals have been met.

To change the mission description info look in the relevant .mis file for the following
new ScriptObject(MissionInfo) 
{
     name = "test";
    desc0 = "A testing mission";
    descLines = "1";
};
#3
10/14/2008 (4:54 am)
@ Mike
function onMissionEnded()
{
// Called by endMission(), right before the mission is destroyed

// Normally the game should be ended first before the next
// mission is loaded, this is here in case loadMission has been
// called directly. The mission will be ended if the server
// is destroyed, so we only need to cleanup here.
// deactivatePackage($Server::GameType @ "Game");
cancel($Game::Schedule);
$Game::Running = false;
$Game::Cycling = false;
}

I don't understand. Where do I put the mission name so the server knows which one the load next? Or does it automatically load them in order as how I have them saved?


@ SilentMike
Thank you. I pretty much understand that. I just add that in every ".mis" file that will be loaded, right?
#4
10/15/2008 (12:50 pm)
You don't have to place your mission name anywhere. Just name your missions in the sequence you want them to load.

IE:

1_myFirstMission.mis
2_mySecondMission.mis
etc.....

You can add a function to anywhere you want for torque to cycle to the next mission by calling endMission(); . Torque will automatically load the next mission in sequence.
Did this make more since?

let's say, if your player scores 50 hit points, they go to the next mission. At the top of game.cs, there is code that reads:
// When a client score reaches this value, the game is ended.
$Game::EndGameScore = 10;
Change 10 to 50 and torque will do the rest.
If you want the player to advance to the next mission when the boss is killed, you would have to write a function that tracks the boss, and when the boss is killed, call endMission(); and torque will do the rest.
Hope that makes it a little clearer.
#5
10/15/2008 (4:18 pm)
@ Mike
Thank you very much. I also just figured out how Rockstar Games set up the missions of Grand Theft Auto. Do I get a treat? JK lolz. Thank you for the help though.
#6
10/15/2008 (4:43 pm)
About the ScriptObject(MissionInfo): It's automatically added to each mission file as it is generated. You can edit those fields from inside the editor (usually the first item in the mission tree), or you can edit the mission files in a text editor. There's no need to add them, unless they're missing.

Torque loads missions in numeric and/or alphabetical order according to the name of the .mis file, not the name in the MissionInfo object.