Game Development Community

SourceClient not working?

by Matt Vitelli · in Torque Game Engine · 08/06/2006 (8:08 pm) · 5 replies

Hello. I'm trying to get my AI to attack whoever attacks them. Human or bot.

In the Player::onDamage function I have the following added to it.

%obj.setMoveObject(%sourceClient);
%obj.setAimObject(%sourceClient);
%obj.setImageTrigger(0,1);

That unfortuantely does not do anything. The AI just stands there not looking at the sourceClient when it has worked with attacking the player only. Any help would be greatly appreciated.

Thanks,
-Matt Vitelli

Edit: setMoveObject is a function I have added.

#1
08/06/2006 (8:19 pm)
Try using %sourceClient.player
#2
08/06/2006 (8:24 pm)
Didn't work.
#3
08/07/2006 (1:25 am)
Have you looked at the aiguard resource? www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6773
It works.
#4
08/07/2006 (2:27 am)
Matt,

Quote:
That unfortuantely does not do anything. The AI just stands there not looking at the sourceClient when it has worked with attacking the player only. Any help would be greatly appreciated.

Its no suprise that the AI just stands there. Clients are not objects and you *should not* be able to target them.

_________________________________

The sourceObject ID is cleared after 231ms in processTick(). As far as I can remember, it never worked to fetch the sourceObject in the onDamage function because of this (unless the projectile hit it's target before the timeout).

You can quickly hack this to work, but I'm not sure if there are any side-effects.
Needless to say, it works in our project and we have no issues with it.
#5
08/07/2006 (4:30 pm)
Try use it with player::damage and use %sourceObject.client.player