Game Development Community

Score in tutorial.base

by Shakey · in Torque Game Engine · 03/07/2007 (6:15 pm) · 2 replies

Hi

I am doing the tutorial.base tutorial and I have this problem, I copied everything word for word from the scripting part of the tutorial, but when I gather all 8 logos, the messagebox shows as it should, and when it asks do I want to exit the game or try again and I select try again, the score stays at 8 and doesn't go back to 0. I know somewhere the %score variable needs to be updated on restarting of the game. When I quit the game completely and start it over the score reverts to 0.

Shakey

#1
03/08/2007 (7:07 am)
You might want to try something like this GameOne/server/logoitem.cs:

serverCommandResetScore(%client)
{
     %client.score = 0;
     commandToClient(%client, 'SetScoreCounter', 0);
}

Then in the loadMyMission() function, call it:

function loadMyMission()
{
   // make sure we are not connected to a server already
   disconnect();
   
   // Create the server and load the mission
   createServer("SinglePlayer", expandFilename("./data/missions/gameonemission.mis"));

   // Make a local connection
   %conn = new GameConnection(ServerConnection);
   RootGroup.add(ServerConnection);
   %conn.setConnectArgs("Player");
   %conn.setJoinPassword("None");
   %conn.connectLocal();
   [b]commandToServer('ResetScore');[/b]
}
#2
03/08/2007 (8:44 am)
Thanks that wotk for the most part. I really appreciate it. But after going over the code and trying it, it didn't work at first you said in logo.cs type this

serverCommandResetScore(%client)
{     
    %client.score = 0;     
    commandToClient(%client, 'SetScoreCounter', 0);
}

but instead of serverCommandResetScore -- it should be serverCmdResetScore