You must be logged in to post

Game Development Community

Enhanced StartMissionGui

by Drew Hitchcock · 04/24/2005 (6:53 pm) · 21 comments

Download Code File

To apply this patch, follow the instructions below:

1. Start with a relatively fresh copy of starter.fps

2. Back up the following files
- starter.fps/client/ui/startmissiongui.gui
- starter.fps/data/missions/stronghold.mis
- starter.fps/data/missions/stronghold.ter

3. Delete the following file, just to be safe
- starter.fps/client/ui/startmissiongui.gui.dso

4. Extract stronghold.mis and stronghold.png from this resource's .zip file, copy them to starter.fps/data/missions. (Overwrite the existing files)

5. Extract the startmissiongui.gui file from this resource's .zip file, copy it to starter.fps/client/ui. (Again, overwrite the existing file.)

6. Start up the engine and click "Start Mission..."

7. Be amazed by the awesome dialog box.

Note that you will not see any preview images for any missions that are not set up correctly!

Also note that this patch assumes your game's folder is named "starter.fps,"
if it is named something else, you will need to modify the .mis files accordingly (see below)


How to set up your missions:

The dialog gets the information that it needs from each mission's MissionInfo ScriptObject. This information can be edited from the in-game mission editor, but it's often easier just to open the .mis file with a text editor.

If you open up a standard new torque mission, you'll see something like this around the fifth line or so:

new ScriptObject(MissionInfo) {
         desc0 = "A simple new mission template.";
         name = "New Mission";
         descLines = "1";
   };

To specify an image to be used as the preview image for this mission, you need to add a "preview" field containing the image's path, like so:

new ScriptObject(MissionInfo) {
         desc0 = "A simple new mission template.";
         name = "New Mission";
         descLines = "1";
         preview = "starter.fps/data/missions/TheHills.png"
   };

The "descXXX" and "descLines" fields define the description of the mission that is displayed in the loading dialog and the startmissiongui. For missions with one line of description, the MissionInfo Should look something like this:

new ScriptObject(MissionInfo) {
         desc0 = "This is the description of the mission";
         name = "New Mission";
         descLines = "1";
         preview = "starter.fps/data/missions/TheHills.png"
   };

For missions that need more than one line of description, the MissionInfo will look like this (note the value of descLines determines the number of lines displayed):

new ScriptObject(MissionInfo) {
         desc0 = "This is the description of the mission";
         desc1 = "This is line 2";
         desc2 = "This is line 3";
         name = "New Mission";
         descLines = "3";
         preview = "starter.fps/data/missions/TheHills.png"
   };

Unfortunately, there's no automated way of taking screenshots that I know of, so you will need to manually take a screenshot for each mission and resize them in an image editing program.
Page «Previous 1 2
#1
04/24/2005 (8:28 pm)
Ok, the code file has been re-uploaded. Enjoy.
#2
04/24/2005 (8:40 pm)
Drew, I love you!... well not really, but great job!
#3
04/25/2005 (12:31 am)
Very nice.

I half implemented something like this, but my version was hacky and I put the image url in desc[1] which in hindsight was pretty stupid :)
#4
04/25/2005 (7:49 am)
This is just incredible, awesome, cool, mind blowing, uh.... I'm out of words! Thanks!
#5
04/25/2005 (3:48 pm)
cool I'll get this in ASAP!
#6
04/25/2005 (4:23 pm)
Really nice! Also, great for beginners.
#7
04/27/2005 (2:22 pm)
Good work Drew! btw, Good to see you around :)

Esop
#8
04/29/2005 (8:47 pm)
BTW
Control->p will place a screenshot in the same folder as the Torque exe.
You can change the save type between jpg & png through the options panel,
Control->o

Start with common\client\screenshot.cs...for more details etc.
#9
04/29/2005 (9:26 pm)
@Dee

Yeah, that's what I would call "manually taking a screenshot." It would be really cool if you could just define a special point in the mission editor, and it would automatically save a preview image viewed from that point upon saving the mission. I know torque could do that with some modifications, but it would be a bit of work. The annoying thing about taking screenshots with the normal ctrl-p is that you have to hide all of the gui elements if you want a plain screenshot, and you have to manually copy the screenshot afterward.

