So, it just didn't work ;)
Put it in the Start() function.
As for the function that handles creature death, it's simple: it's called when the creature is already dead – you give it the task to attack, and it's immediately considered dead. But the computer doesn't have time to play the animation, and it doesn't look good visually :smile18:
It's better not to use sleeps at all – they're not very useful in combat. I haven't encountered any problems with wait. :)
Well, maybe they're not *that* useful, but without them, you can't cast spells properly... So, I decided to use a delay in the function, and it seems logical:
function AttackerCreatureDeath(creatureName)
if GetCreatureType(creatureName) ~= 36 then
AttackerDeathCount = AttackerDeathCount-1;
count = GetCreatureNumber(creatureName);
spawnCount = count/3;
if spawnCount ~= 0 then
local x, y = GetUnitPosition(creatureName);
sleep(50);
removeUnit(creatureName);
sleep(5);
SummonCreature(ATTACKER, 36, spawnCount, x, y);
end;
end;
end;But sleep(50) is a whole 10 seconds, and all this happens in 2 seconds... What could be wrong here? Maybe I messed something up :smile39: ?Added 7 minutes later
By the way, while I was browsing the common scripts, I came across a function that wasn't mentioned in any of the guides (or maybe I just didn't look hard enough): showMessage(parameter, some number)
If I understand correctly, this command can be used to send a message to the combat log (where it shows who hit whom and for how much)