Trouble w. "GameOne" tutorial
by Lauri Salo · in Torque Game Engine · 03/16/2006 (1:51 pm) · 8 replies
Hi,
I completed the basic tutorial but can't get the player to pick up the torque logos. I went through the scripts carefully (and several times) and can't see any difference to those given in the tutorial. Would be lovely if someone could have a look at the below scripts and tell me if there is something wrong.
Cheers,
Lauri
1. GameOne/server/logoitem.cs
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $="Player")
{
%client = %col.client;
%client.score++;
commandToClient(%client, 'SetScoreCounter', %client.score);
%obj.delete();
%logoCount = logos.getCount();
if(%logoCount > 0)
return;
//otherwise display victory screen
commandToClient(%client, 'ShowVictory", %client.score);
}
}
2. GameOne/client/clientGame.cs
function clientCmdSetScoreCounter(%score)
{
ScoreCounter.setText("Score:" SPC %score);
}
function clientCmdShowVictory(%score)
{
MessageBoxYesNo("You win!", "would you like to restart the game?",
"loadMyMission();", "quit();");
}
3. GameOne/main.cs
function initClient()
{......
.....
....
// Client scripts
....
exec("./client/clientGame.cs");
....
}
I completed the basic tutorial but can't get the player to pick up the torque logos. I went through the scripts carefully (and several times) and can't see any difference to those given in the tutorial. Would be lovely if someone could have a look at the below scripts and tell me if there is something wrong.
Cheers,
Lauri
1. GameOne/server/logoitem.cs
function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $="Player")
{
%client = %col.client;
%client.score++;
commandToClient(%client, 'SetScoreCounter', %client.score);
%obj.delete();
%logoCount = logos.getCount();
if(%logoCount > 0)
return;
//otherwise display victory screen
commandToClient(%client, 'ShowVictory", %client.score);
}
}
2. GameOne/client/clientGame.cs
function clientCmdSetScoreCounter(%score)
{
ScoreCounter.setText("Score:" SPC %score);
}
function clientCmdShowVictory(%score)
{
MessageBoxYesNo("You win!", "would you like to restart the game?",
"loadMyMission();", "quit();");
}
3. GameOne/main.cs
function initClient()
{......
.....
....
// Client scripts
....
exec("./client/clientGame.cs");
....
}
About the author
#2
logos? or logo?
'ShowVictory" or "ShowVictory" ?
Neither of these will probably solve your problem, and I don't have the tutorial in front of me right now, but just pointing them out...
03/16/2006 (2:57 pm)
%logoCount = logos.getCount();
logos? or logo?
commandToClient(%client, 'ShowVictory", %client.score);
'ShowVictory" or "ShowVictory" ?
Neither of these will probably solve your problem, and I don't have the tutorial in front of me right now, but just pointing them out...
#3
03/16/2006 (3:12 pm)
What's the GameOne tutorial?
#4
03/16/2006 (3:15 pm)
The tutorial that comes w/ 1.4 if I recall correctly.
#5
03/16/2006 (8:23 pm)
Really? Do you mean the starter.fps? I don't see any tutorial...
#6
03/16/2006 (10:39 pm)
No, the tutorial is a file called "GettingStarted.pdf" in the example folder.
#7
The score does not change from 0 even after I have picked them all up. I will keep looking.
03/17/2006 (3:31 am)
I had the same problem but I had spelled Torque wrong (forgot the q). Fixed that and he picks them up, but I get no scoring. I have checked the code several times too. The score does not change from 0 even after I have picked them all up. I will keep looking.
#8
And thanks Allyn, I was looking for a log earlier but found it only now.
Lauri
03/17/2006 (10:09 am)
Thank you Joe - 'ShowVictory" was the problem. Now it works fine, including the scoring function Susan has a problem with.And thanks Allyn, I was looking for a log earlier but found it only now.
Lauri
Torque Owner AllynMcelrath