Skip to content
User Avatar
#2739
Auto-translated
You can use the `COMBAT_RESULTS_TRIGGER` and, if the hero that needs to be resurrected is defeated in 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')
Hello. Can you write a function for dwellings: when a player visits Orc dwellings (for example), a message about their destruction is displayed, after which the player receives resources, but the computer can interact with them normally until then?

Attach the `OBJECT_CAPTURE_TRIGGER` to the dwelling, and when it triggers, write the necessary actions:
function Capture(n1, n2, s1, s2)

if(n2 == 1) then
MessageBox(...)
SetPlayerResource(...)
RemoveObject(...) or RazeBuilding(...), if you need to destroy it
end

end

Trigger(OBJECT_CAPTURE_TRIGGER, 'object name', 'Capture')
Нет войне.