Revision Difference
GM:OnNPCDropItem#565160
<function name="OnNPCDropItem" parent="GM" type="hook">⤶
<description>Called whenever an NPC drops an item upon it's death.⤶
<note>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).⤶
<page>GM:PlayerDroppedWeapon</page> 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)⤶
</note> ⤶
</description>⤶
<added>2025.07.28</added>⤶
<realm>Server</realm>⤶
<args>⤶
<arg name="npc" type="NPC">The killed NPC</arg>⤶
<arg name="item" type="Entity">The item that got dropped by the NPC.</arg>⤶
</args>⤶
⤶
</function>⤶
⤶
<example>⤶
<description>Removes the item an NPC drops upon it spawning</description>⤶
<code> ⤶
hook.Add( "OnNPCDropItem", "RemoveNPCDrops", function( npc, item )⤶
item:Remove()⤶
end)⤶
</code>⤶
</example>