Unique loading screen for each mission
by Konrad Kiss · 06/30/2008 (2:46 pm) · 11 comments
This resource is no big deal really, but it's my first one, so keep me happy by saying ultra cool things about it. Thanks. I though there might be someone out there who wants to have separate loading backgrounds for each of the in-game missions, and I was hoping I could save those interested a little time.
This is for TGEA 1.7.0 + but changing the path in setBitmap would let you use it in any version - TGE or TGEA.
In client/scripts/missionDownload.cs find onMissionDownloadPhase1 and add the following before LoadingProgress.setValue(0);:
Now make sure all your missions have their own loading-missionname.jpg or .png image in the ui directory. That's all.
This is for TGEA 1.7.0 + but changing the path in setBitmap would let you use it in any version - TGE or TGEA.
In client/scripts/missionDownload.cs find onMissionDownloadPhase1 and add the following before LoadingProgress.setValue(0);:
%missionShortName = FileName(%missionName);
%missionShortName = StrReplace(%missionShortName, ".mis", "");
LoadingGui.setBitmap("scriptsAndAssets/client/ui/loading-" @ %missionShortName);Now make sure all your missions have their own loading-missionname.jpg or .png image in the ui directory. That's all.
About the author
Lead Developer at Bitgap Games (www.bitgap.com) currently working on Xenocell (www.xenocell.com) a massively multiplayer action strategy game based on Torque 3D technology.
#2
06/30/2008 (5:01 pm)
Good snipet!
#3
06/30/2008 (7:25 pm)
Never thought of doing something like that for different loading screens, nice.
#4
Nice work!!
06/30/2008 (8:03 pm)
This is one of those little gems that you didn't know you wanted it till someone creates it.Nice work!!
#5
07/01/2008 (5:32 am)
@all: Thank you, I'm glad it's usable.
#6
Good work! =)
07/01/2008 (8:12 am)
I'll join in...fantastic snippet of code. Not only is it useful, but it's a great way of showing off Torque Script. New users of Torque Tech can use this to look up common ConsoleFunctions and proper scripting syntax.Good work! =)
#7
08/07/2008 (5:05 am)
Very neat job man...
#8
01/16/2009 (9:35 am)
Nice job, even through so simple.
#9
Although for some reason in my projects it has problems working with the default LoadingGui. I over came this problem by adding a new GuiBitmapCtrl and giving it my own name for example ImageLoadGui, then simply alter the LoadingGui part of the line.
For anyone who is having the same issue.
09/21/2009 (1:39 pm)
This is a small but very helpful piece of code. Thanks Konrad.Although for some reason in my projects it has problems working with the default LoadingGui. I over came this problem by adding a new GuiBitmapCtrl and giving it my own name for example ImageLoadGui, then simply alter the LoadingGui part of the line.
ImageLoadGui.setBitmap("scriptsAndAssets/client/ui/loading-" @ %missionShortName);For anyone who is having the same issue.
#10
09/21/2009 (2:17 pm)
Thanks Chris, and thanks again for explaining your solution!
#11
Basically, my thought was to continue the method used for the mission "preview" image ... I place the image under game/levels/<mission_name>_loading for consistency.
Then add this code as you suggested:
And then create load screens as png images, formated at 4:3 ratio (like 1024x768 or 800x600) so it looks ok when loading on different resolutions.
01/07/2012 (4:59 pm)
Konrad@ just wanted to add a small improvement made when I implemented this ... might save others a few minutes as well.Basically, my thought was to continue the method used for the mission "preview" image ... I place the image under game/levels/<mission_name>_loading for consistency.
Then add this code as you suggested:
...
%missionShortName = FileName(%missionName);
%missionShortName = StrReplace(%missionShortName, ".mis", "");
%loadScreenName = "levels/" @ %missionShortName @ "_loading.png";
if ( isFile(%loadScreenName) )
{
LoadingGui.setBitmap(%loadScreenName);
echo("*** using loading screen: " @ %loadScreenName @ " ***");
}
else
echo("*** no custom loading screen found for this level ***" );
...And then create load screens as png images, formated at 4:3 ratio (like 1024x768 or 800x600) so it looks ok when loading on different resolutions.
Torque Owner Trenton Shaffer