Quote:
Originally Posted by Tea
botman I understand how is keyvalue work but I don't know how to call it again after the bot spawned, because now it only detect one time when the bot spawn, but since the flag model in dod always change when someone captured it, so I have to call keyvalue () again before to detect the flag model each time.
Like when I want to call a XXXX(void),
I have to type XXXX();
When I want to call the ClientPrint( edict_t *pEntity, int msg_dest, const char *msg_name),
I have to type ClientPrint(pEntity, HUD_PRINTNOTIFY, "testing");
But how to call KeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd ),
I have to type KeyValue( xxxxxxxxxxxxxx ); ???
|
Hmm no, you
did not understand how that keyvalue works.
DispatchKeyValue() is not a function you can CALL.
DispatchKeyValue() is a function you HOOK. It is part of the GameDLL interface.
Look around in the HPB_bot code and you'll see that nowhere ever does botman call DispatchKeyValue() from the bot code.
DispatchKeyValue() is just like StartFrame(). You don't CALL StartFrame(), you
let the engine call it.
It's the same thing here.
The Dispatch() series of functions are called by the engine into the GameDLL code in order to setup an entity, and they are called along with a pointer to the entity they refer to.
So in order to store particular informations about these entities that you couldn't be able to get through their entvars (pEdict->v.something), you have to count how many of them there are in the game and fill an array with them. An array of structures, in each of which you can put as many information as you want. And why not the whole key/value string.
AS SOON as the engine calls DispatchKeyValue(), fill in this array with the appropriate changes.
THEN, whenever you want, make your bot code read the information it needs from the right slot in the array that holds these entitie's extra informations.
Have you ever read botman's readme.txt file that comes with his HPB template ?