View Single Post
Author Message
olj
Veteran Member
Join Date: Jun 2009
Old 07-16-2009 , 15:07   [L4D] Simple Mob Controller (1.4)
Reply With Quote #1

This is my first plugin so dont be too hard on it. It controls "z_mob and z_mega_mob cvars based o the number of survivors in game. Its using player_team l4d event. Basically - it hooks when someone (bot or player) changes team and changes convar which controls how much common zombies should be added to above mentioned cvars. I added a feature to control tank hp in same way too.

Config

It will create cfg file named l4d_mob_control.cfg in your left4dead\cfg\sourcemod folder.

CVARS

// Set to 1 if you want plugin to process bots too.
// -
// Default: "1"
l4d_mobcontrol_includebots "1"

// Version of L4D Mob Control on this server
// -
// Default: "1.4"
l4d_mobcontrol_version "1.4"

// Sets how much zombies to add per survivor
// -
// Default: "8"
l4d_mobcontrol_zombiestoadd "8"

// Enables or disables plugin
// -
// Default: "1"
l4d_mobcontrol_enabled "1"

// Disables or enables tank bonus hp feature
// -
// Default: "1"
l4d_mobcontrol_tank_bonushealth_enabled "1"

// Sets how much HP to add per survivor
// -
// Default: "666"
l4d_mobcontrol_tank_bonushealth "666"



Notes on mechanic
Uses default values (or whatever you stated in your configs) of mob cvars as a base. If you have 60 mega mob size, it will add or substract extrazombies to that value each time a new survivor connects, changes team, or disconnects.

If you disable plugin via cvar, all changed cvars' values wont revert to back.

When setting tank bonus health per survivor value, remember that in versus mode final value will be modifed by versus_tank_bonus_health cvar (default is 1.5, so if tank has 5000 base hp + 3996 hp for 6 survivors it will be 8996*1.5 = 13494 hp in versus mode). THIS MODIFIER WILL BE APPLIED WHEN TANK ACTUALLY SPAWNS,

Credits
Thanks to everyone on this alliedmods.net forum and for guides on sourcemod scripting.
AtomicStryker For his sample of code he provided me with. It gave me a good start, followed by browsing of sourcemod documentation.

Things to do

:-)

Feel free to comment

Changelog
16.07.2009 / 1.0 Initial release
17.07.2009/ Removed debug messages from code, cleaned from unnecessary comented lines
17.07.2009/ 1.1 Removed more debug, fixed not changing z_mob when checking not bots changin teams
20.07.2009/ 1.2 Rewrote the code, tried to add different modes, but failed, because events and functions related to map change works really retarded, dont know why though.
27.07.2009/ 1.3 Added enable/disable cvar, added tank bonus hp (based on number of survivors) feature, fixed minor mistake in plugin version part.
27.07.2009/ Fixed mistake, which caused tank health to increase only.
27.07.2009/ 1.4 version, FIXED ENABLED CVAR, works good now
Attached Files
File Type: sp Get Plugin or Get Source (MobControl 1.3.sp - 4617 views - 5.4 KB)

Last edited by olj; 08-05-2009 at 09:16.
olj is offline