Trigger trouble. Wrong trigger
by Mike Rowley · in Torque Game Engine · 05/25/2006 (7:36 pm) · 6 replies
I have the following triggers in my game:
Everything works fine and dandy the first time thru, but when I start the second round (this is a racing game) I get the error message telling me that the first trigger is the wrong trigger.
I've checked my trigger code with the code in the starter.racing tutorial game, and everything looks fine, but I can't figure out what's going on here. I've had to have missed some code somewhere.
I have code in server/game.cs and in client/play.cs
I can't find anywhere else that I may have missed.
Thanks for any suggestions.
new Trigger(trigger0) {
position = "-38.7763 -313.662 50.1689";
rotation = "0 0 1 11.4593";
scale = "2.36967 49.0313 11.8526";
dataBlock = "CheckPointTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000
0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
checkpoint = "0";
};
new Trigger(trigger1) {
position = "-41.0891 -626.628 62.4806";
rotation = "0 0 -1 24.6372";
scale = "34.1989 1 13.5763";
dataBlock = "CheckPointTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000
0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
checkpoint = "1";
};
new Trigger(trigger2) {
position = "254.99 -668.418 85.8718";
rotation = "0 0 1 21.1994";
scale = "0.132352 24.2379 13.4055";
dataBlock = "CheckPointTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000
0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
checkpoint = "2";
};
new Trigger(trigger3) {
position = "455.78 -196.8 84.3136";
rotation = "0 0 -1 38.9611";
scale = "35.1079 1 17.0191";
dataBlock = "CheckPointTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000
0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
checkpoint = "3";
};
new Trigger(trigger4) {
position = "54.8867 -290.566 48.035";
rotation = "0 0 -1 32.6586";
scale = "1 50.5104 15.4957";
dataBlock = "CheckPointTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000
0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
isLast = "1";
checkpoint = "4";
};This is in the mis file setting my triggers.Everything works fine and dandy the first time thru, but when I start the second round (this is a racing game) I get the error message telling me that the first trigger is the wrong trigger.
I've checked my trigger code with the code in the starter.racing tutorial game, and everything looks fine, but I can't figure out what's going on here. I've had to have missed some code somewhere.
I have code in server/game.cs and in client/play.cs
I can't find anywhere else that I may have missed.
Thanks for any suggestions.
#2
05/26/2006 (3:25 am)
If you go thru a wrong trigger, you get an error message that displays on the screen that says "wrong checkpoint". It's there to let you know that you missed one.function CheckPointTrigger::onEnterTrigger(%this,%trigger,%obj)
{
Parent::onEnterTrigger(%this,%trigger,%obj);
if(%obj.client.nextCheck == %trigger.checkpoint)
{
if(%trigger.isLast)
{
// Player has completed a lap.
%obj.client.lap++;
if(%obj.client.lap >= $Game::Laps)
{
// Increase his score by 1.
%obj.client.incScore(1);
// End the game
cycleGame();
}
else {
%obj.client.nextCheck = 1;
commandToClient(%obj.client, 'IncreaseLapCounter');
}
}
else {
// Continue to the next one.
%obj.client.nextCheck++;
}
}
else
//oops, you missed the last checkpoint..cheater!
centerPrint(%obj.client, "Wrong Checkpoint!", 1, 1);
}
#3
I've played with the starter.racing demo, and it works great, but I cannot get it to work with multiplayer, and there are some things that I didn't want. When I took those things out, I couldn't get the game to work at all, so I've taken the starter.fps tutorial and have been turning it into a racing demo. (I need the coding practice) I have everything working perfectly eccept for the checkpoints.
This has been a great learning experience, but I'm stuck.
I've added the checkpoint.cs file to the server, and changed the necessary lines in game.cs.
I have also changed the play.cs in the client code as well. I know that I have to be missing something somewhere, but just can't figure out where.
Thanks
05/26/2006 (3:31 pm)
A little more explination.I've played with the starter.racing demo, and it works great, but I cannot get it to work with multiplayer, and there are some things that I didn't want. When I took those things out, I couldn't get the game to work at all, so I've taken the starter.fps tutorial and have been turning it into a racing demo. (I need the coding practice) I have everything working perfectly eccept for the checkpoints.
This has been a great learning experience, but I'm stuck.
I've added the checkpoint.cs file to the server, and changed the necessary lines in game.cs.
I have also changed the play.cs in the client code as well. I know that I have to be missing something somewhere, but just can't figure out where.
Thanks
#4
05/26/2006 (4:48 pm)
What is the first trigger, checkpoint 0? It looks like after a lap is done, the next checkpoint is being set to 1, is 0 not the next trigger the player will hit after hitting the last checkpoint?
#5
The thing is, it's the same trigger setup as in the starter.racing game. I haven't changed that. It should work, but isn't. :(
05/26/2006 (6:55 pm)
Yes on both. 0 is the first, 4 is the last, then it's back to 0.The thing is, it's the same trigger setup as in the starter.racing game. I haven't changed that. It should work, but isn't. :(
#6
I read your post, but looked at it crosseyed I think. I don't know why, but changing the next trigger to 0 worked. It's funny that the checkpoint.cs is from the starter.racing demo and it works perfectly there, but not here without changing the 1 to a 0. Oh well, it works. Thankyou very much. I am just about bald from trying to figure this one out. It's all fixed now. :)
05/30/2006 (5:08 pm)
Ramen, Thankyou.I read your post, but looked at it crosseyed I think. I don't know why, but changing the next trigger to 0 worked. It's funny that the checkpoint.cs is from the starter.racing demo and it works perfectly there, but not here without changing the 1 to a 0. Oh well, it works. Thankyou very much. I am just about bald from trying to figure this one out. It's all fixed now. :)
Torque Owner Cinder Games
Can you elaborate more on what you mean?