Game Development Community

OnDeath callback?

by Brandon Fogerty · in Torque Game Engine Advanced · 08/23/2009 (10:58 pm) · 3 replies

I want to know when one of my bad guys have been killed. Is there any kind of on death call back in torque script? Thanks in advance!

#1
08/23/2009 (11:06 pm)
Look in server/scripts/player.cs It's all there to play with. :-)
#2
08/24/2009 (2:39 am)
onDamage() in player.cs does a check to see if the player is dead, if so then it calls the onDeath() function which is located in game.cs. The default implementation of "death" doesn't really handle AI all that elegantly but it can be tamed by intercepting either one of those two locations and checking if you are a player or an aiPlayer and doing something suitable.
#3
08/24/2009 (9:52 am)
Previously, I've found that onDisabled is a pretty good place to be dealing with "do scripts when AI is deceased".