Skip to content
User Avatar
#2740
Auto-translated
Gerter
You can attach the COMBAT_RESULTS_TRIGGER and, if the hero that needs to be resurrected loses a battle, check the owner of the mines and act accordingly. Something like this:
function fightResult(fightID)

local LooserName = GetSavedCombatArmyHero(fightID, 0)
if(LooserName == 'Aberrar') then
if(GetObjectOwner("mine1") == 1) and
(GetObjectOwner("mine2") == 1) and
(GetObjectOwner("mine3") == 1) and
(GetObjectOwner("mine4") == 1) and
(GetObjectOwner("mine5") == 1) and
(GetObjectOwner("mine6") == 1) then
UnreserveHero('Aberrar')
else
DeployReserveHero('Aberrar', 46, 140, GROUND)
end
end

end

Trigger(COMBAT_RESULTS_TRIGGER, 'fightResult')

I checked it, and I have a couple of questions right away. How do I make the mines initially belong to a specific player?
And secondly: the script is malfunctioning; the console says: Aberrar does not belong to any player. Although in the player properties, he is waiting in the reserve heroes. WTF?
Автор карт:
Долина расхитителей
Выбор мира