View Single Post
Re: Podbots cannot shoot breakables
Old
  (#2)
sPlOrYgOn
<-- He did it.
 
sPlOrYgOn's Avatar
 
Status: Offline
Posts: 1,558
Join Date: Jan 2004
Location: Los Angeles, California, USA, North America, Earth, Solar System, Milky Way.
Default Re: Podbots cannot shoot breakables - 09-07-2004

YAYA!
It's fixed !
here's the new code:
Code:
bool BotFindBreakable (bot_t *pBot)
{
   // Checks if Bot is blocked by a Shootable Breakable in his moving direction

   TraceResult tr;
   edict_t *pEdict = pBot->pEdict;

   Vector v_src = pEdict->v.origin;
   Vector vecDirection = (VecBModelOrigin (pBot->pShootBreakable) - v_src).Normalize ();
   Vector v_dest = v_src + vecDirection * 50;

   TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
   if ((tr.flFraction != 1.0)
       && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
       || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
       && IsShootableBreakable (tr.pHit))
   {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
   }

   v_src = GetGunPosition (pEdict);
   vecDirection = (VecBModelOrigin (pBot->pShootBreakable) - v_src).Normalize ();
   v_dest = v_src + vecDirection * 50;

   TRACE_LINE (v_src, v_dest, dont_ignore_monsters, pEdict, &tr);
   if ((tr.flFraction != 1.0)
       && (FStrEq ("func_breakable", STRING (tr.pHit->v.classname))
       || FStrEq ("func_pushable", STRING (tr.pHit->v.classname)))
       && IsShootableBreakable (tr.pHit))
   {
      pBot->vecBreakable = tr.vecEndPos;
      return (TRUE);
   }

   pBot->pShootBreakable = NULL;
   pBot->vecBreakable = g_vecZero;
   return (FALSE);
}
I changed it from pShootBreakable->v.origin to VecBModelOrigin (pBot->pShootBreakable)
I don't know why v.origin is g_vecZero though.. seems strange..

[edit]
new dll can be found here http://www.mapzap.org/files/podbot/podbotBETA.zip
[/edit]

Last edited by sPlOrYgOn; 09-07-2004 at 02:56..
  
Reply With Quote