.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   To many bots! (http://forums.bots-united.com/showthread.php?t=4376)

andrewcaus 21-08-2005 08:11

To many bots!
 
Ok, I am making my own bots, and I have got them to initialize/join game.

Now, I set it so that only 5 bots can join:

if (botcount < 5) {
...bot code...
botcount++;
}

I started a dedicated server with maxplayers set to 10, and what happens is this:

bot joining...
bot joining...
bot joining...
bot joining...
bot joining...

BUT! The number is 5, but then automatically changes to 10. I type "status", and it's got:

Bot
(1)Bot
etc... all the way to 10.

If I start a server with maxplayers of 32, 32 bots will join. Why is this happening?

KWo 21-08-2005 10:08

Re: To many bots!
 
Probably Your variable botcount is cleared at the beginning of the next frame - so the new frame You still have ( botcount < 5 ) - the new bots join the server...

Pierre-Marie Baty 21-08-2005 15:46

Re: To many bots!
 
Yes, declare botcount a static variable, or put it at global scope. StartFrame() isn't comparable to a sort of "int main()" function, StartFrame() is called EVERY game tick, which corresponds if you are running a listen server to your frame rate.


All times are GMT +2. The time now is 01:46.

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