Skip to content
User Avatar
#3892
Auto-translated

Gerter

most likely, the problem lies in these two lines:
DEFENDER = GetDefenderHero();
print(DEFENDER);
ATTACKER = GetAttackerHero();
print(ATTACKER);

the point is that the game defines two constants, ATTACKER and DEFENDER, which determine the attacking and defending sides of the battle, respectively. With these lines, you are essentially overwriting these constants, assigning the names of the hero units to them instead of the standard sides. The subsequent errors are obvious - GetAttackerCreatures() and GetDefenderCreatures() are simply wrappers around a lower-level function - they internally call GetCreatures(ATTACKER) and GetCreatures(DEFENDER), respectively. Due to the redefined constants, these functions cannot work correctly, which causes the error. The rest of the script simply does not execute due to these errors. Therefore, the solution is simple - use different names for your hero name constants.

Gerter, thank you for your help!

Indeed, giving these constants different names made the script work like a charm! At least, until I break it with something else:)
It turns out that ATTACKER and DEFENDER are reserved words, just like CREATURE_VAMPIRE.