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

Go Back   .:: Bots United ::. > YappA > Half-Life and HL1 Mods
Half-Life and HL1 Mods Discuss about your favourites HL1 Mods here Half-Life

Reply
 
Thread Tools
Re: Let's kill the bots
Old
  (#11)
The_Hard_Mission_Guy
This user broke our rules and has been BANNED
 
The_Hard_Mission_Guy's Avatar
 
Status: Offline
Posts: 181
Join Date: May 2006
Default Re: Let's kill the bots - 05-08-2006

OK Fasten Seat Belts:
PHP Code:
void StartFramevoid ){
if((
gpGlobals->time 3) && (gpGlobals->time 3.1)) ClientPutInServer(bots[0].pEdict); //Init the Game
 
if(gpGlobals->time 3){
if(
fabs(gpGlobals->time) > 1){
if((
current->pEdict->v.origin g).Length() < 50){
g_engfuncs.pfnServerPrint("I'm too Slow , Kill me!\n");
ClientKill(current->pEdict);
}
current->pEdict->v.origin
gpGlobals->time
}
}
if(
current->pEdict->v.deadflag != DEAD_NO){
botnumber++;
if(
botnumber >= 7){
botnumber 0;
}
ClientPutInServer(bots[botnumber].pEdict);
current = &bots[botnumber];
}
 
BotThink(current);
 
(*
other_gFunctionTable.pfnStartFrame)();

So this is the main Code .....what is very important to say is that the phrase ("I'm too Slow , Kill me!\n" gets printed out exactly when it should but the ClientKill() beneath gets totally ignored....
Can you see something I've overseen?

P.S also very important to note is that I'm having only one bot running at the same time (as you can see) the next bot gets called after the previous dies....
  
Reply With Quote
Re: Let's kill the bots
Old
  (#12)
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

From where you got the data for the pointer current->pEdict ?
  
Reply With Quote
Re: Let's kill the bots
Old
  (#13)
The_Hard_Mission_Guy
This user broke our rules and has been BANNED
 
The_Hard_Mission_Guy's Avatar
 
Status: Offline
Posts: 181
Join Date: May 2006
Default Re: Let's kill the bots - 05-08-2006

Initialized in ServerActivate()
  
Reply With Quote
Re: Let's kill the bots
Old
  (#14)
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

Are you using array to get it in ClientConnect() ? Because if new bot join the pointer will be overwrited ?
  
Reply With Quote
Re: Let's kill the bots
Old
  (#15)
The_Hard_Mission_Guy
This user broke our rules and has been BANNED
 
The_Hard_Mission_Guy's Avatar
 
Status: Offline
Posts: 181
Join Date: May 2006
Default Re: Let's kill the bots - 05-08-2006

Yep! I'm using an array of a struct called bot_t which holds pEdict.
also I omited ClientPutInServer() from BotCreate() so that they are spawned in StartFrame()
  
Reply With Quote
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
Re: Let's kill the bots
Old
  (#17)
The_Hard_Mission_Guy
This user broke our rules and has been BANNED
 
The_Hard_Mission_Guy's Avatar
 
Status: Offline
Posts: 181
Join Date: May 2006
Default Re: Let's kill the bots - 05-08-2006

Hmmmmm , OK I'll re-check the rest of of my code ..

but how do you explain the fact that , when I replace ClienKill() with ClientPutInserver() in the above Code that the Bot gets successfully respawned ?
  
Reply With Quote
Re: Let's kill the bots
Old
  (#18)
The_Hard_Mission_Guy
This user broke our rules and has been BANNED
 
The_Hard_Mission_Guy's Avatar
 
Status: Offline
Posts: 181
Join Date: May 2006
Default Re: Let's kill the bots - 05-08-2006

Assuming that current->pEdict points to an invalid Entity or to another player , how is it possible that this same "invalid" pointer is fed to pfnPlayerMove() and results in the bot jumping , moving , shooting around successfully ?
  
Reply With Quote
Re: Let's kill the bots
Old
  (#19)
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

ClientPutInServer() must be called only one time for each bot. Now you have all the bot edicts sotred in bots[32] loop this array and do the job.
  
Reply With Quote
Re: Let's kill the bots
Old
  (#20)
The_Hard_Mission_Guy
This user broke our rules and has been BANNED
 
The_Hard_Mission_Guy's Avatar
 
Status: Offline
Posts: 181
Join Date: May 2006
Default Re: Let's kill the bots - 06-08-2006

You didn't answer my last question!
  
Reply With Quote
Reply


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

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 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com