Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make bot shuffle?
#1
how do I make the bot do !sp for each game it autohost?
Reply
#2
You have to edit the source code.

Just add a ShuffleSlots( ) in the CBaseGame::EventGameStarted( ) function (and recompile).
Reply
#3
Thank you for that.

Any way to make it only the auto-hosted games?
Reply
#4
It's hard to detect an autohosted game. You can check if m_AutoStartPlayers is greater than 0. But then the bot will also shuffle games where you use the !autostart x command.

With some more programming there is also a better solution. For example you can define a boolean variable and set it when the bot creates a autohost game.
Reply
#5
Ill stick with your original solution if I can.

So editing the game.ccp would look like this?

Code:
{
    CBaseGame :: EventGameStarted( );

    // record everything we need to ban each player in case we decide to do so later
    // this is because when a player leaves the game an admin might want to ban that player
    // but since the player has already left the game we don't have access to their information anymore
    // so we create a "potential ban" for each player and only store it in the database if requested to by an admin

    for( vector<CGamePlayer *> :: iterator i = m_Players.begin( ); i != m_Players.end( ); i++ )
        m_DBBans.push_back( new CDBBan( (*i)->GetJoinedRealm( ), (*i)->GetName( ), (*i)->GetExternalIPString( ), string( ), string( ), string( ), string( ) ) );

ShuffleSlots( );
}
Reply
#6
I've put it in game_base.cpp. Maybe you want to have it look like this:
Code:
void CBaseGame :: EventGameStarted( )
{
    if( m_AutoStartPlayers != 0 )
        ShuffleSlots( );

    CONSOLE_Print( "[GAME: " + m_GameName + "] started loading with " + UTIL_ToString( GetNumHumanPlayers( ) ) + " players" );
...
}
This will shuffle the slots after the countdown and only if it's an autohosted game or a game with !autostart x.

EDIT: You could also make the shuffle configurable through a mapconfigWink.
Reply
#7
Seems to be working. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Bots and gproxy make worse connection than before Smartie 11 13,145 2011-07-23, 11:21:07
Last Post: Velocity2k



Users browsing this thread: 2 Guest(s)