AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021] (https://forums.alliedmods.net/showthread.php?t=334245)

DingbatFlat 09-09-2021 08:22

[L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
2 Attachment(s)
I made this plugin because I wanted to improve the stupid survivor bots as much as possible.
Mainly improves mouse operation of clients. Please note that this plugin does not completely improve the bots.
And, This is the limit of my power and I can't add any further improvement points maybe...



About:

- Main items that can be improve bots by introducing this plugin.
  • Help a pinning Survivor.
  • Attack a Common Infected.
  • Attack a Special Infected.
  • Attack a Tank.
  • Bash a flying Hunter and Jockey.
  • Shoot a tank rock.
  • Shoot a Witch (Contronls the attack timing when have a shotgun).
  • Restrict switching to the sub weapon.
  • And the action during incapacitated.

- Sourcemod ver 1.10 is required.
- Recommended for combined use with other infinite ammo plugins.



How to use:
  • Make sure "sb_fix_enabled" in the CVars is 1.

- Select the improved bot with the following CVars.
  • If "sb_fix_select_type" is 0, it is always all enabled.
  • If "sb_fix_select_type" is 1, the number of people set in "sb_fix_select_number" will be randomly select.
  • If "sb_fix_select_type" is 2, select the bot of the character entered in "sb_fix_select_character_name".

- For 1 and 2, bots that improve after left the safe room are selected.



CVars:

PHP Code:

// sb_fix
// ver. 1.00

// Notes:
// If "~_enabled" of the group is not set to 1, other Cvars in that group will not work.
// If the plugin is too heavy, Try disable searching for "Entities" other than Client. (CI, Witch and tank rock)

// ---------------------------------

// Enable the plugin.
// <0: Disable, 1: Enable>
sb_fix_enabled 1

// ---------------------------------

// Which survivor bots to improved.
// <0: All, 1: Randomly select X people when left the safe area, 2: Enter the character name of the survivor bot to improve with "sb_fix_select_character_name">
sb_fix_select_type 0

// If "sb_fix_select_type" is 1, Enter the number of survivor bots.
// <0 - 4>
sb_fix_select_number 1

// If "sb_fix_select_type" is 4, Enter the character name to improved. Separate with spaces.
// Example: "nick francis bill" ("coach ellis rochelle nick louis francis zoey bill")
sb_fix_select_character_name ""

// ---------------------------------

// Disallow switching to the secondary weapon until the primary weapon is out of ammo.
// <0:No, 1:Yes | def: 1>
sb_fix_dont_switch_secondary 1

// ---------------------------------

// Help a pinning survivor.
// <0: Disable, 1: Enable | def: 1>
sb_fix_help_enabled 1

// Range to shoot/search a pinning survivor.
// <1 - 3000 | def: 1200>
sb_fix_help_range 1200

// Whether to help by shove.
// <0: Not help by shove, 1: Smoker only, 2: Smoker and Jockey, 3: Smoker, Jockey and Hunter | def: 2>
sb_fix_help_shove_type 2

// If "sb_fix_help_shove_type" is 2 or more, it is shove only while reloading.
// <0: No, 1: Yes | def: 0>
sb_fix_help_shove_reloading 0

// ---------------------------------

// Deal with Common Infecteds.
// <0: Disable, 1: Enable | def: 1>
sb_fix_ci_enabled 1

// Range to shoot/search a Common Infected.
// <1 - 2000 | def: 500>
sb_fix_ci_range 500

// Allow to deal with the melee weapon.
// <0: Disable 1: Enable | def: 1>
sb_fix_ci_melee_allow 1

// If "sb_fix_ci_melee_allow" is enabled, range to deal with the melee weapon.
// <1 - 500 | def: 160>
sb_fix_ci_melee_range 160

// ---------------------------------

// Deal with Special Infecteds.
// <0: Disable, 1: Enable | def: 1>
sb_fix_si_enabled 1

// Range to shoot/search a Special Infected.
// <1 - 3000 | def: 500>
sb_fix_si_range 500

// Ignore a Boomer near Survivors (and shove a Boomer).
// <0: No, 1: Yes | def: 1>
sb_fix_si_ignore_boomer 1

// Range to ignore a Boomer.
// <1 - 900 | def: 200>
sb_fix_si_ignore_boomer_range 200

// ---------------------------------

// Deal with Tanks.
// <0: Disable, 1: Enable | def: 1>
sb_fix_tank_enabled 1

// Range to shoot/search a Tank.
// <1 - 3000 | def: 1200>
sb_fix_tank_range 1200

// ---------------------------------

// When a Special Infected and a Tank is together within the specified range, which to prioritize.
// <0: Nearest, 1: Special Infected, 2: Tank | def: 0>
sb_fix_si_tank_priority_type 0

// ---------------------------------

// Bash a flying Hunter or Jockey.
// <0: Disable, 1: Enable | def: 1>
sb_fix_bash_enabled 1

// Chance of bash a flying Hunter. (Even 100 doesn't can perfectly shove).
// <1 - 100 | def: 100>
sb_fix_bash_hunter_chance 100

// Range to bash/search a flying Hunter.
// <1 - 500 | def: 145>
sb_fix_bash_hunter_range 145

// Chance of bash a flying Jockey. (Even 100 doesn't can perfectly shove).
// <1 - 100 | def: 100>
sb_fix_bash_jockey_chance 100

// Range to bash/search a flying Jockey.
// <1 - 500 | def: 125>
sb_fix_bash_jockey_range 125

// ---------------------------------

// Shoot a tank rock.
// <0: Disable, 1: Enable | def: 1>
sb_fix_rock_enabled 1

// Range to shoot/search a tank rock.
// <1 - 2000 | def: 700>
sb_fix_rock_range 700

// ---------------------------------

// Shoot a rage Witch.
// <0: Disable, 1: Enable | def: 1>
sb_fix_witch_enabled 1

// Range to shoot/search a rage Witch.
// <1 - 2000 | def: 1500>
sb_fix_witch_range 1500

// Range to shoot/search a Witch that incapacitated a survivor.
// <0 - 2000 | def: 1000>
sb_fix_witch_range_incapacitated 1000

// Range to shoot/search a Witch that killed a survivor.
// <0 - 2000 | def: 0>
sb_fix_witch_range_killed 0

// [Witch] If have the shotgun, controls the attack timing.
// <0: Disable, 1: Enable | def: 1>
sb_fix_witch_shotgun_control 1

// If a Witch is within distance of the values, stop the attack.
// <1 - 1000 | def: 300>
sb_fix_witch_shotgun_range_max 300

// If a Witch is at distance of the values or more, stop the attack.
// <1 - 500 | def: 70>
sb_fix_witch_shotgun_range_min 70

// ---------------------------------

// Priority given to dealt a Smoker that is try to pinning self.
// <0: No, 1: Yes | def: 1>
sb_fix_prioritize_ownersmoker 1

// ---------------------------------

// Enable Incapacitated Cmd.
// <0: Disable, 1: Enable | def: 1>
sb_fix_incapacitated_enabled 1 



Change Log:

Code:

1.00 (09-September-2021)
    - Initial release.



Installation:
  1. Click "Get Plugin" and put l4d2_sb_fix.smx file into your servers \addons\sourcemod\plugins\ folder.
  2. Optionally put l4d2_sb_fix.cfg file into your servers \cfg\sourcemod\ folder.

TBK Duy 09-09-2021 08:33

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
Wow cool, i've been waiting for some improved bots plugin for too long, and now this appear, i really appreciate it.

Silvers 09-09-2021 08:54

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
Nice!

There's also a list of cvars that can be changed to make bots respond faster in various situations. I don't have the list here but can probably be found easily on google.



Some notes on code:
- "PrefetchSound" - don't see the point of this when you have "PrecacheSound".
- "PrecacheSound" - should be moved to OnMapStart().

- "OnEntityCreated" - Don't use "StrContains" this is very inefficient especially in this function that's triggered so often. Use: if (g_hEnabled && strcmp(classname, "witch") == 0)
- You'll probably want to add the g_hEnabled check to make it more efficient when the plugins disabled.

- "OnEntityDestroyed" - I personally prefer to do "static char classname[32];" instead of creating the string every time to avoid creating a null string each time. This kind of optimization is noticeable on servers near the bottleneck of their CPU with lots of plugins, and best when those plugins are also optimized as such.

- "SetCommandFlags(command, flags^FCVAR_CHEAT);" is wrong, you're flipping the bit, some servers might have removed the cheat flag and you've just added it back. Do "SetCommandFlags(command, flags & ~FCVAR_CHEAT);"

- Instead of "SetCommandFlags(command, flags | FCVAR_CHEAT);" just do "SetCommandFlags(command, flags)" because some servers might have stripped the cheat flag which you've just added back when it didn't exist.

- "if (staggerPos[0] != 0.0 && staggerPos[1] != 0.0 && staggerPos[2] != 0.0) return true;" - seems wrong, maybe sometimes a player can stagger and one of the variables is exactly 0.0, however rare that maybe. I would put || instead of && for the checks.

- Things like "new String:sub_weapon[128];" is inefficient, again you could use "static" instead of "new" to stop creating them over and over in expensive functions like the one being used, and also 128 is overkill when the longest string is 12 characters or something, the longest weapon classname is 29, so put [32] instead.

- Same as "decl String:sWeaponName[256];" and probably other strings.

- You have lots of these types of checks:
PHP Code:

        GetEntityClassname(weaponclassnamesizeof(classname));
        if (
StrContains(classname"weapon_melee"false) > -

Since you're pulling the weapon name from the players equipped weapon you can skip "weapon_" and match the last part, such as: strcmp(classname[7], "melee") == 0. Again, don't use StrContains for this, inefficient and poor coding.

PHP Code:

// You can replace all the:
new weapon GetEntDataEnt2(clientg_ActiveWeapon);

// Stuff with
int weapon GetEntPropEnt(clientProp_Send"m_hActiveWeapon"); 

- Your "Timer_ShoveChance" function never checks if the plugins enabled cvar is on. Suggest killing the timer if the plugins disabled, and enable when it's enabled so it doesn't run forever.

- You have many things like "Format(bufferChat, 512", instead of hard coding 512, do "sizeof(bufferChat)" instead. The compiler then changes that to 512, so if someone wants to modify the string size they only need to change 512 once.

- In "AskPluginLoad2" you may want to restrict the plugin to L4D2 like my plugins do for example.

- You can change the whole "PrimaryExtraAmmoCheck" function with what I use in the "Switch Upgrade Ammo Types" plugin - the "GetOrSetPlayerAmmo" function. It's not necessary to check all the weapon strings and hard code the offsets.

- Lastly, using old syntax :twisted: why are you writing that?



These are just some of the things I checked while skimming through, not everything.

ddd123 09-09-2021 09:36

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
Cool plugin!
Just a request but can i also have option to turn off/hide the text/hint when the game start?
And also stop bots standing on flame/fires and suicide (This mostly happen on molotov and explosion car)

Update: I test it with single player but when i play the game, i can feel the fps dropped or something.
Can someone confirm if this is only happened to me?

Sev 09-09-2021 09:49

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
There is a good workshop addon that improves the bots and gets updated often, but its really command heavy and I find that takes away from it being the best it can be. Sure you can deal with binds and whatnot, but its just more hassle than its worth in game JMO.

https://steamcommunity.com/sharedfil...earchtext=bots

There was also another plugin from a few years back that just basically made the bots over the top, but I don't think its as functional in recent years with all the updates and whatnot.

https://forums.alliedmods.net/showthread.php?p=2609058

JLmelenchon 09-09-2021 23:43

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
Anyone tested ?

KRUTIK 09-10-2021 03:59

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
Prompt, this line should be AutoExecConfig (false, "l4d2_sb_fix"); I mean false or should it be true?

sonic155 09-10-2021 17:28

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
Tested and works great that being said i have few things to say on this

1. needs a way to make it where the promp for saying "what type of bots are being enabled at the start of each round to be removed by cvar if able"
2. this plugin seems to fight with https://forums.alliedmods.net/showthread.php?p=2685812 from { Silvers } as one part makes the AI/Bots to aim at {Tank Rock} to shoot at it and the {Anomaly} has the model of a {Tank Rock} so the AI/Bots are endlessly attacking at it in fact they dont attack anything else besides the {Anomaly} nor do they leave until the {Anomaly} gets out of range
3. the % for {Stunblocking} hunters / Jockeys doesnt seem to matter what % you put it at as it seems 100% of the time they block it unless something else is in the way such as a common hitting them and the AI/Bot is set on the common so timing it for the Hunter/jockey seems the onlyw ay they can pin the AI/Bots now though the % doesnt mean anything as far as ive seen

other then those 3 i think the plugin is great even if it looks odd when AI/Bots are being overwelmed by commons i dont think its normal for the head to move in that way let alone the body e.e lol but its good

upside to this the AI/Bots take stances which is nice like 2 would go infront and use melee while the rest stay in the back with guns and ive seen few times AI/Bots would duck near doorways nice touch but not used offen which is fine though they also coner themselfs to fight off common/mobs and they stop reviving other survivors if a threat [common/SI] come in range which i greatly like however they still dont care for the spitter's spit and will stand in it picking up another survivor which offen lead to both becoming incapped

great plugin so far as seeing this is {v1.00} i look forword to what next updates would be =p

PS. cake

Sev 09-11-2021 14:42

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
L 09/11/2021 - 13:04:42: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/11/2021 - 13:04:42: [SM] Blaming: l4d2_sb_fix.smx
L 09/11/2021 - 13:04:42: [SM] Call stack trace:
L 09/11/2021 - 13:04:42: [SM] [0] GetEntPropString
L 09/11/2021 - 13:04:42: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/11/2021 - 13:04:42: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/11/2021 - 13:55:56: Error log file session closed.

sonic155 09-15-2021 18:38

Re: [L4D2] Survivor Bot Fix / Improved (sb_fix) (v1.00) [09-Sep-2021]
 
Quote:

L 09/15/2021 - 00:27:44: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:44: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:44: [SM] Call stack trace:
L 09/15/2021 - 00:27:44: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:44: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:44: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:45: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:45: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:45: [SM] Call stack trace:
L 09/15/2021 - 00:27:45: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:45: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:45: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:45: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:45: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:45: [SM] Call stack trace:
L 09/15/2021 - 00:27:45: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:45: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:45: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:47: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:47: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:47: [SM] Call stack trace:
L 09/15/2021 - 00:27:47: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:47: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:47: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:47: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:47: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:47: [SM] Call stack trace:
L 09/15/2021 - 00:27:47: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:47: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:47: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:48: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:48: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:48: [SM] Call stack trace:
L 09/15/2021 - 00:27:48: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:48: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:48: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:49: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:49: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:49: [SM] Call stack trace:
L 09/15/2021 - 00:27:49: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:49: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:49: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:52: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:52: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:52: [SM] Call stack trace:
L 09/15/2021 - 00:27:52: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:52: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:52: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:54: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:54: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:54: [SM] Call stack trace:
L 09/15/2021 - 00:27:54: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:54: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:54: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:54: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:54: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:54: [SM] Call stack trace:
L 09/15/2021 - 00:27:54: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:54: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:54: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed
L 09/15/2021 - 00:27:56: [SM] Exception reported: Entity -1 (-1) is invalid
L 09/15/2021 - 00:27:56: [SM] Blaming: l4d2_sb_fix.smx
L 09/15/2021 - 00:27:56: [SM] Call stack trace:
L 09/15/2021 - 00:27:56: [SM] [0] GetEntPropString
L 09/15/2021 - 00:27:56: [SM] [1] Line 766, /groups/sourcemod/compiler-1.10/include/entity.inc::GetEntityClassname
L 09/15/2021 - 00:27:56: [SM] [2] Line 1938, /home/forums/content/files/3/1/4/9/1/4/191277.attach::OnEntityDestroyed


All times are GMT -4. The time now is 08:28.

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