onObjectShot

Description

This event is called when a player shoots an object.

NameDescription
objectThe pointer of the object
playerThe player whom triggered the event
weaponThe ID of the weapon

Example

This example shows a message whenever you shoot an object.

function onScriptLoad() {
obj <- CreateObject(....);
obj.TrackingShots = true;
}
function onObjectShot(object, player, weapon) {
if(object.ID == obj.ID) {
MessagePlayer("You've shot object id " + object.ID + " with weapon id " + weapon, player)
}
}

Notes

💡

Make sure you track those events with object.TrackingShots = true.