Garry's Mod Wiki

GM:OnNPCDropItem

  GM:OnNPCDropItem( NPC npc, Entity item )

Recently Added

This was recently added in version (2025.07.28). It might only be available on the Dev Branch right now.

Description

Called whenever an NPC drops an item upon it's death.

It will be called only for entities the NPC creates.

It will NOT be called for dropped weapons (with exception of Half-Life: Source NPCs, since they don't use actual weapon entities, they create the weapons on death). GM:PlayerDroppedWeapon works for NPC weapon drops already. (Yes, I know it says PLAYERDroppedWeapon, it works because the hook is called from the weapon itself, not from the dropping entity)

Arguments

1 NPC npc
The killed NPC
2 Entity item
The item that got dropped by the NPC.

Example

Removes the item an NPC drops upon it spawning

hook.Add( "OnNPCDropItem", "RemoveNPCDrops", function( npc, item ) item:Remove() end)