OnPlayerSpellImpact

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

onPlayerSpellImpact

Triggered when an authoritative spell projectile impacts a player or the world.

Availability

This event is available in server-side scripts.

Callback signature

onPlayerSpellImpact(ownerPlayerId, targetPlayerId, projectileId, castId, spellKey, spellId, damage, healthAfter, maxHealth, killed, x, y, z)

Parameters

Name Type Description
ownerPlayerId int The casting player ID.
targetPlayerId int The impacted player ID, or the runtime's no-player value for a world impact.
projectileId int The projectile ID.
castId int The originating cast ID.
spellKey string The spell definition key.
spellId int The numeric spell ID.
damage number Validated damage applied by the impact.
healthAfter number Target health after damage, or zero for a world impact.
maxHealth number Target maximum health, or zero for a world impact.
killed bool Whether this impact reduced the target to zero health.
x number Impact X coordinate in metres.
y number Impact Y coordinate in metres.
z number Impact Z coordinate in metres.

Examples

Handle the event:

addEventHandler("onPlayerSpellImpact", root, function(ownerPlayerId, targetPlayerId, projectileId, castId, spellKey, spellId, damage, healthAfter, maxHealth, killed, x, y, z)
    outputDebugString(spellKey .. " impacted at " .. x .. ", " .. y .. ", " .. z)
end)

Notes

  • A world impact has no player target but still carries the authoritative impact position.