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.