OnNpcEquipmentChange

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

onNpcEquipmentChange

Triggered after a scripted NPC's equipped weapon changes.

Availability

This event is available in server-side scripts.

Callback signature

onNpcEquipmentChange(npcId, previousWeapon, newWeapon, sourceResource)

Parameters

Name Type Description
npcId int The affected NPC identifier.
previousWeapon string The previous stable weapon key.
newWeapon string The new stable weapon key.
sourceResource string The resource that requested the change.

Examples

Handle the event:

addEventHandler("onNpcEquipmentChange", root, function(npcId, previousWeapon, newWeapon, sourceResource)
    outputDebugString("NPC " .. npcId .. " weapon: " .. previousWeapon .. " -> " .. newWeapon)
end)