So, it becomes interesting, which of these will be less demanding on the map? What should be prioritized for script optimization?
In your script, in
GetSavedCombatArmyCreatureInfo( 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. Accordingly, 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 already pointed out, it was discussed on the forum.
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!
Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.