HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Counting kills

01-14-2003, 03:29 PM#1
Arkin
Is it possible to be able to count how many kills a single unit has?
01-14-2003, 03:44 PM#2
Guest
if you don't need it for every unit:

Event: A unit owned by player(...) dies <-- put all enemies of unit here

Condition:Unit Comparison (killing unit) is equal to ( desired unit)

Action: Set variable (kills_of_unit) to (kills_of_unit +1)


You need a own variable (or a field for all) the units you want to track the kills. The units you want to track the kills have to be known at the start.
01-14-2003, 04:00 PM#3
Arkin
So I can't get it to track the kills of a unit trained from a building?
01-14-2003, 04:27 PM#4
Guest
If it is possible I would trie it like this (can't trie now, no editor here):

Event: Unit trained by player <-- Is this a valid event??
Action:
Set varialble (Number_Of_Unit) = (Number_Of_Unit) + 1
Set unit proporties of (triggering unit) (flight hight) to int_to_float((Number_of_Unit)) <-- doesn't change anything with walking units, thx to the one that gave me that hint. But is it possible?

If you have flying units and they have the default hight 400, add a if hight > 400 then do Number_Of_Unit -= 400, though, it changes the flight hight extremely at the end.
-----------------------------------------------------------

Event: A unit owned by player(...) dies <-- put all enemies of unit here

Action: Set variable (Number_Of_Unit) = float_to_int((flight hight) of (killing unit))
Set Variable kills_of_unit[Number_Of_Unit]++



Number_Of_Unit <- integer, default 0, don't think it will expire the limits for int
kills_of_unit[] <- integer array

Maybe add a bit of code that chacks if the Unit still is alive and assign the Number_Of_unit everytime the lowest possible? --> extra funktion that triggers the assign flight hight.

Than also flying units can be used.

If there are flying ones too, you can also add a check if the trained unit is a air-unit and then give them the Number_Of_Unit from 0-100(+original flying hight) and if it is not, from 101-XXXXX

Hope all funktions are possible, the one or other way.