T3D/Tutorials/Simple Custom Startup Sequence
From TDN
Simple Custom Startup Sequence
How to script a custom startup (splash) screen sequence in the simplest way possible.
This isn't to tell you how to make a startup/splash screen/how to use the GUI editor (read the T3D documentation), it's to tell you what to do with them once you have them.
The easiest way to display a series of startup/splash screens when the game first loads is by simply scheduling them one after another.
You know what you want it to look like and you've gone into the GUI Editor and made your custom fullscreen screens and saved them as new GUIs. For this example, you saved them in a new folder: game/art/gui/custom_guis. You only need one to be fullscreen, that's the background, the others can be non-fullscreen elements that will be displayed over that background.
So you have:
1 x Background Screen - that way you don't have to have fullscreen pics for the others - but you can if you want.
("art/gui/custom_gui/custom_startupgui_Background.gui")
If you're using the stock fade-gui-type for your other images/gui elements, then you'll want this to be black or it'll show up bad. If you have no idea what I'm talking about then you have nothing to worry about.
1 x Game Title Screen for "Super Battle Boom Headshot Game"
("art/gui/custom_gui/custom_startupgui_Game.gui")
1 x Developer/Company Screen for "Maladjusted Loner Games"
("art/gui/custom_gui/custom_startupgui_Developer.gui")
1 x customized Torque Splash Screen for "Torque/GarageGames"
("art/gui/custom_gui/custom_startupgui_Torque.gui")
And you want them to fire off, displaying one by one for a few seconds each, and then show the main menu so the player can actual get to play your game.
Remember to have one for the Torque/GarageGames Screen as per the EULA.
3.3.1. display the Torque Logo, consistent with the Logo Guidelines, in the start-up sequence of the Product
First up, you'll need to exec your new Splash Screens. Go to game/scripts/client/init.cs it's where the magic of scripts startup happens.
Down with the stock execing, you'll want to add your new GUI files.
// Gui scripts exec("./playerList.cs"); exec("./chatHud.cs"); exec("./messageHud.cs"); exec("scripts/gui/playGui.cs"); exec("scripts/gui/startupGui.cs");//<------note this one for later! //------------------- Custom Guis Exec'd here----------------------------- //custom startup events exec("art/gui/custom_gui/custom_startupgui_Background.gui"); exec("art/gui/custom_gui/custom_startupgui_Game.gui"); exec("art/gui/custom_gui/custom_startupgui_Developer.gui"); exec("art/gui/custom_gui/custom_startupgui_Torque.gui"); //end of your new custom exec'd gui files // Client scripts exec("./client.cs"); exec("./game.cs"); exec("./missionDownload.cs"); exec("./serverConnection.cs");
Cool, now it can load you stuff, so time to tell it to do so. Down in that file is the final function for startup: loadStartup();
scripts/gui/startupGui.cs is where to do that. As this is custom, feel free to scrub the lot, just make sure that your first function is loadStartup() unless you want to recall it something in the init.cs file.
To keep things really simple we're going to work with really basic schedules. One function will show the first screen, then a schedule calls the second, then the third, and finally the main menu.
1) Display the fullscreen Background image, so that you can display the other screens/elements on it.
2) 1 second later, display the Game Title Screen and hold it for 3 seconds
3) Display the Developer/Company Screen and hold it for 2 seconds
4) Display the Torque Screen for 4 seconds (remember the EULA)
5) Close the startup displays and load up the Main Menu
//----------------------------------------------------------------------------- // StartupGui is the splash screen that initially shows when the game is loaded //----------------------------------------------------------------------------- function loadStartup() { //called from init.cs Canvas.pushDialog(Custom_StartupGui_Background);//load the background schedule(1000, 0, "Load_Startup_Back_Done");//schedule the game screen } function Load_Startup_Back_Done() { Canvas.pushDialog(Custom_StartupGui_Game);//display the Game screen schedule(3000, 0, "Load_Startup_Game_Done");//schedule the Developer/company screen } function Load_Startup_Game_Done() { Canvas.popDialog(Custom_StartupGui_Game);//unload the Game screen Canvas.pushDialog(Custom_StartupGui_Developer);//display the Developer/Company screen schedule(2000, 0, "Load_Startup_Developer_Done");//schedule the Torque screen } function Load_Startup_Developer_Done() { Canvas.popDialog(Custom_StartupGui_Developer);//unload the Developer/Company screen Canvas.pushDialog(Custom_StartupGui_Torque);//display the Torque logo schedule(5500, 0, "StartupGui_onDone");//schedule the end of startup and display the main menu //if you're using the stock fade gui element +1500 on 4 seconds for last screen to fade out //it takes a little longer for this one or Main Menu kicks in a bit fast //and the result it visually jarring - just a word of warning ... } function StartupGui_onDone(%this) { Canvas.popDialog(Custom_StartupGui_Torque);//unload the Torque logo Canvas.popDialog(Custom_StartupGui_Background);//unload the background loadMainMenu();//load the main menu and lets play games! }
And that should be that. When you restart, your custom splash screens should play through nice and easy before loading the main menu.