Auto-translated
Hello. Please, wise people, if you know the answer, let me know! :)
As you remember, in Lords of the North, the Red Knights used this script to transform their units into red ones:
function transformTroops( heroName )
sleep(3);
print("function transformTroops for hero ", heroName ," has started...");
while IsHeroAlive ( heroName ) == true do
for i=1,14 do
creaturesCount = GetHeroCreatures( heroName, i );
if creaturesCount > 0 then
RemoveHeroCreatures( heroName, i, 10000);
n = i;
if mod(i,2) ~= 0 then n = i + 1; end;
AddHeroCreatures( heroName, 105 + (n/2), creaturesCount );
end;
end;
sleep(2);
end;
print("Hero ", heroName, " is dead. Function transformTroops terminated");
end;
I need help with the following: How can I make the function work in reverse, transforming units from red to white? I've tried several times, but it doesn't work. Instead of 1, 14, I put 106, 112, and instead of 105, I put 1... It removes the red units, but spawns completely random units for the hero.
Thank you for your help (if any). :)