AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Unapproved/Old Plugins (https://forums.alliedmods.net/forumdisplay.php?f=27)
-   -   Bots don't shoot invisible (https://forums.alliedmods.net/showthread.php?t=187545)

DarkGL 06-14-2012 15:06

Bots don't shoot invisible
 
1 Attachment(s)
In standard bots were shooting to people who are invisible this plugin change this.
If we are invisible bots can just don't see us. Tested on podbots.


claudiuhks 06-14-2012 15:14

Re: Bots don't shoot invisible
 
Author shouldn't be Unknown
I suggest to hook is_user_alive, is_user_bot into variables like g_bAlive, ..., when client_putinserver, client_disconnect, PlayerSpawn_Post and PlayerKilled

Exolent[jNr] 06-14-2012 15:20

Re: Bots don't shoot invisible
 
I suggest adding support for render modes other than TransAlpha since that isn't the only one you can be invisible with.

DarkGL 06-14-2012 15:58

Re: Bots don't shoot invisible
 
@Update

ConnorMcLeod 06-14-2012 16:42

Re: Bots don't shoot invisible
 
I thought KWo had fixed it on podbots

Arkshine 06-14-2012 17:12

Re: Bots don't shoot invisible
 
So far I know, it has been already added, yes.

DarkGL 06-14-2012 17:17

Re: Bots don't shoot invisible
 
I didn't check this plugin was made for one of amxx.pl users which say that bots kill invisible people ;) It can be use with zbots

YamiKaitou 06-14-2012 17:24

Re: Bots don't shoot invisible
 
Quote:

Originally Posted by DarkGL (Post 1728881)
It can be use with zbots

Which are illegal to use

DarkGL 06-14-2012 17:26

Re: Bots don't shoot invisible
 
I didn't see podbots source code but they maybe only don't "see" people who are fully invisible ?

claudiuhks 06-14-2012 18:40

Re: Bots don't shoot invisible
 
As another suggestion, I think it would be better to don't use public for functions which are not forwards like set_task, RegisterHam, register_event or other natives.

-- Edited --

And for your next update, would be better to define:

Code:
const gmaxClients = 32; // Instead of: // new gmaxClients = 32;

Code:
public fwKilled( id ){ // Instead of: // public fwKilled( id , idattacker , shouldgib ){ // (because you don't use these variables)

Code:
    return !( 0 < iRender < 3 && 3 < iRender < 6 ); // Instead of: //  return ( iRender != kRenderTransColor && iRender != kRenderTransTexture && iRender != kRenderTransAlpha && iRender != kRenderTransAdd );

DarkGL 06-14-2012 19:22

Re: Bots don't shoot invisible
 
another update with little changes

GordonFreeman (RU) 06-14-2012 22:31

Re: Bots don't shoot invisible
 
last beta version of podbot has built-in feature - dont shot invisible players - until they dont fire

ConnorMcLeod 06-15-2012 01:24

Re: Bots don't shoot invisible
 
Quote:

Originally Posted by GordonFreeman (RU) (Post 1728979)
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.

KWo 06-15-2012 03:40

Re: Bots don't shoot invisible
 
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);
}


Doctros 08-11-2012 10:46

Re: Bots don't shoot invisible
 
Can this be made for the Standard CS CZ Bots?

ANTICHRISTUS 08-11-2012 12:11

Re: Bots don't shoot invisible
 
Quote:

Originally Posted by Doctros (Post 1769234)
Can this be made for the Standard CS CZ Bots?

I know that you are using the sucking cz bots in your cz server :down:.
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.

HamletEagle 08-29-2021 08:24

Re: Bots don't shoot invisible
 
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.


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

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