Entity.SetKeyValue
From GMod Wiki
Function | |
Syntax | Entity:SetKeyValue( String key, String value ) |
Description: | |
Sets a key value. | |
Returns: | nil |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.SetKeyValue]Entity.SetKeyValue [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Additional Notes
- You can use Hammer-editor to look up what key values that are supported by an entity.
- You can also read about entities' key values at the Valve SDK Docs.
- If you are setting the 'renderfx' on a scripted entity, you must set the alpha channel to 0 in order for the effect to work, and only values of 1 (pulse slow) and 2 (pulse fast) seem to work properly.
- SetKeyValue can be used to set spawn flags, for example to make an npc_citizen spawn as a medic. The key is "spawnflags"; the value is the sum of all the flags that need to be set, expressed as a string. Example:
ent:SetKeyValue("spawnflags","131072")
- If you need a key value to point to a specific entity instead of the name of an entity, use Entity.SetEntity.