AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Prevent bots from changing team or spectating? (FoxBot for TFC) (https://forums.alliedmods.net/showthread.php?t=298185)

pizzahut 06-04-2017 07:34

Prevent bots from changing team or spectating? (FoxBot for TFC)
 
The problem with FoxBots is that they occasionally change team and do other weird things like they might be stuck in spectator mode or they sometimes don't select a class. I've written a plugin which corrects these mistakes after they happen.

Is there a way to block the random team changes / going into spectator mode? For humans I can just register the corresponding console commands and block them, but this doesn't work for bots.

Client commands are "jointeam (number)" and "spectate", e.g.

Code:
engclient_cmd(id, "jointeam", bot_team)

To join a class, the corresponding console command is the class name:

Code:
                case 1: engclient_cmd(id, "scout")                 case 2: engclient_cmd(id, "sniper")                 case 3: engclient_cmd(id, "soldier")                 case 4: engclient_cmd(id, "demoman")                 case 5: engclient_cmd(id, "medic")                 case 6: engclient_cmd(id, "hwguy")                 case 7: engclient_cmd(id, "pyro")                 case 8: engclient_cmd(id, "spy")                 case 9: engclient_cmd(id, "engineer")                 case 10: engclient_cmd(id, "randompc")

Unzy 06-04-2017 12:01

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
Hi Pizzahut,

I can provide you/moderators maybe with some more details

I am using your plugin on my server, the spectatormode on scoreboard bug is indeed frequently happening. I have to say that the bots showing in spectatormode are actually playing, even if it shows they are spectating! It also happen only on mapchange, during spawning. Once a bot show in spectator mode it stays on the scoreboard all map, eventho I can clearly see the bot actively playing.
Its also random numbers, sometimes only one bot, sometimes there's a bunch, like 4 or 5

I was thinking : Do they spawn too quickly, following each other too fast? Or is there a problem with speed? Sometimes i feel they are running way to fast

My spawn settings are set to 3 secs, server maxspeed is set at 320

The other bug that bot joins other team/random team changes, I don't have any trouble with that.

Greetings and thnx!
-X-

Craxor 06-04-2017 12:04

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
Check the plugin from my signature, the last buildv1.* , and add an is_user_bot() in your blockch() public..

Did you figure out how?

pizzahut 06-04-2017 12:41

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
Thanks for the help Craxor. However as I mentioned, blocking client commands only works for human players.

Unzy if it only happens on map change, maybe try adding a delay. In the "foxbot.cfg", make sure that you first set the pause and bot_create_interval variables, and have the addbot commands at the end. So like this:

Code:

# Minimum bots in server (0 - 32 [-1 Turns this off])
# The number of bots on the server should never go below this value.
min_bots -1

# Maximum bots in server (0 - 32 [-1 Turns this off])
# The number of bots on the server should never go above this value.
# You should set this to 1 or 2 less than maxplayers, otherwise new human players
# will not be able to join your server.
max_bots -1

# bot_total_varies (0 - 3)
# When this setting is set to 1, 2, or 3 the number of bots on the server will
# fluctuate from min_bots to max_bots randomly(to simulate online play).
# The higher you set it the more often the numbers of bots playing will change.
bot_total_varies 0

# Bot team balance (0 off, 1 on)
# Turn this on to force the bots to try and keep the teams even.
# Turning this off will let the bots decide for themselves what teams they prefer.
bot_team_balance 0

# Bot to human balance (0 off, 1 on)
# Turn this on to balance the teams in a bot to human ratio (May be buggy)
# Note: This can force human players to change teams.
bot_bot_balance 0

# Bots celebrate xmas (off / on)
bot_xmas off

# bot_allow_moods (0 off, 1 on)
# If this is set to 1 any bots created will be given random personality traits
# and/or moods.  Set this to 0 if you want all the bots to have the same personality.
bot_allow_moods 0

# bot_allow_humour (0 off, 1 on)
# When this is set to 1 the bots will be allowed to go crazy occasionally and
# do stuff such as using melee weapons only, or go looking for walls to graffiti.
bot_allow_humour 0

# Seconds before bots join after a map has started (0 - 100)
# This will be overridden if any addbot commands are used in this file.
pause 10

# bot_create_interval (1 - 8)
# Time(measured in seconds) between auto-creating one bot and the next.
# Note: On slower machines and/or early versions of TFC setting this to 1 or 2
# might cause your server to crash(caused by a Half-Life bug).
# If this setting does cause crashing try setting it to 3 or higher.
bot_create_interval 3

# Here you can put addbot commands to create a default set of bots to play with.
# addbot <team> <class> <name> <skill>
# If you do not specify a class the spawned bot will be able to change
# classes when it wants to.
addbot 2 1 Mr.Tom 1
addbot 2 1 Mr.JD 1
addbot 2 2 Mr.Ghey 2
addbot 2 3 Mr.-X- 1
addbot 2 3 Mr.Galt 1
addbot 2 3 Mr.P4r4l4x 1
addbot 2 4 Mr.Dead 1
addbot 2 4 Mr.3vil 1
addbot 2 5 Mr.LoL 1
addbot 2 5 Mr.WSICM 1
addbot 2 5 Mr.3asy 1
addbot 2 6 Mr.Bruno 1
addbot 2 7 Mr.Mani 1
addbot 2 8 Mr.Cali 1
addbot 2 9 Mr.C4sc4 1
addbot 2 9 Ms.Piit 1


Unzy 06-04-2017 13:12

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
Pizzahut,

I have indeed my config like that.

What i noticed is :

It doesnt happen when there are no humans! My server is 32 slots, 16vs16, when theres no humans all 16 bots are nicely spawn and scoreboard gives all 16 playing with their scores correct

When I join and specced the bots spawning (keeping scoreboard key pressed), i see they all go for A SPLIT SECOND in spectatormode and then join team. Usually one stays stuck in spec mode , sometimes there's more

Just for info!

-X-

HamletEagle 06-04-2017 13:33

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
It may be something weird in this bot code. Could someone attach their source so we can check?

pizzahut 06-04-2017 15:01

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
I have an idea, maybe in addition to the jointeam command (via engclient_cmd) I should create a TeamInfo event, this might update the scoreboard?

Plugin source: http://rv.apg-clan.org/dlds/amxx_plu...s_humans_x.sma

It's a modified version of this: https://forums.alliedmods.net/showthread.php?t=197129

Difference is that it doesn't change bot count, so it's simplified for Unzy's needs.

Bot source code: https://apg-clan.org/vbdownloads.php...ownloadid=1107

Unzy 06-04-2017 15:35

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
I should also maybe mention my foxbot vesrion! I use an old one 0.701 (i have the source code if you want)

The newer versions the bots act weird on A/D maps like warpath and avanti, they dont cap the CP

Grtz and thnx!

-X-

pizzahut 06-04-2017 16:00

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
Added this now, needs testing though.

Code:
new team_name[32] // new variable ... // old code get_pcvar_string(g_bvh_bot_team, bot_team, charsmax(bot_team)) engclient_cmd(id, "jointeam", bot_team) // added new code message_begin(MSG_ALL, get_user_msgid("TeamInfo")) write_byte(id) if (!team_name[0]) get_user_team(id, team_name, charsmax(team_name)) // only retrieve if not already set write_string(team_name) message_end()

http://rv.apg-clan.org/dlds/amxx_plu..._humans_x2.sma

Craxor 06-04-2017 16:03

Re: Prevent bots from changing team or spectating? (FoxBot for TFC)
 
again, check my reply ... i know what i'm talking about and i have tested with podbot and working fine.


All times are GMT -4. The time now is 06:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.