Auto-translated
1. How will this look?
3. Well, basically, the AI stops casting spells and gets stuck in that state. But in general, the chances of the player having only elementals in their army are small.
function finish()
local human = IsHuman(ATTACKER) and ATTACKER or DEFENDER
local computer = 1 - human
while 1 do
local hum = GetCreatures(human)
local comp = GetCreatures(computer)
if length(hum) == 0 then
Finish(computer)
break
end
if length(computer) == 0 and (atdwarf == 6 or dwarf == 2) then
Finish(human)
break
end
sleep(20)
end
end
startThread(finish)
3. You can call spellcasting functions not directly, but through startThread; then, if an error occurs, the script will not crash but will continue to execute.
startThread(commandDoSpell, hero, spell, ...)
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4