View Single Post
Re: How to detect entity [properties] ?
Old
  (#18)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: How to detect entity [properties] ? - 04-06-2004

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 ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote