Raised This Month: $32 Target: $400
 8% 

Bots don't shoot invisible


Post New Thread Reply   
 
Thread Tools Display Modes
DarkGL
Senior Member
Join Date: Aug 2010
Location: Warsaw, Poland
Old 06-14-2012 , 19:22   Re: Bots don't shoot invisible
Reply With Quote #11

another update with little changes
__________________
DarkGL is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 06-14-2012 , 22:31   Re: Bots don't shoot invisible
Reply With Quote #12

last beta version of podbot has built-in feature - dont shot invisible players - until they dont fire
__________________
The functional way is the right way
GordonFreeman (RU) is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-15-2012 , 01:24   Re: Bots don't shoot invisible
Reply With Quote #13

Quote:
Originally Posted by GordonFreeman (RU) View Post
until they dont fire
That's a missing feature here
Random visibility on low amount is a nice idea though, i'm wondering if podbot offers it.

Well, you should add a note about podbot, or even change Modification to Condition Zero.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-15-2012 at 01:25.
ConnorMcLeod is offline
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 06-15-2012 , 03:40   Re: Bots don't shoot invisible
Reply With Quote #14

The "really" invisible player is invisible for bots as long he (the player) is not pressing the fire button. In that case the bot code presuposes hat the fire from the weapon should be seen - so the player stays "semi-visible" (the bot s trying to aim his body origin - never the head).
Code:
bool FBoxVisible (bot_t *pBot, edict_t *pTargetEdict, Vector *pvHit, unsigned char *ucBodyPart) // KWo - 23.03.2012 - rewritten...
{
// KWo - 05.09.2009 - changed variables to static ones
   static int i;
   static int RenderFx;             // KWo - 22.03.2008
   static int RenderMode;           // KWo - 22.03.2008
   static int TargetEntIndex;       // KWo - 17.01.2011
   static int TargetWeapon;         // KWo - 17.01.2011
   static Vector RenderColor;       // KWo - 22.03.2008
   static float RenderAmount;       // KWo - 22.03.2008
   static float LightLevel;         // KWo - 23.03.2008
   static bool SemiTransparent;     // KWo - 22.03.2008
   static bool WeaponIsGun;         // KWo - 17.01.2011
   static TraceResult tr;
   static Vector vecLookerOrigin;
   static Vector vecTarget;
   static Vector vecEnDirection;
   static edict_t *pEdict;

   *ucBodyPart = 0;
   *pvHit = g_vecZero;              // KWo - 04.07.2008
   pEdict = pBot->pEdict;           // KWo - 27.05.2008

   if (FNullEnt(pTargetEdict))      // KWo - 17.01.2011
      return (FALSE);

   TargetEntIndex = ENTINDEX (pTargetEdict) - 1;                                        // 17.01.2011
   if ((TargetEntIndex >= 0) && (TargetEntIndex < gpGlobals->maxClients))
   {
      TargetWeapon = clients[TargetEntIndex].iCurrentWeaponId;                          // 17.01.2011
      WeaponIsGun = (WeaponIsPistol(TargetWeapon) || WeaponIsPrimaryGun(TargetWeapon)); // 17.01.2011
   }
   else
      WeaponIsGun = FALSE;

// Can't see the target entity if blinded or smoked...
   if ((pEdict->v.origin - pTargetEdict->v.origin).Length() > pBot->f_view_distance)   // KWo - 14.09.2008
      return (FALSE);

   // don't look through water
   if (((pEdict->v.waterlevel != 3) && (pTargetEdict->v.waterlevel == 3))
       || ((pEdict->v.waterlevel == 3) && (pTargetEdict->v.waterlevel == 0)))
      return (FALSE);

// KWo - 22.03.2008 - added invisibility check
   RenderFx = pTargetEdict->v.renderfx;
   RenderMode = pTargetEdict->v.rendermode;
   RenderColor = pTargetEdict->v.rendercolor;
   RenderAmount = pTargetEdict->v.renderamt;
   SemiTransparent = false;    // KWo (moved) - 05.09.2009

   if (((RenderFx == kRenderFxExplode) || (pTargetEdict->v.effects & EF_NODRAW))
      && (!(WeaponIsGun) || !(pTargetEdict->v.oldbuttons & IN_ATTACK))) // kRenderFxExplode is always invisible even for mode kRenderNormal
   {
      return (FALSE);
   }
   else if (((RenderFx == kRenderFxExplode) || (pTargetEdict->v.effects & EF_NODRAW))
      && (pTargetEdict->v.oldbuttons & IN_ATTACK) && (WeaponIsGun))  // KWo - 17.01.2011
   {
      SemiTransparent = true;
   }
   else if ((RenderFx != kRenderFxHologram) && (RenderMode != kRenderNormal)) // kRenderFxHologram is always visible no matter what is the mode
   {
      if (RenderFx == kRenderFxGlowShell)
      {
         if ((RenderAmount <= 20.0) && (RenderColor.x <= 20)
            && (RenderColor.y <= 20) && (RenderColor.z <= 20))
         {
            if (!(pTargetEdict->v.oldbuttons & IN_ATTACK) || !(WeaponIsGun))
            {
               return (FALSE);
            }
            else
            {
               SemiTransparent = true;
            }
         }
         else if ((RenderAmount <= 60.0) && (RenderColor.x <= 60)
            && (RenderColor.y <= 60) && (RenderColor.z <= 60))
         {
            SemiTransparent = true;
         }
      }
      else
      {
         if (RenderAmount <= 20)
         {
            if (!(pTargetEdict->v.oldbuttons & IN_ATTACK) || !(WeaponIsGun))
            {
               return (FALSE);
            }
            else
            {
               SemiTransparent = true;
            }
         }
         else if (RenderAmount <= 60)
         {
            SemiTransparent = true;
         }
      }
   }


// KWo - 26.03.2008 - added darkness check
   LightLevel = UTIL_IlluminationOf(pTargetEdict);
//   ALERT(at_logged,"[DEBUG] Bot %s checks the illumination of %s. It's = %f.\n",
//      STRING(pEdict->v.netname), STRING(pTargetEdict->v.netname), LightLevel);

   if ((!pBot->bUsesNVG) && (((LightLevel < 3.0) && (g_f_cv_skycolor > 50.0)) || ((LightLevel < 25.0) && (g_f_cv_skycolor <= 50.0)))
      && (!(pTargetEdict->v.effects & EF_DIMLIGHT)) && (!(pTargetEdict->v.oldbuttons & IN_ATTACK) || !(WeaponIsGun))) // KWo - 17.01.2011
   {
      return (FALSE);
   }
   else if (((((LightLevel < 10.0) && (g_f_cv_skycolor > 50.0)) || ((LightLevel < 30.0) && (g_f_cv_skycolor <= 50.0)))
      && (pTargetEdict->v.oldbuttons & IN_ATTACK) && (WeaponIsGun)) && (!(pTargetEdict->v.effects & EF_DIMLIGHT)) && (!pBot->bUsesNVG)) // KWo - 17.01.2011
   {
      SemiTransparent = true; // in this case we can notice the enemy, but not so good...
   }

//   if (SemiTransparent)
//      ALERT(at_logged, "[DEBUG] FBoxVisible - Bot's %s target SemiTransparent = true, LightLevel = %.2f \n", pBot->name, LightLevel);

   vecLookerOrigin = GetGunPosition (pEdict);
   vecTarget = pTargetEdict->v.origin;

   // Check direct Line to waist
   UTIL_TraceLine (vecLookerOrigin, vecTarget, ignore_monsters, ignore_glass, pEdict, &tr);

   if ((tr.flFraction >= 1.0) || (tr.pHit == pTargetEdict))
   {
      *pvHit = tr.vecEndPos  + Vector (0.0, 0.0, 3.0); // KWo - 13.07.2008
      *ucBodyPart |= WAIST_VISIBLE;
   }

   vecEnDirection = pTargetEdict->v.angles; // KWo - 05.09.2009 (moved)
   MAKE_VECTORS (vecEnDirection);

   // Check direct Line to head
   vecTarget = vecTarget + pTargetEdict->v.view_ofs + Vector(0.0, 0.0, 2.0); // KWo - 02.04.2010
   if (!(pTargetEdict->v.oldbuttons & IN_DUCK))       // KWo - 13.07.2008
   {
      vecTarget = vecTarget + Vector(0.0, 0.0, 1.0);  // KWo - 02.04.2010
   }

   UTIL_TraceLine (vecLookerOrigin, vecTarget, ignore_monsters, ignore_glass, pEdict, &tr);

   // if the player is rendered, his head cannot be good seen...
   if (((tr.flFraction >= 1.0) || (tr.pHit == pTargetEdict)) && (!SemiTransparent))
   {
      *pvHit = tr.vecEndPos;
      *ucBodyPart |= HEAD_VISIBLE;
   }

   if (*ucBodyPart != 0)
      return (TRUE);

   // Nothing visible - check randomly other Parts of Body
   for (i = 0; i < 6; i++)
   {
      vecTarget = pTargetEdict->v.origin;
      switch(i)
      {
         case 0: // left arm
         {
            vecTarget.x -= 10.0 * gpGlobals->v_right.x;
            vecTarget.y -= 10.0 * gpGlobals->v_right.y;
            vecTarget.z += 8.0;
            break;
         }
         case 1: // right arm
         {
            vecTarget.x += 10.0 * gpGlobals->v_right.x;
            vecTarget.y += 10.0 * gpGlobals->v_right.y;
            vecTarget.z += 8.0;
            break;
         }
         case 2: // left leg
         {
            vecTarget.x -= 10.0 * gpGlobals->v_right.x;
            vecTarget.y -= 10.0 * gpGlobals->v_right.y;
            vecTarget.z -= 12.0;
            break;
         }
         case 3: // right leg
         {
            vecTarget.x += 10.0 * gpGlobals->v_right.x;
            vecTarget.y += 10.0 * gpGlobals->v_right.y;
            vecTarget.z -= 12.0;
            break;
         }
         case 4: // left foot
         {
            vecTarget.x -= 10.0 * gpGlobals->v_right.x;
            vecTarget.y -= 10.0 * gpGlobals->v_right.y;
            vecTarget.z -= 24.0;
            break;
         }
         case 5: // right foot
         {
            vecTarget.x += 10.0 * gpGlobals->v_right.x;
            vecTarget.y += 10.0 * gpGlobals->v_right.y;
            vecTarget.z -= 24.0;
            break;
         }
      }
/*
      vecTarget.x += RANDOM_FLOAT (pTargetEdict->v.mins.x, pTargetEdict->v.maxs.x);
      vecTarget.y += RANDOM_FLOAT (pTargetEdict->v.mins.y, pTargetEdict->v.maxs.y);
      vecTarget.z += RANDOM_FLOAT (pTargetEdict->v.mins.z, pTargetEdict->v.maxs.z);
*/

      UTIL_TraceLine (vecLookerOrigin, vecTarget, dont_ignore_monsters, ignore_glass, pEdict, &tr);

      if ((tr.flFraction >= 1.0) && (tr.pHit == pTargetEdict))
      {
         // Return seen position
         *pvHit = tr.vecEndPos;
         *ucBodyPart |= CUSTOM_VISIBLE;
         return (TRUE);
      }
   }

   return (FALSE);
}
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
Doctros
AlliedModders Donor
Join Date: Apr 2011
Location: Chicago ILL. USA
Old 08-11-2012 , 10:46   Re: Bots don't shoot invisible
Reply With Quote #15

Can this be made for the Standard CS CZ Bots?
Doctros is offline
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 08-11-2012 , 12:11   Re: Bots don't shoot invisible
Reply With Quote #16

Quote:
Originally Posted by Doctros View Post
Can this be made for the Standard CS CZ Bots?
I know that you are using the sucking cz bots in your cz server .
if you want to change them to podbot, I can make you the waypoints.
I don't care about big maps, just avoid the maps similar to the gungame ones. their wp take a long time and very annoying to make.
__________________
ANTICHRISTUS is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-29-2021 , 08:24   Re: Bots don't shoot invisible
Reply With Quote #17

Since this is fixed in podbot and the modification is "Counter-Strike" where you can not legally use zbots, I think unapproving this as no longer necessary is the right step.
__________________
HamletEagle is offline
Reply


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 20:41.


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