Re: How to detect entity [properties] ? -
26-05-2004
PM, I think he's refering to properties (key/value pairs) that can be set by level designers (mappers).
Tea, entity variables are usually stored as Class member variables in the MOD source code class definition (which you don't have the source code for). You can access these values by using the pvPrivateData point in the entvars structure. The pvPrivateData will point to the memory allocated by the engine for that Class instance. For example, if you create a CBasePlayer class in the MOD code, the engine will allocate space for the CBasePlayer class (which will probably not contain the same variables that the standard Half-Life SDK source code comes with, so don't assume these are the same). You can dump the pvPrivateData section of memory to see what byte values change when one of these class member variables is updated.
A cleaner way to do this is to intercept the entity being spawned by the engine. The HPB bot does this for several entities, for example in TFC, the "info_tfdetect" entity is used to determine how many players are allowed on each team and how many teams there are. I intercept the "info_tfdetect" entity when it is being spawned and save the values of the key/value pairs in DispatchKeyValue() (in the dll.cpp file) when the entity is spawned. This method will ONLY work for things that DON'T change their value while the game is being played. For example, if you had something that toggle off and on (like a capture point) while the game is playing, you would have to intercept other network messages to know what the current state of that entity is.
botman
|