Auto-translated
Combat scripts have one unpleasant feature: there is practically no information about them in the standard manual. I would suggest using developer maps for training; some of them (such as campaign 6, mission 5) have good combat scripts. In particular, the function that tracks the movement of a defending hero's creature:
function DefenderCreatureMove(Unit)
This function summons creatures (temporary summoning):
SummonCreature(to whom, which, how many, coordinates)
I would track the number of deaths using:
GetCreatureNumber(unitName);
Something like that.