Game Development Community

End Mission Crashes Torque

by Dustin Sims · in Torque Game Engine · 11/20/2005 (3:49 pm) · 1 replies

I have set up a few triggers in torque demo.
I put different triggers in the doorways of each building and they set a flag in my player.
When all 4 flags are set I just want to end the mission and get beack to Main Menu GUI.

I have looked at the way the "Escape" Key ends mission and copied the functionality.

When I hit my last trigger I do this.

function checkifcomplete(%this,%obj)
{

if (%obj.mainhut && %obj.smallhut1 && %obj.smallhut2 && %obj.smallhut3)
{
%client = %obj.client;
echo ("Killer");
CommandToClient(%client,'disconnect'); //-------------<<<<<
}
else
return 0;
}

That calls this which is in Client/Scripts/ServerConnection.cs

function ClientCmdDisconnect()
{
echo("Calling Disconnect from client");
disconnect();
}

That disconnect(); function is exactly what is called when you end mission by pressing ESCAPE key.
What AM I missing... IT just Crashes TORQUE.

My Console.Log looks like this..

Mapping string: Holding:1:64.4899:49 to index: 12
Main Hut Entered
Obj = 1539
Killer
Mapping string: Holding:1:63.4999:49 to index: 1
Mapping string: disconnect to index: 8
Calling Disconnect from client
In Disconnect Client Function
In DisconnectedCleanup Function
1
2
3
4
5
Back In Disconnect
*** ENDING MISSION
CDROP: 1478 IPX:37000000:3A0000000400:0
Exporting server prefs...

I could use help plaeaseeee..

#1
11/21/2005 (5:39 am)
You most probably should simply call the script function endMission(), which is located in /common/server/missionLoad.cs.