I need all Sorceress units in the army of the red opposing player to be removed by 25% of their count if the blue player has Alaric.
I've tried a million options (set conditions for both red and blue - the code works super glitchy, it only works when there are only 2 different tier-2 creatures, or when there are 3 creatures all upgraded; I moved the request to get the creature count before and after the if statement and added "and" checks and ">=0" checks, but it just won't work as intended.
My console doesn't turn on, so I can't check why it's breaking.
I also can't try combat scripts; the code doesn't see the link to them from the main mapscript.lua.
I'm writing this from a phone and not copying, so I'll only convey the essence of the code:
I'll write an example for human Sorceress units, but I wrote it for all races
Tried it like this:
if GetObjectOwner ("Alaric") ==2 and I put checks >=0 and "and" and "or"
then
RemoveHeroCreatures(heroname, 10, 0.25*GetHeroCreatures(heroname, 10))
RemoveHeroCreatures(heroname, 110, 0.25*GetHeroCreatures(heroname, 110))
RemoveHeroCreatures(heroname, 112, 0.25*GetHeroCreatures(heroname, 112))
end and I put elseif and else, everything is off or glitchy
trigger for red
I also wrote a trigger for blue where I checked like this:
if heroname alaric
then
for i ,hero in hero1 do
I wrote the request for creatures here and before/after the "for i" lines
remove creatures(hero, id, 25% of count)
and I named them in all variations, for example inkviz=getherocreatures(tried both heroname and hero)
The code works either on some of the creatures or when all 2-3 types of creatures are present; in short, I'm asking for help.