.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   Slight problem with uber simple bot. (http://forums.bots-united.com/showthread.php?t=1056)

voogru 10-03-2004 19:15

Slight problem with uber simple bot.
 
Hello,

Im currently just writing a small bot, which just needs to be a player on a team (In natural-selection the game doesnt start unless both teams have at least one play, so I just need a bot to be on the other team while I test whatever I need to test), I've used some code from HPB_Bot, which spawns the bot and makes him connect.

Well, I'm happy to say, the bot spawns, joins a team that I want it to, but, it does not show up on the scoreboard, it shows up on status/rcon users however.

Is there something I'm missing here?

Any help would be great.

Thanks

- voogru.

Lazy 10-03-2004 19:23

Re: Slight problem with uber simple bot.
 
That does sound odd, are you calling the player function of the mod? ie: CALL_GAME_ENTITY ( I'm assuming this is for metamod ).

voogru 10-03-2004 19:39

Re: Slight problem with uber simple bot.
 
Auctually I'm not using metamod, but I am calling the game entity.

Code:

 
 
extern "C" void* player(entvars_t* pev);
 
 if(FStrEq(Cmd_Argv(0), "addbot"))
 {
  char szName[] = {"Badger"};
  char szRejectMessage[128];
  edict_t* pEdict = (*g_engfuncs.pfnCreateFakeClient)(szName);
  if (pEdict != NULL)
  { 
  player(&pEdict->v);
 
 
  ClientConnect(pEdict, szName, "127.0.0.1", szRejectMessage);
  ClientPutInServer(pEdict);
 
  pEdict->v.flags |= FL_FAKECLIENT;
  edict_t *pInfoTeam = NULL;
  while(pInfoTeam = UTIL_FindEntityByClassname(pInfoTeam, "info_join_team"))
  {
        if(pInfoTeam->v.team == atoi(Cmd_Argv(1)))
        {
        DispatchTouch(pInfoTeam, pEdict);
        break;
        }
  }
  }
 }

As you can see, its simple as pie.

Lazy 10-03-2004 20:18

Re: Slight problem with uber simple bot.
 
I don't know why this works, it just does though. Change where necissary...

Code:

  const char* pszName = "Badger";
  char szRejectMsg[ 128 ];
  edict_t* pSpot = NULL; 
  edict_t* pBot = NULL;
  pBot = ( *g_engfuncs.pfnCreateFakeClient ) ( pszName );
  if ( ! FNullEnt( pBot ) )
  {
          CALL_GAME_ENTITY( PLID, "player", VARS( pBot ) );
          pBot->v.flags |= FL_FAKECLIENT;
          MDLL_ClientConnect( pBot, pszName, "127.0.0.1", szRejectMsg );
          MDLL_ClientPutInServer( pBot );
          while ( ( pSpot = FIND_ENTITY_BY_STRING( pSpot, "classname", "info_join_team" ) ) != NULL )
          {
                if ( pSpot->v.team == atoi( CMD_ARGV( 1 ) ) )
                {
                        MDLL_Touch( pSpot, pBot );
                        break;
                }
          }
          ( *g_engfuncs.pfnRunPlayerMove ) ( pBot, pBot->v.v_angle, 0, 0, 0, pBot->v.button, 0, 0 );
  }


Pierre-Marie Baty 10-03-2004 20:26

Re: Slight problem with uber simple bot.
 
When you mean "doesn't show up in the scoreboard" do you mean the bot doesn't show up AT ALL, even in grey or with the spectators ?

voogru 10-03-2004 20:27

Re: Slight problem with uber simple bot.
 
That worked.

Thanks!

voogru 10-03-2004 20:28

Re: Slight problem with uber simple bot.
 
And I meant that they didnt show up on the scoreboard at all, not even under spectators. As if they were not even there.

Lazy 10-03-2004 20:29

Re: Slight problem with uber simple bot.
 
I think its one of those wierd engine things, when I was working on a bot long ago it would also do wierd things unless RunPlayerMove was called.

Pierre-Marie Baty 10-03-2004 22:27

Re: Slight problem with uber simple bot.
 
now what I don't understand is that you said the code Lazy posted WORKS although the bot is not using metamod, WTF ??? how on earth can this be ????:(

Lazy 10-03-2004 22:46

Re: Slight problem with uber simple bot.
 
I told him to modify the code as needed, all of the metamod stuff can be done in a standalone dll.

Unless I completely mis-understood what you were saying.


All times are GMT +2. The time now is 23:25.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.