Game Development Community

Mission Preview?

by CodingChris · in Torque Game Engine · 01/08/2007 (8:02 am) · 5 replies

Hi,
I want to add a mission preview to my game. I did this:
1. I add PathedCamera resource
2. and did a TrackCamGUI

This is my plan:
When the mission is loaded, the pathCamera starts its way. You see the mission and if you want you can exit this view with a gui loaded before the TrackCamGUI. This gui will then call startGame function and this will call startrace, you can play now. Maybe I will add a car selection.

This are some of my problems:
The gui is not shown. It's only shown for one second.

Help needed

#1
01/08/2007 (8:10 am)
Hi Christian,

it's hard to help debugging by the very few information you gave in this text to actually understand where the problem is exactly. Could you possibly describe in detail what modifications you did and where exactly the problem occures? Maybe with some code example? This would help a lot helping you :-)

Martin :-)
#2
01/08/2007 (8:20 am)
I did this at the end of onClientEnterGame:
// Create path camera
   %this.PathCamera = new PathCamera() {
      dataBlock = LoopingCam;
      position = "0 0 300 1 0 0 0";
   };
   %this.PathCamera.followPath("MissionGroup/Nina");
   MissionCleanup.add( %this.PathCamera);
   %this.PathCamera.scopeToClient(%this);
   canvas.pushDialog(TrackCam);
      $Server::Client = %this;
   %this.setControlObject(%this.PathCamera);
There's no dialog then.
#3
01/08/2007 (8:26 pm)
I had this same problem with my network lounge that was displayed after my mission was loaded. I got around this by scheduling a function call 1 second after the mission had loaded to pushdialog to the front.
This worked fine. I think the dialog dissapears due to the playgui being pushed to the front after mission load, but I don't know where that is being done by.
However I eneded up completely recoding the network lounge to not load the mission until the dialog was poped.
In file common\server\server.cs in the function "function createServer(%serverType, %mission)" I commented out the line
loadMission(%mission, true);
this stopped the mission from loading and fixed both my problems.
I think that for your issue you will find that scheduling a function to push your dialog to the front 1 second after the mission loads should fix your problem, but if not, take a look in the files common\server\server.cs and common\server\clientConnection.cs to see if you can find a better way around your problem.
NOTE: To schedule a function to be called in script 1 second later, use the following.
schedule(1000, 0, %functionName);
//1000=1second
//%functionName=function name to call in a string.
Examples can be found in client\scripts\game.cs
function countThree()
{
   // Tell the client to count.
   for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
      %cl = ClientGroup.getObject( %clientIndex );
      commandToClient(%cl, 'SetCounter', 3);
   }

	schedule(1000, 0, "countTwo");
}

function countTwo()
{
   // Tell the client to count.
   for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
      %cl = ClientGroup.getObject( %clientIndex );
      commandToClient(%cl, 'SetCounter', 2);
   }

	schedule(1000, 0, "countOne");
}

function countOne()
{
   // Tell the client to count.
   for( %clientIndex = 0; %clientIndex < ClientGroup.getCount(); %clientIndex++ ) {
      %cl = ClientGroup.getObject( %clientIndex );
      commandToClient(%cl, 'SetCounter', 1);
   }

	schedule(1000, 0, "startRace");
}
#4
01/09/2007 (7:03 am)
If I do this nothing happend the mission is not loaded.
#5
01/09/2007 (7:17 am)
I did it. In YourGame/client/scripts/serverConnection.cs in function GameConnection::initialControlSet(%this), there is a:
if (!Editor::checkActiveLoadDone())
   {
      if (Canvas.getContent() != PlayGui.getId())
         Canvas.setContent(PlayGui);
   }
add here your code.