Left 4 Dead 2

Left 4 Dead 2

Left 4 Bots (Improved A.I.)
 This topic has been pinned, so it's probably important
smilzo  [developer] Feb 19, 2021 @ 7:36am
Advanced configuration
I made this post because i noticed that some of the feature requests i receive are already possible by changing some game cvars.

What are cvars?
The cvars are like settings of the game (not the addon) that allow to change things and can also alter the gameplay.
Usually the cvars can be set via console but most of them can be changed only if sv_cheats (which is also a cvar) is set to 1 but this disables the achievements.
VScript addons like this can change the cvars on the fly without the need to set sv_cheats to 1 so without disabling the achievements.

How do i change the cvars with L4B?
All you need to do is to add the cvar changes in the convars.txt file.
Here is the official (Valve) list of the L4D2 cvars:
https://developer.valvesoftware.com/wiki/List_of_L4D2_Cvars
Most of them will not work because they are client side or simply have no effect on the gameplay but usually the ones tagged with "sv" (in the third column) are server side cvars.
The ones with "cmd" in the second column are commands and cannot be used in the convars.txt file.
Usually the cvars related to the survivor bots have their names starting with "sb_", the ones starting with "z_" are related to the infected (so you can try to improve the infected AI if you want).

For example you can:
  • Enable the bots friendly fire by adding this line
    sb_friendlyfire 1
    in convars.txt file (don't forget to change "sb_allow_shoot_through_survivors" to "0" to avoid that they shoot the infected through you)
  • Disable the friendly fire:
    survivor_friendly_fire_factor_easy 0 survivor_friendly_fire_factor_expert 0 survivor_friendly_fire_factor_hard 0 survivor_friendly_fire_factor_normal 0
  • Make the bots lead (they will never go too far from you though):
    sb_allow_leading 1 sb_escort 0
  • Allow the bots to move left and right to acquire the target infected when they don't have direct visibility:
    sb_sidestep_for_horde 1
    I defaulted this to 0 to avoid that they cross your line of fire too often when you are holding a position but you can change it if you want.
  • Allow all the bots to use melee weapons:
    sb_max_team_melee_weapons 4

Can i also change the cvars that have nothing to do with the bots?
Of course. For example you can:
  • Allow survivors to crawl while incapped:
    survivor_allow_crawling 1 survivor_crawl_speed 120
  • Increase the tank's health:
    z_tank_health 6000
  • Remove the jockey:
    z_jockey_limit 0
  • Have infinite ammo:
    sv_infinite_primary_ammo 1
  • Lower the gravity:
    sv_gravity 350
  • And so on...

Map specific customization
L4B addon allows you to make different cvar changes depending on the current map by creating a .txt file named "convars_[mapname].txt" (for example: convars_c1m1_hotel.txt) in the "ems\left4bots\cfg\" directory.
The addon will always load the the cvars from "convars.txt" first and then, if the file exists, it will load the cvars from the map specific convars file so in the second file you don't need to put all the convars but only the ones that you want to be different in that particular map.

Same goes for the addon settings, the addon load it's settings from the file settings.txt but, if a file "settings_[mapname].txt" exists, it will be loaded too.
This can be useful for the maps where the bots lock themselves out of the saferoom (like c1m1_hotel) you can increase the value of "close_saferoom_delay".
For example i have a file named "settings_c1m1_hotel.txt" with this line:
close_saferoom_delay = 0.9

vocalizer.txt
This file maps the vocalizer commands to the addon's internal commands.
You can edit this file to remap one or more addon command to different vocalizer lines.

noscavenge.txt
With this file you can tell the addon in which maps the bots will not be allowed to scavenge gascans / cola.

itemstoavoid.txt
With this file you can tell the addon to prevent the bots from picking up certain weapons.
For example:
weapon_sniper_awp weapon_sniper_scout weapon_sniper_military weapon_hunting_rifle
prevents the bots from using the sniper rifles.

const.nut
This is a real VScript file. It is automatically loaded by the addon and contains the const values used by the addon's code.
99% of the times you don't need to change anything in this file but, if you really need, you can do it. You can even add vscript code that will be executed upon loading.
Do not touch this file if you aren't sure of what you are doing.
Last edited by smilzo; May 29, 2021 @ 8:52am
< >
Showing 1-15 of 26 comments
smilzo  [developer] Feb 19, 2021 @ 7:41am 
I leave this thread open so if you have a particular customization you want to share with the others you can do it here.
Speedz Jun 20, 2021 @ 8:07am 
sb_friendlyfire 1
sb_max_team_melee_weapons 4
sb_allow_shoot_through_survivors 0
z_tank_health 12000

a little challenge.
smilzo  [developer] Jun 22, 2021 @ 4:25am 
Originally posted by Frosty:
sb_friendlyfire 1
sb_max_team_melee_weapons 4
sb_allow_shoot_through_survivors 0
z_tank_health 12000

a little challenge.
Tank with 12000 HP is a BIG challenge not little lol. But it can be fun.
Thanks
KAWAAAHHH Jun 25, 2021 @ 9:47am 
sb_all_bot_game 1
sb_allow_shoot_through_survivors 0
sb_battlestation_give_up_range_from_human 200
sb_battlestation_human_hold_time 4
sb_close_checkpoint_door_interval 2
sb_close_threat_range 250
sb_combat_saccade_speed 4000

sb_escort 1
sb_far_hearing_range 2000
sb_follow_stress_factor 1
sb_friend_immobilized_reaction_time_expert 4.5
sb_friend_immobilized_reaction_time_hard 4.5
sb_friend_immobilized_reaction_time_normal 4.5
sb_friend_immobilized_reaction_time_vs 4.5
sb_hindrance_range 4000
sb_locomotion_wait_threshold 2
sb_max_battlestation_range_from_human 250
sb_max_scavenge_separation 450
sb_max_team_melee_weapons 3
sb_melee_approach_victim 0
sb_near_hearing_range 1000
sb_neighbor_range 400
sb_normal_saccade_speed 5000
sb_path_lookahead_range 4000
sb_separation_danger_max_range 700
sb_separation_danger_min_range 200
sb_separation_range 500
sb_sidestep_for_horde 1
sb_temp_health_consider_factor 0.8
sb_threat_close_range 250
sb_threat_far_range 600
sb_threat_medium_range 300
sb_threat_very_close_range 250
sb_threat_very_far_range 15000
sb_toughness_buffer 25

just messing things around
smilzo  [developer] Jun 25, 2021 @ 12:13pm 
Thanks guys, keep posting. I will try your configs when i have some time and i will surely make them defaults in the addon if i see valid improvements.
KAWAAAHHH Jun 26, 2021 @ 7:29am 
sb_far_hearing_range 4000
sb_follow_stress_factor 1
sb_friend_immobilized_reaction_time_expert 4
sb_friend_immobilized_reaction_time_hard 4
sb_friend_immobilized_reaction_time_normal 4
sb_friend_immobilized_reaction_time_vs 4
sb_hindrance_range 100
sb_locomotion_wait_threshold 4
sb_max_battlestation_range_from_human 250
sb_max_scavenge_separation 450
sb_max_team_melee_weapons 2
sb_melee_approach_victim 0
sb_near_hearing_range 1000
sb_neighbor_range 200
sb_normal_saccade_speed 5000
sb_path_lookahead_range 4000
sb_separation_danger_max_range 600
sb_separation_danger_min_range 260
sb_separation_range 300
sb_sidestep_for_horde 1
sb_temp_health_consider_factor 0.8
sb_threat_close_range 250
sb_threat_far_range 600
sb_threat_medium_range 500
sb_threat_very_close_range 2000
sb_threat_very_far_range 12000
sb_toughness_buffer 25

messing things around part 2
KAWAAAHHH Jun 26, 2021 @ 10:09pm 
update : removed sb_separation
sans shapiro Jul 26, 2021 @ 7:25am 
The values I like using myself. I left a bunch of values at default since I (mostly) trust Valve to know what the heck these cvars even do more than me.

allow_all_bot_survivor_team 1 sb_all_bot_game 1 //sb_allow_shoot_through_survivors 1 // Hurts the bots' ability to shoot infected off you if this is disabled, and bots don't suffer friendly fire aim-punch from other bots anyway sb_close_threat_range 600 // I assume this controls how far bots stay from boss infected, since the AI Director seems to call Tanks and Witches 'threats', probably makes bots run away from Witches attacking incapacitated survivors ¯\_(ツ)_/¯ //sb_combat_saccade_speed 2000 // Just looks nicer to me animation-wise at vanilla values //sb_escort 0 // Bots tend to shuffle back and forth in front of your line of fire if a bot is straggling, I guess this is the culprit but I never tested it sb_near_hearing_range 1000 // Bill got hearing aids sb_far_hearing_range 2000 sb_friend_immobilized_reaction_time_vs 0.12 // CS:GO bot reaction times sb_friend_immobilized_reaction_time_expert 0.2 sb_friend_immobilized_reaction_time_hard 0.3 sb_friend_immobilized_reaction_time_normal 0.4 //sb_melee_approach_victim 0 // I think some mutations like Chainsaw Massacre rely on this being enabled sb_path_lookahead_range 400 // Uses AI Jockey's path lookahead value, which means this should turn SurvivorBots into Jesus sb_separation_danger_max_range 500 //sb_separation_danger_min_range 160 // Left at vanilla so bots don't try to eat my chainsaw //sb_separation_range 150 // Maybe stops bots from bumping into each other when repositioning if at vanilla? //sb_neighbor_range 200 sb_temp_health_consider_factor 0.8 sb_threat_very_close_range 200 // Boosted to common infected's acquire range sb_threat_close_range 200 sb_threat_medium_range 1000 // Trying to get bots to take more potshots at docile zombies, probably wastes ammo when run-and-gunning sb_threat_far_range 1250 // i like placebo sb_threat_very_far_range 1750 // About when draw-distance fog starts rolling in IIRC sb_toughness_buffer 25 // Scientifically proven to make bots 25% more tough when buffing windshields g_ragdoll_fadespeed 1 // Makes ragdolls stay on-screen slightly longer z_fatal_blast_max_ragdolls 80 // Less gibs getting culled when pipe bombs explode. cl_ragdoll_gravity 675 // No more helium ragdolls
Arkade Oct 29, 2021 @ 1:23pm 
allow_all_bot_survivor_team 1
sb_all_bot_game 1
sb_allow_leading 1
sb_friendlyfire 1
sb_allow_shoot_through_survivors 0
sb_battlestation_give_up_range_from_human 500
sb_battlestation_human_hold_time 1
sb_close_checkpoint_door_interval 0.6
sb_close_threat_range 500
sb_combat_saccade_speed 99999
sb_enforce_proximity_range 99999
sb_escort 0
sb_far_hearing_range 2147483647
sb_follow_stress_factor 1
sb_force_max_intensity "Coach"
sb_force_max_intensity "Ellis"
sb_force_max_intensity "Rochelle"
sb_force_max_intensity "Nick"
sb_force_max_intensity "Bill"
sb_force_max_intensity "Louis"
sb_force_max_intensity "Francis"
sb_force_max_intensity "Zoey"
sb_friend_immobilized_reaction_time_expert 0
sb_friend_immobilized_reaction_time_hard 0
sb_friend_immobilized_reaction_time_normal 0
sb_friend_immobilized_reaction_time_vs 0
sb_debug_apoproach_wait_time 0
sb_min_attention_notice_time 0
sb_min_orphan_time_to_cover 0
sb_reachability_cache_lifetime 0
sb_revive_friend_distance 200
survivor_calm_intensity 0.01
survivor_calm_damage_delay 0.01
survivor_calm_deploy_delay 0.01
survivor_calm_no_flashlight 0.06
survivor_calm_recent_enemy_delay 0.01
survivor_calm_weapon_delay 0.01
sb_transition 0
survivor_vision_range_obscured 100000
survivor_vision_range 99999
nb_saccade_speed 99999
nb_saccade_time 0.01
nb_head_aim_settle_duration 0.01
nb_head_aim_steady_max_rate 2147483647
nb_vision_notice_hidden_range 99999
nb_yaw_rate 99999
nb_avoid 2
nb_avoid_interval 0.01
sb_hindrance_range 15
sb_locomotion_wait_threshold 0
sb_max_battlestation_range_from_human 150
sb_max_scavenge_separation 800
sb_max_team_melee_weapons 4
sb_melee_approach_victim 0
sb_min_attention_notice_time 0
sb_narrow_corridor_width 50
sb_near_hearing_range 99999
sb_neighbor_range 50
sb_normal_saccade_speed 99999
sb_min_orphan_time_to_cover 0.01
sb_path_lookahead_range 99999
sb_pushscale 7000.0
sb_separation_danger_max_range 800
sb_separation_danger_min_range 150
sb_separation_range 50
sb_skill survivor
sb_rescue_veicle_loading_range 1500
sb_sidestep_for_horde 1
sb_temp_health_consider_factor 0.8
sb_threat_exposure_walk 50000
sb_threat_exposure_stop 200000
sb_threat_close_range 150
sb_threat_far_range 5000
sb_threat_medium_range 1000
sb_threat_very_close_range 50
sb_threat_very_far_range 2147483647
sb_toughness_buffer 105
sb_use_button_range 3000
"tongue_miss_delay" 3
"tongue_hit_delay" 15
"tongue_dropping_to_ground_time" 0.5
"tongue_los_forgiveness_time" 1.5
"tongue_no_progress_choke_early_delay" 1.0
"z_pounce_stumble_radius" 160
"z_pounce_damage_interrupt" 150
"z_hunter_limit" 2
"z_smoker_limit" 2
"z_max_stagger_duration" 0.9
"sv_alltalk" 0
"z_ghost_los_expected_progress" 2000
"tongue_choke_damage_amount" 5
"tongue_break_from_damage_amount" 300
"director_special_initial_spawn_delay_min" 2
"director_special_initial_spawn_delay_max" 10
z_hunter_lunge_pitch 145
z_lunge_interval 0.01
hunter_pounce_loft_rate 0.0378
hunter_pounce_max_loft_angle 90
hunter_pounce_ready_range 2000
boomer_exposed_time_tolerance 0
boomer_vomit_delay 0.0
z_female_boomer_spawn_chance 50
smoker_escape_range 615
smoker_tongue_delay 0
z_jockey_ride_hazard_scan_distance 1900
z_jockey_ride_scan_distance 3000
z_jockey_ride_scan_interval 1.50
z_jockey_leap_time 0.0
z_jockey_lookahead 3000
z_jockey_min_ledge_distance 0
z_jockey_leap_range 1500
z_jockey_ride_damage 2
z_jockey_ride_damage_delay 1.0
z_jockey_ride_damage_interval 0.5
jockey_pounce_max_loft_angle 90
jockey_pounce_loft_rate 0.039
z_charge_warmup 0.25
tank_run_spawn_delay 3
tank_stuck_visibility_tolerance_choose_new_target 1
tank_stuck_time_choose_new_target 0.1
tank_stuck_visibility_tolerance_suicide 60
tank_stasis_time_suicide 90
tank_throw_aim_error 25
tank_throw_loft_rate 0.016
tank_throw_max_loft_angle 90
z_tank_attack_interval 0.0625
tank_throw_allow_range 675
tank_throw_lead_time_factor 0.1132
tank_visibility_tolerance_suicide 150
nb_path_segment_influence_radius 2147483647
nb_path_draw_inc 2147483647
//sb_unstick 0
sb_vomit_blind_time 0

I was testing this and I made them aimbotters now **Decided to change the infected too**
smilzo  [developer] Oct 30, 2021 @ 1:12am 
Originally posted by oTraace iOS:
...
I like the fact that you also tweaked the infected. Thank you, i will surely try this.
It's not a new command, but a new question: is there any way for bots to help players get fuel and other mission props? Every time I play with bots, they will only follow me.
smilzo  [developer] Mar 17, 2022 @ 5:06am 
Originally posted by 純白可憐:
It's not a new command, but a new question: is there any way for bots to help players get fuel and other mission props? Every time I play with bots, they will only follow me.
Just use the "Lead on" vocalizer command (or "bots lead" chat command) to order them to start scavenging gascans.
K Jul 29, 2022 @ 1:14am 
Originally posted by Arkade:
allow_all_bot_survivor_team 1
sb_all_bot_game 1
sb_allow_leading 1
sb_friendlyfire 1
sb_allow_shoot_through_survivors 0
sb_battlestation_give_up_range_from_human 500
sb_battlestation_human_hold_time 1
sb_close_checkpoint_door_interval 0.6
sb_close_threat_range 500
sb_combat_saccade_speed 99999
sb_enforce_proximity_range 99999
sb_escort 0
sb_far_hearing_range 2147483647
sb_follow_stress_factor 1
sb_force_max_intensity "Coach"
sb_force_max_intensity "Ellis"
sb_force_max_intensity "Rochelle"
sb_force_max_intensity "Nick"
sb_force_max_intensity "Bill"
sb_force_max_intensity "Louis"
sb_force_max_intensity "Francis"
sb_force_max_intensity "Zoey"
sb_friend_immobilized_reaction_time_expert 0
sb_friend_immobilized_reaction_time_hard 0
sb_friend_immobilized_reaction_time_normal 0
sb_friend_immobilized_reaction_time_vs 0
sb_debug_apoproach_wait_time 0
sb_min_attention_notice_time 0
sb_min_orphan_time_to_cover 0
sb_reachability_cache_lifetime 0
sb_revive_friend_distance 200
survivor_calm_intensity 0.01
survivor_calm_damage_delay 0.01
survivor_calm_deploy_delay 0.01
survivor_calm_no_flashlight 0.06
survivor_calm_recent_enemy_delay 0.01
survivor_calm_weapon_delay 0.01
sb_transition 0
survivor_vision_range_obscured 100000
survivor_vision_range 99999
nb_saccade_speed 99999
nb_saccade_time 0.01
nb_head_aim_settle_duration 0.01
nb_head_aim_steady_max_rate 2147483647
nb_vision_notice_hidden_range 99999
nb_yaw_rate 99999
nb_avoid 2
nb_avoid_interval 0.01
sb_hindrance_range 15
sb_locomotion_wait_threshold 0
sb_max_battlestation_range_from_human 150
sb_max_scavenge_separation 800
sb_max_team_melee_weapons 4
sb_melee_approach_victim 0
sb_min_attention_notice_time 0
sb_narrow_corridor_width 50
sb_near_hearing_range 99999
sb_neighbor_range 50
sb_normal_saccade_speed 99999
sb_min_orphan_time_to_cover 0.01
sb_path_lookahead_range 99999
sb_pushscale 7000.0
sb_separation_danger_max_range 800
sb_separation_danger_min_range 150
sb_separation_range 50
sb_skill survivor
sb_rescue_veicle_loading_range 1500
sb_sidestep_for_horde 1
sb_temp_health_consider_factor 0.8
sb_threat_exposure_walk 50000
sb_threat_exposure_stop 200000
sb_threat_close_range 150
sb_threat_far_range 5000
sb_threat_medium_range 1000
sb_threat_very_close_range 50
sb_threat_very_far_range 2147483647
sb_toughness_buffer 105
sb_use_button_range 3000
"tongue_miss_delay" 3
"tongue_hit_delay" 15
"tongue_dropping_to_ground_time" 0.5
"tongue_los_forgiveness_time" 1.5
"tongue_no_progress_choke_early_delay" 1.0
"z_pounce_stumble_radius" 160
"z_pounce_damage_interrupt" 150
"z_hunter_limit" 2
"z_smoker_limit" 2
"z_max_stagger_duration" 0.9
"sv_alltalk" 0
"z_ghost_los_expected_progress" 2000
"tongue_choke_damage_amount" 5
"tongue_break_from_damage_amount" 300
"director_special_initial_spawn_delay_min" 2
"director_special_initial_spawn_delay_max" 10
z_hunter_lunge_pitch 145
z_lunge_interval 0.01
hunter_pounce_loft_rate 0.0378
hunter_pounce_max_loft_angle 90
hunter_pounce_ready_range 2000
boomer_exposed_time_tolerance 0
boomer_vomit_delay 0.0
z_female_boomer_spawn_chance 50
smoker_escape_range 615
smoker_tongue_delay 0
z_jockey_ride_hazard_scan_distance 1900
z_jockey_ride_scan_distance 3000
z_jockey_ride_scan_interval 1.50
z_jockey_leap_time 0.0
z_jockey_lookahead 3000
z_jockey_min_ledge_distance 0
z_jockey_leap_range 1500
z_jockey_ride_damage 2
z_jockey_ride_damage_delay 1.0
z_jockey_ride_damage_interval 0.5
jockey_pounce_max_loft_angle 90
jockey_pounce_loft_rate 0.039
z_charge_warmup 0.25
tank_run_spawn_delay 3
tank_stuck_visibility_tolerance_choose_new_target 1
tank_stuck_time_choose_new_target 0.1
tank_stuck_visibility_tolerance_suicide 60
tank_stasis_time_suicide 90
tank_throw_aim_error 25
tank_throw_loft_rate 0.016
tank_throw_max_loft_angle 90
z_tank_attack_interval 0.0625
tank_throw_allow_range 675
tank_throw_lead_time_factor 0.1132
tank_visibility_tolerance_suicide 150
nb_path_segment_influence_radius 2147483647
nb_path_draw_inc 2147483647
//sb_unstick 0
sb_vomit_blind_time 0

I was testing this and I made them aimbotters now **Decided to change the infected too**
Sorry if this is like a necro or anything, but this right here is the best one for me! The bots feel like playing with humans now, and so do the infected. Man this is great, thanks for posting this!
Punicher_Elepe Aug 1, 2022 @ 6:08pm 
thanks
♡Starlight♡ Dec 30, 2022 @ 8:11am 
Does anyone know how to make it so that the bots automatically start healing themselves (preferably with pills) when under 40 hp? And maybe make it so that upon equipping a defibrillator, their first priority is reviving my dead ass?
Last edited by ♡Starlight♡; Dec 30, 2022 @ 8:12am
< >
Showing 1-15 of 26 comments
Per page: 1530 50