Skip to content
User Avatar
#2653
Auto-translated
Firstly, if a unit dies, GetAttackerCreatures() will no longer return it. As far as I remember, it returns all current units on the battlefield. The moment any creature dies is accompanied by a call to the UnitDeath function, which passes the name of the deceased creature, but I haven't checked what can be done with this name if the creature is already gone.
Secondly,
and as the name of the unit, units?
units is an array of names returned by GetAttackerCreatures(). If you try to output it, for example:
print(units)
You will get something like:
{"creature_0", "creature_1", "creature_2", "creature_3"}
When we iterate through this table with a loop:
for i, unit in units do
then the variable unit already contains the name of one creature, for example, "creature_0". This is an internal name that the game assigned to the unit. In reality, it is slightly different. The best way to see this is to simply open the console during a battle and try the corresponding commands.