View Single Post
Re: Let's kill the bots
Old
  (#16)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Let's kill the bots - 05-08-2006

ServerActivate() is not good to get bot edicts, you can't get the bots edicts at all from it, ClientPutInServer() is not usefull because you must call it for each bot, this function is not called auto when you create the bot with the engine. I suggest to do the edicts update and checks in start frame, and to spawn the bots in their own BotThink() function.
put that in the begining of start frame:
Code:
for (int iPlayerIndex = 1; iPlayerIndex <= gpGlobals->maxClients; iPlayerIndex++)
    {
      edict_t *pPlayer = INDEXENT(iPlayerIndex);
      int iStoreIndex = iPlayerIndex - 1;
      if (!FNullEnt(pPlayer) && !pPlayer->free && (pPlayer->v.flags & (FL_CLIENT | FL_FAKECLIENT)))
      {
          bots[iStoreIndex].pEdict = pPlayer;
          bots[iStoreIndex].bIsUsed = TRUE;
      }
      else
      {
          bots[iStoreIndex].bIsUsed = FALSE;
          bots[iStoreIndex].pEdict = NULL;
      }
   }
bot_t bots[32]; - make this global.
  
Reply With Quote