.:: Bots United ::.  
filebase forums irc server wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps waypoints yapb

Go Back   .:: Bots United ::. > Cyborg Factory > HPB_bot
HPB_bot The trusty good ole mechs by botman HLDMTFCOpposing ForceDMCFront Line Force

Reply
 
Thread Tools
op4ctf
Old
  (#1)
Whistler
Whistler
 
Whistler's Avatar
 
Status: Offline
Posts: 1,490
Join Date: Feb 2004
Location: P. R. China
Default op4ctf - 02-07-2004

I have just found that the op4ctf flag owner problem isn't fixed correctly. actually there're quite a lot of places checking pent->v.owner and all of them need to check pent->v.origin as well:
(actually I think this is a bug of OP4. the "owner" field is just not nulled out when someone lost the flag and we have to use a "hack" like this to "fix" it)

Code:
   else if ((mod_id == GEARBOX_DLL) && (pent_info_ctfdetect != NULL))
   {
      pent = NULL;

      while ((pent = UTIL_FindEntityByClassname( pent, "item_ctfflag" )) != NULL)
      {
         // is this bot carrying the item? (after capture bug fix by Whistler)
         if ((pent->v.owner == pEdict) && (pent->v.origin == pEdict->v.origin))
         {
            // we are carrying the flag

            bot_has_flag = TRUE;

            break;  // break out of while loop
         }
         else if (FInViewCone( &pent->v.origin, pEdict ) &&
                  FVisible( pent->v.origin, pEdict))
         {
            // the bot can see it, check what type of model it is...

            skin = pent->v.skin;

            if (skin == 0) // Opposing Force team (these are BACKASSWARDS!)
               skin = 1;
            else if (skin == 1) // Black Mesa team
               skin = 0;

            // see if the flag matches the bot's team...
            if (skin == team)
            {
               // is and enemy carrying our flag/card?
               if (pent->v.owner != NULL)
               {
+                 if (pent->v.origin == pent->v.owner->v.origin)
+                 {
                     // kill the man with the flag/card!
                     pBot->pBotEnemy = pent->v.owner;

                     pBot->waypoint_goal = -1;  // forget the goal (if there is one)

                     return TRUE;
+                 }
               }
            }
            else  // flag/card is for another team!
            {
               // check if someone is NOT carrying the flag/card...
+              bool bIsCarrying = FALSE;
+              if (!FNullEnt(pent->v.owner))
+              {
+                 if (pent->v.origin == pent->v.owner->v.origin)
+                    bIsCarrying = TRUE;
+              }

-              if (pent->v.owner == NULL)
+              if (bIsCarrying)
               {
                  // find the nearest waypoint to the flag/card...
                  index = WaypointFindNearest(pent->v.origin, pEdict, 500, team);

                  if (index == -1)
                  {
                     // no waypoint is close enough, just head straight towards the flag/card
                     Vector v_flag = pent->v.origin - pEdict->v.origin;

                     Vector bot_angles = UTIL_VecToAngles( v_flag );

                     pEdict->v.ideal_yaw = bot_angles.y;

                     BotFixIdealYaw(pEdict);

                     return TRUE;
                  }
                  else
                  {
                     waypoint_distance = (waypoints[index].origin - pent->v.origin).Length();
                     distance = (pent->v.origin - pEdict->v.origin).Length();

                     // is the bot closer to the flag/card than the waypoint is?
                     if (distance < waypoint_distance)
                     {
                        // just head towards the flag/card
                        Vector v_flag = pent->v.origin - pEdict->v.origin;

                        Vector bot_angles = UTIL_VecToAngles( v_flag );

                        pEdict->v.ideal_yaw = bot_angles.y;

                        BotFixIdealYaw(pEdict);

                        return TRUE;
                     }
                     else
                     {
                        // head towards this waypoint
                        pBot->waypoint_goal = index;

                        // remember where the flag/card is located...
                        pBot->waypoint_near_flag = TRUE;
                        pBot->waypoint_flag_origin = pent->v.origin;
                     }
                  }
               }
            }
         }
      }
   }
  
Reply With Quote
Re: op4ctf
Old
  (#2)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 4643'60N 043'0W 0.187A
Default Re: op4ctf - 02-07-2004

Seeing this I wonder if it would be a good idea to put the HPB_bot code on CVS as well ?

What do you guys think ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: op4ctf
Old
  (#3)
MusicMan
Member
 
Status: Offline
Posts: 236
Join Date: Feb 2004
Default Re: op4ctf - 02-07-2004

go for it

Last edited by MusicMan; 02-07-2004 at 17:05..
  
Reply With Quote
Re: op4ctf
Old
  (#4)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,083
Join Date: Nov 2003
Location: Netherlands
Default Re: op4ctf - 02-07-2004

CVS rules the world..... lets put it there


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: op4ctf
Old
  (#5)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 4643'60N 043'0W 0.187A
Default Re: op4ctf - 02-07-2004

lol, well sure as hell if the whole world was on CVS I'd do a cvsup and commit() two or three things



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: op4ctf
Old
  (#6)
bomberman
Guest
 
Status:
Posts: n/a
Default Re: op4ctf - 02-07-2004

hmm ... may I know what is CVS and how to use it ?
  
Reply With Quote
Re: op4ctf
Old
  (#7)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: op4ctf - 02-07-2004

CVS is a source control versioning system.

WinCVS is a popular Windows client to access CVS files.

botman
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com