Raised This Month: $ Target: $400
 0% 

Anyone able to convert this to work with cz bots?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
LukeyB
Member
Join Date: Dec 2011
Old 12-18-2011 , 05:21   Anyone able to convert this to work with cz bots?
Reply With Quote #1

PHP Code:
{
   
// Check if Bot 'sees' a SmokeGrenade to simulate the effect of being blinded by smoke
   // + notice Bot of Grenades flying towards him
   // TODO: Split this up and make it more reliable
   
static edict_t *pEdict;
   static 
edict_t *pent;
   static 
edict_t *pSmoke// KWo - 26.03.2007
   
static Vector vecView;
   static 
float fDistance;
   static 
int iInField;
   
pEdict pBot->pEdict;
   
pent pBot->pAvoidGrenade;
   
pSmoke pBot->pSmokeGrenade;
   
vecView GetGunPosition (pEdict);
   
// Check if old ptr to Grenade is invalid
   
if (FNullEnt (pent))
   {
      
pBot->pAvoidGrenade NULL;
      
pBot->cAvoidGrenade 0;
   }
   else if ((
pent->v.flags FL_ONGROUND) || (pent->v.effects EF_NODRAW))
   {
      
pBot->pAvoidGrenade NULL;
      
pBot->cAvoidGrenade 0;
   }
   if (
FNullEnt (pSmoke)) // KWo - 26.03.2007
   
{
      
pSmoke NULL;
      
pBot->pSmokeGrenade NULL;
   }
   else if (!(
pSmoke->v.flags FL_ONGROUND) || (pSmoke->v.effects EF_NODRAW))
   {
      
pSmoke NULL;
      
pBot->pSmokeGrenade NULL;
   }
   if (!
FNullEnt (pBot->pAvoidGrenade)) // KWo - 26.03.2007
   
{
      
Vector2D vec2DirToPoint;
      
Vector2D vec2RightSide;
      
// to start strafing, we have to first figure out if the target is on the left side or right side
      
MAKE_VECTORS (pEdict->v.angles);
      
vec2DirToPoint = (pEdict->v.origin pent->v.origin).Make2D ().Normalize ();
      
vec2RightSide gpGlobals->v_right.Make2D ().Normalize ();
      if (
DotProduct (vec2DirToPointvec2RightSide) > 0)
         
pBot->cAvoidGrenade = -1;
      else
         
pBot->cAvoidGrenade 1;
//      ALERT(at_logged, "[DEBUG] Bot %s needs to avoid grenade.\n", pBot->name);
   
}
   if (!
FNullEnt (pSmoke)) // KWo - 13.09.2008
   
{
      
// Check if in field of view of the Bot
      
iInField BotInFieldOfView (pBotpSmoke->v.origin vecView);
      if (
iInField < (pEdict->v.fov 1.0 5.0)) // more wide - even +/-85 degress in this case...
      
{
//         ALERT(at_logged, "[DEBUG] Bot %s checks a smoke grenade in his field of view.\n", pBot->name);
         
fDistance = (pSmoke->v.origin pEdict->v.origin).Length ();
         
// Shrink Bots Viewing Distance to Smoke Grens Distance
         
if (pBot->f_view_distance fDistance)
            
pBot->f_view_distance fDistance;
      } 
LukeyB is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode