Skip to content

OnPlayerSiegeHit

A siege engine’s shot is about to hurt a player - return the damage to apply.

Runs for every player within the shot’s radius of the point it came down on (a wall between them shields them when the server has the level’s collision). damage is the kind’s at that distance - a player’s health is 100: the trebuchet’s stone kills within about 2.5 m and grazes at 5, the cannon’s ball kills within about 1.5 m. A knocked-down siege ladder comes here too: for each climber it threw off, as they come down (100 at its very top, less the lower they were), then for whoever it lands on (25) - shooter is who knocked it down. Return a number to apply that instead (0 or false spares them), nothing to apply damage.

function OnPlayerSiegeHit(pid, id, shooter, damage)
-- ...
end
Parameter Type
pid number the player it would hurt
id number the engine that fired it
shooter number the player who fired it; -1 = the mode
damage number the damage it would do

a number - the damage to apply instead; false = none; nothing = damage

-- no harm to the shooter's own team, half to everyone in the keep
function OnPlayerSiegeHit(pid, id, shooter, damage)
if shooter >= 0 and GetPlayerTeam(pid) == GetPlayerTeam(shooter) then return 0 end
if IsPlayerInZone(pid, KEEP_ZONE) then return damage / 2 end
end

OnSiegeImpact · SetSiegeEngineRules · the Siege engines group of the index