View Single Post
Re: Correct walk speed?
Old
  (#14)
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: Correct walk speed? - 06-04-2004

@Stefan: never forget your bot is a SERVER-SIDE bot ! Hence you can completely drop off the hooking for Health, Battery, WeapPickup messages and such, because you have direct access to them whenever you want in pEdict->v.health, pEdict->v.armorvalue and pEdict->v.weapons respectively !

In CS 1.6, the max speed is available in pEdict->v.maxspeed
In CS 1.5, the max speed was sent to the clients through a pfnSetClientMaxSpeed() call.

Hence the fix is to always look in pEdict->v.maxspeed, and use pfnSetClientMaxSpeed() like this:
Code:
void SetClientMaxspeed (const edict_t *pEdict, float fNewMaxspeed)
{
   // this function tells the client whose player entity is pointed to by pEdict to update its
   // maximal running speed to fNewMaxspeed. I don't really get why this function is necessary,
   // since the entvars of an entity already feature a "maxspeed" variable, which must be
   // trackable in the network pack. There are a lot of weirdosities like this one in the Half-
   // Life engine.
 
   // is this client a bot ?
   if (players[ENTINDEX ((edict_t *) pEdict) - 1].is_racc_bot)
	  ((edict_t *) pEdict)->v.maxspeed = fNewMaxspeed; // update its max speed (CS 1.5 doesn't)
 
#ifdef METAMOD
   RETURN_META (MRES_IGNORED);
#else
   (*g_engfuncs.pfnSetClientMaxSpeed) (pEdict, fNewMaxspeed);
#endif
}



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