Auto-translated
By the way, the script is overcomplicated. Everything can be done in one loop and without the skeleton:
1. Check the number of undead in the slot.
2. If there are undead, compare the number in the slot with the total number.
3. If the number in the slot is less than the total, it means there are more undead, so take the undead from the slot and give a banshee to the slot.
4. If not, it means that all the undead are in the slot (there are two options here - there is still an army or only undead). In any case, take the undead from the slot, give a banshee to the slot, and take one undead as a check (if it was added in the case of a single slot).
End of the loop.
I'm not an expert in scripts, but something like this:
----------------DEIDRA-------------------
function error_NHF_Nemor_F ()
print("error:NHF_Nemor_F");
end;
function NHF_HERO_F.Nemor ()
errorHook(error_NHF_Nemor_F);
local slot = -1;
local i_count = 0;
local id, count;
local temp_name = NHF_tempName_F("Nemor");
local count_umertvie = GetHeroCreatures("Nemor", CREATURE_WIGHT);
if count_umertvie > 0 then --Fixed 0.84
for i = 0,6 do
id, count = GetObjectArmySlotCreature(temp_name,i);
if id == CREATURE_WIGHT then
if count < count_umertvie then - check if all undead are in one slot.
RemoveHeroCreatures("Nemor", CREATURE_WIGHT, count, i);
AddHeroCreatures("Nemor", CREATURE_BANSHEE , count,i);
else
RemoveHeroCreatures("Nemor", CREATURE_WIGHT, count, i);
AddHeroCreatures("Nemor", CREATURE_BANSHEE , count,i);
RemoveHeroCreatures("Nemor", CREATURE_WIGHT, 1);
end;
end;
end;
end;