• Custom Hammer Keyvalue, can't get with Entity:GetKeyValues()
    5 replies, posted
I have a custom keyvalue for each info_player_start entity in a map called "wave". I added it by turning off Smart Edit in the entity properties in Hammer and added my own keyvalue. However when calling GetKeyValues() on the entity, the key ["wave"] isn't there. Is this a bug or what?
I had a similar problem before, the trick was to use the hook [url]http://wiki.garrysmod.com/page/GM/EntityKeyValue[/url] and then "catch" all the keys and values when they were set on the entity, so that they were recorded to a table.
GetKeyValues() only returns non custom stuff, stuff defined in the c++ engine.
[QUOTE=Robotboy655;52107996]GetKeyValues() only returns non custom stuff, stuff defined in the c++ engine.[/QUOTE] Does it work with FGD keyvalues?
[QUOTE=RonanZer0;52108947]Does it work with FGD keyvalues?[/QUOTE] FGD is nothing but a helper for easier list of the keyvalues. As I said, GetKeyValues will never list any "custom" keyvalues, any keyvalues that the entity does not manually store in memory in C++
[code] hook.Add("EntityKeyValue", "FixKeyValues", function(ent, k, v) ent.FixedKeyValues = ent.FixedKeyValues or {} ent.FixedKeyValues[k] = v end) [/code] I wrote this because GetSpawnFlags and GetKeyValues were returning 0 for the spawnflags when I knew for a fact that it should have been 32768
Sorry, you need to Log In to post a reply to this thread.