Triggers not working correctly
by Jason Burch · in Torque Game Engine · 10/24/2007 (7:10 am) · 3 replies
I'm using a basic trigger and I'm trying to do some stuff depending on what team the client is on.
So I'm using the following code
when I enter the trigger it only shows
Team :::
When I get the value for the %obj ID it isn't the same as the client id
any help is great
So I'm using the following code
echo ("Team ::: " @ %obj.client.team.teamId);when I enter the trigger it only shows
Team :::
When I get the value for the %obj ID it isn't the same as the client id
any help is great
#2
for some reason it will not get the teamid for me.
I've set up the sim set with the flags and everything but when I enter a trigger it will only give me the datablock information.
I'm using a stock TGE 1.5.2 with the team implementation
I just uncommented your echo calls in the resource to figure this out.
10/25/2007 (9:47 am)
I'm actually using your resource and I can't get it to work.for some reason it will not get the teamid for me.
I've set up the sim set with the flags and everything but when I enter a trigger it will only give me the datablock information.
I'm using a stock TGE 1.5.2 with the team implementation
I just uncommented your echo calls in the resource to figure this out.
#3
Looks like your echo is wrong. You have:
echo ("Team ::: " @ %obj.client.team.teamId);
where it should be:
echo ("Team ::: " @ %obj.client.team.teamID);
notice the caps on teamID.
That might be it I dunno. Actually I think I have changed mine to teamID... looks like the original resource is how you have it. So you might want to change all the teamID in my resource to teamId.
10/25/2007 (11:13 am)
It should work with no changes needed as long as you have the team resource working. Looks like your echo is wrong. You have:
echo ("Team ::: " @ %obj.client.team.teamId);
where it should be:
echo ("Team ::: " @ %obj.client.team.teamID);
notice the caps on teamID.
That might be it I dunno. Actually I think I have changed mine to teamID... looks like the original resource is how you have it. So you might want to change all the teamID in my resource to teamId.
Torque 3D Owner mb
onEnterTrigger & onLeaveTrigger
%obj.client.team.teamID will equal a number (if your using the team implimentation resource).
onTickTrigger & onTriggerTick
Here I loop through all the clients then check which team they are on.
for(%x=0; %x < %trigger.getNumObjects(); %x++) { // Set %obj to be the current object that is being used in the for loop. %obj = %trigger.getObject(%x); if (%obj.getState() $= "Dead") { return; } else { // If the %obj is a client then check if its on Team 1. if (%obj.client.team.teamID == 1) // team 1 entered trigger... {You can look at how I did it in this resource I made: www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=12430