Auto-translated
Hello! I need help with a question: In general, I have a counter. The presence of creatures from a list in a hero's army should affect it. For example:
enemy_creatures = {106, 107, 108, 109, 110, 111, 112, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28} - these are red creatures and regular demons, as well as "fiery" demons (without alternative upgrades). There are 21 of them in the list, and I write:
for enemy=1,21 do
if GetHeroCreatures(HeroName, enemy_creatures[enemy]) >= 1 then
counter = counter - 1;
The problem is that the function affects the counter for the entire list, i.e., even for one stack in the hero's army, it reduces the counter by not 1, but by all 22. How can I write the function so that it only changes the counter if creatures with IDs from the list are present in the hero's army?