Quote:
Originally Posted by stefanhendriks
As for shooting through walls:
1. traceline from player A to B , get wall intersection X
2. traceline from player B to A , get wall intersection Y
"width" of wall is X - Y.
You can do some tricks with that. Basically it is cheating of course. SO add some 'noise' in the aiming to make the bots not super lethal.
Thats it?
|
well IIRC for CS shoting through walls is not only affected by the "width" of wall, but also affected by how many walls are shooting through. This may not be completely exact, but it should work most of the time:
Code:
//=========================================================
// Returns if enemy can be shoot through some obstacle
//=========================================================
bool CBaseBot::IsShootableThruObstacle(Vector vecDest)
{
if (!WeaponShootsThru(m_iCurrentWeapon))
return FALSE;
Vector vecSrc = EyePosition();
Vector vecDir = (vecDest - vecSrc).Normalize(); // 1 unit long
Vector vecPoint = g_vecZero;
int iThickness = 0;
int iHits = 0;
edict_t *pentIgnore = pev->pContainingEntity;
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 < 64)
{
vecPoint = vecPoint + vecDir;
iThickness++;
}
UTIL_TraceLine(vecPoint, vecDest, ignore_monsters, ignore_glass, pentIgnore, &tr);
}
if (iHits < 3 && iThickness < 64)
{
if (LengthSquared(vecDest - vecPoint) < 12544)
return TRUE;
}
return FALSE;
}
for other MODs things may be different though.