The automated system would be a lot of work with not much gain.
#10
05/05/2005 (3:08 pm)
this is a very cool feature , good job man .
#11
05/10/2005 (1:02 pm)
Excellent resource, does exactly what I need it to do, and is both simple and elegant.

Thanks Drew.
#12
06/29/2005 (5:01 am)
Thank you Drew!
This resource went into TGE 1.3 with no problems.
I modified the loading screen to also show the multiple lines and change the background image to the mission preview image.
Here are my changes to compliment your code.

In starter.fps/client/scripts/missionDownload.cs replace function handleLoadDescriptionMessage with the one below.
function handleLoadDescriptionMessage( %msgType, %msgString, %line, %preview )
{
	LoadingGui.qLine[LoadingGui.qLineCount] = %line;
	LoadingGui.qLineCount++;

   // Gather up all the previous lines, append the current one
   // and stuff it into the control
	%text = "<spush><font:Arial:16>";

	for( %line = 0; %line < LoadingGui.qLineCount - 1; %line++ )
		%text = %text @ LoadingGui.qLine[%line] @ ""; //BrokeAss MMO
	%text = %text @ LoadingGui.qLine[%line] @ "<spop>";

	PreviewLoadImage.setBitmap( %preview ); //BrokeAss MMO
	LOAD_MapDescription.setText( %text );
}
In starter.fps/common/server/missionInfo.cs replace the function sendLoadInfoToClient with the one below.
function sendLoadInfoToClient( %client )
{
   messageClient( %client, 'MsgLoadInfo', "", MissionInfo.name );

   // Send Mission Description a line at a time
   for( %i = 0; MissionInfo.desc[%i] !$= ""; %i++ )
     messageClient( %client, 'MsgLoadDescripition', "", MissionInfo.desc[%i], MissionInfo.preview);  //BrokeAss MMO

   messageClient( %client, 'MsgLoadInfoDone' );
}
In starter.fps/client/ui/loadingGui.gui before the line
new GuiControl() {
add this
new GuiBitmapCtrl(PreviewLoadImage) {
     profile = "GuiWindowProfile";
     horizSizing = "relative";
     vertSizing = "relative";
     position = "0 0";
     extent = "1024 768";
     minExtent = "8 2";
     visible = "1";
     lockMouse = "0";
     wrap = "0";
  };

Let me know if there are any typos, etc.
Thanks again for this resource.

Ari Rule
#13
02/20/2006 (6:30 pm)
Dropped this into 1.4 with no problems and also added Ari Rule's nice addition. Thank you both for sharing.
#14
01/11/2007 (10:05 am)
This is a great resource!
#15
02/09/2007 (8:32 pm)
This is probably the easiest and best resource I have ever come accross. Great job.
#16
11/22/2007 (2:40 pm)
Ehy guy just a question....

In common/client/screenshot.cs I copied the function "doScreenShot" and renamed it as "MissionPreview".
Then I bind it to a global action map (let say CTRL+F12).

Now I want to modify the function in order to save the screenshot in the actual mission folder and name it as "MissionFileName".png/jpg , eventually replacing the file if already exist.

So we would have an automated way to take a screenshot from the opened mission.

Then modify the script that set the bitmap of the preview image in the present resource in order to load this file, IE loading always a file named "MissionFileName".png/jpg

I'm not a programmer, not even a novice one so i need a bit of help from you ;)

Noone has time to take a look how this has to be implemented?

Tnx, JoZ
#17
12/10/2007 (2:55 pm)
Great job. Works with 1.5.2.
#18
01/10/2008 (11:35 am)
@ Joz:
To create a screeshot use the function screenshot. The syntax is explained here:
http://tdn.garagegames.com/wiki/TorqueScript_Console_Functions_12#screenShot.28_filename_.2C_format_.29
#19
01/11/2008 (6:39 am)
Great resource :-)
#20
08/09/2008 (5:24 am)
fine.. resource
Page «Previous 1 2