View Single Post
Author Message
DeathChaos25
Senior Member
Join Date: Jan 2014
Location: Puerto Rico
Old 06-12-2015 , 22:16   [L4D2] Bots Weapon Preferences Editor (UPDATED 09-11-2017)
Reply With Quote #1

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.

Here is a video showing the new swap commands!

Code:
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


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!
Attached Files
File Type: smx [L4D2] Bots Weapon Preference Manipulation.smx (34.5 KB, 2174 views)
File Type: sp Get Plugin or Get Source ([L4D2] Bots Weapon Preference Manipulation.sp - 4329 views - 99.3 KB)
__________________

Last edited by DeathChaos25; 09-11-2017 at 08:52.
DeathChaos25 is offline