AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Anyone able to convert this to work with cz bots? (https://forums.alliedmods.net/showthread.php?t=174268)

LukeyB 12-18-2011 05:21

Anyone able to convert this to work with cz bots?
 
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;
      } 


ConnorMcLeod 12-18-2011 05:31

Re: Anyone able to convert this to work with cz bots?
 
cz bots are already affected by smoke grenades

LukeyB 12-18-2011 05:53

Re: Anyone able to convert this to work with cz bots?
 
Yes, but not well at all. You can stand in the smoke and they will never see you so you can kill all of them. Any ideas to fix this? Maybe have them randomly shoot in the middle of the smoke? Would be amazing if that was possible.

ConnorMcLeod 12-18-2011 06:46

Re: Anyone able to convert this to work with cz bots?
 
So the code you asked to be converted wouldn't help in any way !!

LukeyB 12-18-2011 07:01

Re: Anyone able to convert this to work with cz bots?
 
I was hoping it would make a difference. Do you have any idea how to fix the current bot smoke code?

ConnorMcLeod 12-18-2011 07:07

Re: Anyone able to convert this to work with cz bots?
 
not at all
have you try high bot level ?

LukeyB 12-18-2011 07:13

Re: Anyone able to convert this to work with cz bots?
 
What about somehow scripting when smoke entity is seen by bot, shoot through? Is that even possible?

LukeyB 12-19-2011 15:53

Re: Anyone able to convert this to work with cz bots?
 
Yes. They are set to bot_difficulty 3


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

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