If the developers aren't incompetent (which they aren't), then it's done through a trigger. Because a pending trigger doesn't execute until the corresponding event is called. And a loop constantly executes, which puts more load on the map.Thank you for the answer. Unfortunately, I only found messages that Khottabych and I left ourselves when searching.
In your script, inGetSavedCombatArmyCreatureInfo( combatIndex );you only passed 1 argument, but you also need to specify 0 as the second parameter (0 for the losing side, 1 for the winning side), and the third argument should be the index of the army slot to check. Therefore, it's better to write a loop that checks all slots.
That's why it's not working. The manual doesn't explain it very well, but as Khottabych pointed out, it was discussed on the forum.
Regarding my script, I rewrote it a bit and it started working! However, after checking the stacks and finding the first one occupied by any creature, the script complains about "Invalid creature index" and displays some number. For example, 2 (as I understand it, this is the occupied stack that was in combat with the hero). Is this a critical error? Or can I ignore it, thinking "Well, it's good enough!"? :D
The script now looks like this (everything works, print outputs the correct number of fallen enemies)
function WR_Revenge( combatIndex )
print("Function started") --Delete
if GetSavedCombatArmyHero( combatIndex, 1 ) == "WR" then
print("Hero checked")
if GetSavedCombatArmyCreaturesCount( combatIndex, 0, 112 ) >= 1 then
print("Creatures checked")
for i=0,6 do
local revenge_target, count, died = GetSavedCombatArmyCreatureInfo( combatIndex, 0, i );
print("Local passed")
if revenge_target == 112 and died >= 1 then
print("Check for at least one angel's death passed")
enemieskilledcounter = enemieskilledcounter + died;
print("WR killed ", enemieskilledcounter ," angels");
end
end
end
end
end