OnPlayerRangedImpact
Jump to navigation
Jump to search
onPlayerRangedImpact
Triggered when an authoritative arrow or bolt impacts a player or the world.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerRangedImpact(ownerPlayerId, targetPlayerId, projectileId, shotId, weaponType, damage, healthAfter, killed, x, y, z)
Parameters
| Name | Type | Description |
|---|---|---|
ownerPlayerId |
int |
The shooting player ID. |
targetPlayerId |
int |
The impacted player ID, or the runtime's no-player value. |
projectileId |
int |
The projectile ID. |
shotId |
int |
The shot sequence ID. |
weaponType |
string |
Either bow or crossbow. |
damage |
number |
Validated impact damage. |
healthAfter |
number |
Target health after the impact. |
killed |
bool |
Whether the target reached 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("onPlayerRangedImpact", root, function(ownerPlayerId, targetPlayerId, projectileId, shotId, weaponType, damage, healthAfter, killed, x, y, z)
outputDebugString(weaponType .. " impact at " .. x .. ", " .. y .. ", " .. z)
end)