Connection ErrorBad RequestThis page went staleSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
This page went stale
Your security token was rejected, usually because the page sat open too long or you signed in elsewhere. Nothing was saved. Reload the page and try again.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
You're approaching the task from the wrong angle. Combat functions are well-described in Novik's scripting guide, if needed.
- when the only stack of the defending side moves, it does something.
It's simple here:
function DefenderUnitMove(unit)
-- for example, cast a spell:
UnitCastGlobalSpell(unit, 'SPELL_NAME');
return not nil
end
- when any stack of the attacking side dies, ghosts appear on the defending side.
There might be some nuances:
function AttackerUnitDeath(unit)
-- haven't checked, it might work like this:
local x, y = GetUnitPosition(unit);
AddCreature(side, type, quantity, x, y);
end
You just need to place these functions in the combat script; they will be automatically called when the corresponding event occurs.