Game Development Community

Who Killed Who When?

by Swaroop Reddy · in RTS Starter Kit · 11/27/2007 (6:53 am) · 3 replies

I need to know the following
- whenever a unit is killed how do I know?
- who was the unit that delivered the final blow when a unit is killed!?

It will help me to give credit to the client with the kill and do some checks for game win / loss conditions etc.? .

The stats that come with the kit are just random numbers that are generated in gameConnection.cs and the are not modified in game.

#1
11/27/2007 (7:36 am)
Well I figured the answer to the first part - onRemove will execute whenever the obj is about to be removed.
So how do I know who is attaking the object that is about to be removed?
#2
11/27/2007 (11:06 am)
I dont remember now if the engine has already something for this, but in any case a simple solution could be to add two dinamic fields in the units. Something like:

%unitA.attackingTo = %unitB;

%unitB.beeingAttackedBy = %unitA;

In a way that the last attack be registered by this fields.
#3
11/28/2007 (5:11 pm)
That is kind of what I did and it is working. Thanks.