AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   IsShootableThruObstacle (https://forums.alliedmods.net/showthread.php?t=53089)

KWo 03-25-2007 17:32

IsShootableThruObstacle
 
What is the easiest way to check if the weapon I have is able to shoot at something throught some obstacle (some wall or some doors)? I mean if I can make some damage of the enemy which is behind some obstacle like a wall of a door.

VEN 03-26-2007 02:41

Re: IsShootableThruObstacle
 
I do not think you can know whether it shootable or not unless you hack game dll attack tracing.

KWo 03-26-2007 04:40

Re: IsShootableThruObstacle
 
Isn't there a way to know the thickness of the obstacle - which should affect shootable thing the most?

VEN 03-26-2007 04:58

Re: IsShootableThruObstacle
 
Would you know "max. value of thickness" of obstacle when it's still possible to shoot though it for every weapon?

Furthermore thickness isn't the only aspect that is used to determine that. It's also depends on:
  • obstacle material
  • whether silencer is used or not
  • angle of bullet vector
  • whether it's a first obstacle or not
  • etc etc etc
Now question: would you be able to create accurate formula to handle all possible aspects?

KWo 03-26-2007 10:01

Re: IsShootableThruObstacle
 
I just want to replace this function in podbot mm by something simpler and written more optimized:
Code:

bool IsShootableThruObstacle (edict_t *pEdict, Vector vecDest)
{
  // Returns if enemy can be shoot through some obstacle
  // TODO: After seeing the disassembled CS Routine it could be speedup and simplified a lot

  Vector vecSrc = GetGunPosition (pEdict);
  Vector vecDir = (vecDest - vecSrc).Normalize (); // 1 unit long
  Vector vecPoint;
  int iThickness = 0;
  int iHits = 0;

  edict_t *pentIgnore = pEdict;
  TraceResult tr;

  UTIL_TraceLine (vecSrc, vecDest, ignore_monsters, ignore_glass, pentIgnore, &tr);

  while ((tr.flFraction != 1.0) && (iHits < 3))
  {
      iHits++;
      iThickness++;
      vecPoint = tr.vecEndPos + vecDir;

      while ((POINT_CONTENTS (vecPoint) == CONTENTS_SOLID) && (iThickness < 98)) // KWo - 23.10.2006
      {
        vecPoint = vecPoint + vecDir;
        iThickness++;
      }

      UTIL_TraceLine (vecPoint, vecDest, ignore_monsters, ignore_glass, pentIgnore, &tr);
  }

  if ((iHits < 3) && (iThickness < 98)) // KWo - 23.10.2006
  {
      float f_distance = (vecDest - vecPoint).Length ();

      if (f_distance < 121.95) // KWo - 23.10.2006
        return (TRUE);
  }

  return (FALSE);
}

That "// TODO" comment it's original Count Floyd's comment, but I have no idea what he was thinking about, that's why I'm asking here the people they have better HL knowledge than me.


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

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