Auto-translated
Hello. Please, wise people, if you know the answer, help me! :)
As you remember, in Lords of the North, the red knights converted their units to red using this script:
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, converting from red to white? I've tried many 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 ones, but it spawns completely random units for the hero.
Thank you for your help (if any). :)
function transformTroops(hero)
while IsHeroAlive(hero) do
sleep(2)
for i=106,112 do
local n = GetHeroCreatures(hero, i)
if n > 0 then
RemoveHeroCreatures(hero, i, n)
AddHeroCreatures(hero, (i-105)*2, n)
end
end
end
end
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4