About : This plugin allows some level of manipulation over which primary weapons we want to allow the survivor bots to use.
How it works :
Via a cfg file, we use cvars to allow or disallow bots from picking up certain primary weapons, and what kind of restriction to apply.
The weapon restrictions are all categorized and divided on a per survivor bot basis, for example, you can manipulate and change what survivor bot Coach can use, and make it different, or the same as, what survivor bot Nick will use.
Version 1.0 04-15-2015 (15 views)
- Initial Release
Version 1.1 06-14-2015 (142 views)
- Fixed an oversight causing memory leaks
Version 1.2 (61 views)
- Very minor code changes
- Fixed a bug where in very rare cases a memory leak happened if a map ran long enough
- Better compatibility with Single Player or Listen Servers
Version 1.3 09-10-2015
- Fixed an oversight where bots would try to grab the map entity, and as a result would stand around in one place trying to grab nothing for an indefinite amount of time
- Fixed Memory Leak and merged sub plugin into main plug
- 2 New Features!
- sm_swapprimary allows you to swap your primary with whatever bot you're aiming at
- sm_swapsecondary, same as above but with secondary (such as melees or pistols)
Version 1.4 07-25-2016 (575 views)
- Cleaned up the interaction between pistols/melee/magnums, should be much cleaner now instead of having the bots endlessly swap between the three when wanting to use a melee.
- Drastically lowered the distance at which the bots will scan and move to pick up a weapon, this means bots should no longer be running off and making a mad dash to grab weapons (like Dead Center 1)
Version 1.5 09-11-2017
- Cleaned up interactions between allowed Tier 1 Weapons and allowed Tier 2 weapons,
this should completely stomp out any of those edge cases where a bot could upgrade
from T1 to T2 but would not do so until running low on ammo.
To DO :
Code:
- Nothing as of now (NOTE : MELEE WEAPONS ARE NOT PLANNED TO BE IMPLEMENTED AND WILL NEVER BE)
When the plugin is first used, a cfg file will be created called l4d2_bots_weapon_preferences_manipulation
CVARS from the CFG FILE
Spoiler
Code:
// ConVars for plugin "[L4D2] Bots Weapon Preference Manipulation.smx"
// Can Bill use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bill_enable_assault_rifles "1"
// Can Bill use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bill_enable_magnums "1"
// Can Bill use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bill_enable_pistols "1"
// Can Bill use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bill_enable_smgs "1"
// Can Bill use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bill_enable_snipers "1"
// Can Bill use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bill_enable_t1_shotguns "1"
// Can Bill use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
bill_enable_t2_shotguns "1"
// Can Coach use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
coach_enable_assault_rifles "1"
// Can Coach use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
coach_enable_magnums "1"
// Can Coach use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
coach_enable_pistols "1"
// Can Coach use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
coach_enable_smgs "1"
// Can Coach use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
coach_enable_snipers "1"
// Can Coach use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
coach_enable_t1_shotguns "1"
// Can Coach use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
coach_enable_t2_shotguns "1"
// Can Ellis use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
ellis_enable_assault_rifles "1"
// Can Ellis use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
ellis_enable_magnums "1"
// Can Ellis use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
ellis_enable_pistols "1"
// Can Ellis use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
ellis_enable_smgs "1"
// Can Ellis use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
ellis_enable_snipers "1"
// Can Ellis use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
ellis_enable_t1_shotguns "1"
// Can Ellis use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
ellis_enable_t2_shotguns "1"
// Can Francis use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
francis_enable_assault_rifles "1"
// Can Francis use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
francis_enable_magnums "1"
// Can Francis use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
francis_enable_pistols "1"
// Can Francis use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
francis_enable_smgs "1"
// Can Francis use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
francis_enable_snipers "1"
// Can Francis use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
francis_enable_t1_shotguns "1"
// Can Francis use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
francis_enable_t2_shotguns "1"
// Can Louis use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
louis_enable_assault_rifles "1"
// Can Louis use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
louis_enable_magnums "1"
// Can Louis use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
louis_enable_pistols "1"
// Can Louis use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
louis_enable_smgs "1"
// Can Louis use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
louis_enable_snipers "1"
// Can Louis use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
louis_enable_t1_shotguns "1"
// Can Louis use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
louis_enable_t2_shotguns "1"
// Can Nick use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
nick_enable_assault_rifles "1"
// Can Nick use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
nick_enable_magnums "1"
// Can Nick use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
nick_enable_pistols "1"
// Can Nick use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
nick_enable_smgs "1"
// Can Nick use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
nick_enable_snipers "1"
// Can Nick use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
nick_enable_t1_shotguns "1"
// Can Nick use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
nick_enable_t2_shotguns "1"
// What kind of restrictions will be applied to disabled weapons? (0 = Bots may pick up disabled weapons when it is their only choice, 1 = Bots will NEVER pick up restricted weapons)
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
restriction_type "0"
// Can Rochelle use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
rochelle_enable_assault_rifles "1"
// Can Rochelle use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
rochelle_enable_magnums "1"
// Can Rochelle use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
rochelle_enable_pistols "1"
// Can Rochelle use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
rochelle_enable_smgs "1"
// Can Rochelle use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
rochelle_enable_snipers "1"
// Can Rochelle use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
rochelle_enable_t1_shotguns "1"
// Can Rochelle use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
rochelle_enable_t2_shotguns "1"
// [L4D2] Bots Weapon preferences manipulation Version
// -
// Default: "1.0"
sm_bots_weapon_preferences_manipulation_version "1.0"
// Can Zoey use assault rifles? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zoey_enable_assault_rifles "1"
// Can Zoey use magnums? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zoey_enable_magnums "1"
// Can Zoey use pistols? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zoey_enable_pistols "1"
// Can Zoey use smgs? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zoey_enable_smgs "1"
// Can Zoey use snipers? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zoey_enable_snipers "1"
// Can Zoey use t1 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zoey_enable_t1_shotguns "1"
// Can Zoey use t2 shotguns? (0 = No, 1 = Yes)
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zoey_enable_t2_shotguns "1"
About the "restriction_type" cvar, it works like this:
if the cvar is set to 0, bots will pick up disabled weapons, but only if they have no other choice, if set to 1, they will NEVER pick up disabled weapons at all.
This means if the CVAR is set to 1, and the bot has no primary, but they only found disabled weapons, they will not pick anything up because they are disabled, and as such they will be stuck with only their pistol/melee in this case, so choose your restrictions carefully.
ABOUT PISTOLS/MAGNUMS:
This plugin forces all bots to default to magnums over pistols, if this is unwanted, just disable magnum usage for whatever bots you don't want using magnums.
THIS PLUGIN ABSOLUTELY REQUIRES Left4Downtown2 TO FUNCTION!
(Huge thanks to Sev for extensively testing this with me!)
Huge Thanks to Spummer for getting Linux signatures!
Everyone, I ask of you, bare with me and please have patience as bugs/errors start to pop up.
Sev and I have extensively and massively tested this plugin over the course of the last few months, and as a result the plugin evolved and changed a lot.
While this plugin has been released, and should be bug free, it is a very big and complicated plugin (almost as much as FakeZoey!), and as such it is impossible for only 2 people to cover every single possible scenario that may or may not cause a bug.
So please, as bugs are reported, all I ask is patience!
L 06/14/2015 - 18:28:05: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "[L4D2] Bots Weapon Preference Manipulation.smx")
L 06/14/2015 - 18:28:05: [SM] Unloading plugin to free 31474 handles.
L 06/14/2015 - 18:28:05: [SM] Contact the author(s) of this plugin to correct this error.
L 06/14/2015 - 18:28:05: --------------------------------------------------------------------------
L 06/14/2015 - 18:28:05: Type Timer | Count 1
L 06/14/2015 - 18:28:05: Type CellArray | Count 31473
L 06/14/2015 - 18:28:05: -- Approximately 505040 bytes of memory are in use by (31474) Handles.
No, Downtown is the only reason this even works in the first place.
Quote:
Originally Posted by alekcei82
add cvar for all bots.
What? I don't understand your post. The plugin is already divided in a per bot basis, all bots have their own cvars.
Quote:
Originally Posted by legotoytoy
L 06/14/2015 - 18:28:05: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "[L4D2] Bots Weapon Preference Manipulation.smx")
L 06/14/2015 - 18:28:05: [SM] Unloading plugin to free 31474 handles.
L 06/14/2015 - 18:28:05: [SM] Contact the author(s) of this plugin to correct this error.
L 06/14/2015 - 18:28:05: --------------------------------------------------------------------------
L 06/14/2015 - 18:28:05: Type Timer | Count 1
L 06/14/2015 - 18:28:05: Type CellArray | Count 31473
L 06/14/2015 - 18:28:05: -- Approximately 505040 bytes of memory are in use by (31474) Handles.
Whoops! Updated the main post and plugin to correct this.
ALL bot is set to 0 " bill_enable_t1_shotguns "0" "
but in c2mX Often use shotgun
If restriction_type is also 0 this means that no other weapon was found so they used Shotguns or they would not have any weapons, you can set restriction_type to 1, but then they will never pick up weapons even if they find nothing else.