OnNpcEquipmentChange

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:49, 15 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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)