projectile
by Trevor Higgins · in Torque 3D Professional · 12/28/2013 (6:21 pm) · 4 replies
So I been trying to get a projectile hit a player and decide if it�s a friendly or enemy but I can�t figure this out been trying for a long time everything I can think of. I didn�t want to post for help because I wanted to figure it out myself so I learn. But I�m just stumped and wanted to see what others think maybe I�m just missing something. This is the last thing I tried before I gave up.
function Infection::onCollision(%data, %proj, %col, %fade, %pos, %normal, %obj, %sourceObject)
{
echo("ProjectileData::onCollision("@%data.getName()@", "@%proj@", "@%col.getClassName()@", "@%fade@", "@%pos@", "@%normal@")");
if (%col.getType() & ($TypeMasks::ShapeBaseObjectType))
{
if (%col.getDamageLevel() != 0 && %col.getState() !$= "Dead")
{
if ( %sourceObject.team == %obj.team )
{
%col.applyInfection(5);
echo("otherTeam");
%col.applyInfection(%data.InfectionAmount);
echo(%data.InfectionAmount);
// Update the Health GUI while repairing
Infection::doHealthUpdateInfection(%data, %col);
}
else
{
echo(%sourceClient.teamid);
echo(%col.teamid);
%col.applyRepair(%data.MedrepairAmount);
echo(%data.MedrepairAmount);
// Update the Health GUI while repairing
Infection::doHealthUpdateMed(%data, %col);
}
}
}
}
#2
But that code uses (%sourceClient.team == %client.team) tried that and it don’t work maybe im not getting the data to the projectile.
12/29/2013 (7:03 am)
Didn’t work for some reason it’s not seeing the team, but when I kill the wrong team it says killed and when you kill team mate it says team kill. But that code uses (%sourceClient.team == %client.team) tried that and it don’t work maybe im not getting the data to the projectile.
#3
12/29/2013 (8:50 am)
Just to be sure, alter your initial echo:echo("Infection::onCollision("@%data.getName()@", "@%proj@", "@%col.getClassName()@", "@%fade@", "@%pos@", "@%normal@")");That way we're sure we're in the right callback.
#4
-- %sourceObject.team : nothing
-- %obj.team : nothing
-- %col.team : nothing
-- %client.team : nothing
ill keep looking maybe i have to team wrong
Mapping string: JoinTeam to index: 3
--------------------------------------------------------------------------
%this= 5704
teamId= 1
--------------------------------------------------------------------------
Mapping string: MsgClientJoinTeam to index: 10
Mapping string: %1 joined the %2 side to index: 11
Mapping string: JoinPlayerClass to index: 4
CLIENT= 5704
CLIENT.team= 1771
CLIENT.team.teamname= Red
im going to try to change the teamID to team maybe that's whats going on.
12/29/2013 (9:28 am)
Infection::onCollision(Infection, 6105, player, 1, random numbers)-- %sourceObject.team : nothing
-- %obj.team : nothing
-- %col.team : nothing
-- %client.team : nothing
ill keep looking maybe i have to team wrong
Mapping string: JoinTeam to index: 3
--------------------------------------------------------------------------
%this= 5704
teamId= 1
--------------------------------------------------------------------------
Mapping string: MsgClientJoinTeam to index: 10
Mapping string: %1 joined the %2 side to index: 11
Mapping string: JoinPlayerClass to index: 4
CLIENT= 5704
CLIENT.team= 1771
CLIENT.team.teamname= Red
im going to try to change the teamID to team maybe that's whats going on.
Torque Owner Richard Ranft
Roostertail Games
Just a quick thought, haven't tried it.
Next try echoing out everything
echo(" -- %sourceObject.team : " @ %sourceObject.team); echo(" -- %obj.team : " @ %obj.team); echo(" -- %col.team : " @ %col.team);and see what you get....