Garry's Mod Wiki


  Entity:SetKeyValue( string key, string value )


Sets Hammer key values on an entity.

You can look up which entities have what key values on the Valve Developer Community on entity pages.

A list of basic entities can be found here.

Alternatively you can look at the .fgd files shipped with Garry's Mod in the bin/ folder with a text editor to see the key values as they appear in Hammer.


1 string key
The internal key name
2 string value
The value to set


Makes an NPC not drop their weapon and drop a healthkit on death, using SF Enumerations on a Combine Soldier.

A list of spawnflags a Combine Soldier has can be found here.

npc:SetKeyValue( "spawnflags", bit.bor( SF_NPC_NO_WEAPON_DROP, SF_NPC_DROP_HEALTHKIT ) )