Raised This Month: $226 Target: $400
 56% 

[L4D2] ZSpawn: Zombie Spawn manager (v1.2.1)[09-May-2021]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Earendil
Junior Member
Join Date: Jan 2020
Location: Spain
Plugin ID:
7627
Plugin Version:
1.2.1
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
Servers with this Plugin:
6 
Plugin Description:
Zombie Spawn manager with admin command, autospawn and director control
Old 05-02-2021 , 20:17   [L4D2] ZSpawn: Zombie Spawn manager (v1.2.1)[09-May-2021]
Reply With Quote #1

ZSpawn

v1.2.1

This plugin finally supports L4D & L4D2
Another zombie spawn plugin? Yes but this is a little different.

After taking a look at Left 4 DHooks and all the posibilites it gave I decided to use them and make a plugin which allows server admins to have a big control over zombie spawn. After some testing I found a way to spawn special infected which does not affects human players in versus, ghost players stay ghost, dead players stay dead, there is no need to make fixes which sometimes ends in bugs. It only spawn bots. Also you can spawn up to 28 copies of the same special infected breaking the limit that game usually forces on infected, like this:



This plugin does not kill infected and does not affect human players in infected team, only controls bot spawning.

The 3 main features this plugins provides are:
1. Modify Director spawn parameters
- Director can be blocked to spawn of tanks and witches.
- The size of mobs generated randomly or after someone has been set in vomit can be modified or even blocked.
- You can block some special infected classes while allowing others to spawn. If a zombie class is restricted, the plugin will automatically change it to an allowed zombie class to keep the amount of specials constant.
- To avoid crashing gameplay, this plugin will not block mobs or tanks on map finales.
- WARNING: Blocking Director spawn will block also any zombie created by other plugins, make sure you dont restrict zombies which can be generated by other plugins!

2. Admin commands
- Admins can use 3 commands to spawn any special infected or call a mob (requires admin kick):
PHP Code:
sm_zspawn <zombieclass> <amount// Spawn an infected at your cursor position. Valid zombietypes: hunter, smoker, boomer, charger, jockey, spitter, tank, witch. Amount: 1-16 zombies, if amount is not assigned will spawn 1 zombie.
sm_zauto <zombieclass// Spawn an infected in an automatic position. Valid zombietypes: hunter, smoker, boomer, charger, jockey, spitter, tank, witch. Amount: 1-16 zombies, if amount is not assigned will spawn 1 zombie.
sm_zmob <amount// Creates a mob that will attack survivors. Usage sm_zmob <amount>. 
- Using sm_zspawn or !zspawn works like z_spawn but plugin will check if the place you are aiming is not blocked, this prevents spawning zombies blocked in a wall.

3. Auto Spawn
- Special infected autospawn: Special infected can be spawned automatically by plugin to balance servers with high amount of survivors, it uses a weight system like Auto Infected Spawner to modify the probability an special infected can spawn over the others.
- Block special autospawn: Plugin can be configured to block special autospawn if a tank is in play or if survivors are staying in the same area for a while (emulates the behaviour of director spawns), panic event can prevent the block of the autospawn to allow spawn specials while survivors are holding position for a long time because they are fighting the horde.
- In survival autospawn rate and zombie limit can increase over time allowing survival round to increase its difficulty without starting with a crazy amount of zombies just at the beggining.
- Tank and Witch autospawn: This plugin does not spawn tanks and witches using timers, instead of that works as the Director, it spawns a predefined amount of tanks and witches when survivors reach a required map progress, each map can have up to 64 tanks and witches spawned homogeneously over the map. In versus both teams will have the same amount of tanks and witches and they will spawn when both teams reach the same map progress to be equal for both teams.
- Random mob spawn: It can spawn random mobs just like Director does, between two random times.
- New: When survivors reach specific scores in scavenge (also coop and versus scavenge finales) tanks can spawn.

This plugin requires Left 4 DHooks Direct in order to work.

If you are updating plugin to v1.2, delete old .cfg file to create the new one with the new convars. File is located in cfg/sourcemod/
ConVars(L4D2):
PHP Code:
// Allow Plugin to automatically call mobs over time (0 = deny, 1 = allow).
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_automob_enable "1"

// Maximum amount of time in seconds between auto mob spawns.
// -
// Default: "240.0"
// Minimum: "1.000000"
zspawn_automob_time_max "240.0"

// Minimum amount of time in seconds between auto mob spawns.
// -
// Default: "90.0"
// Minimum: "0.100000"
zspawn_automob_time_min "90.0"

// Amount of special infected that will be autospawned at once.
// -
// Default: "1"
// Minimum: "1.000000"
// Maximum: "28.000000"
zspawn_autosp_amount "1"

// Allow Plugin to automatically spawn special infected (0 = deny, 1 = allow).
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_autosp_enable "1"

// Max amount of special infected alive, tanks and witches not included in this count.
// -
// Default: "6"
// Minimum: "0.000000"
// Maximum: "28.000000"
zspawn_autosp_limit "6"

// Limit of each special infected class alive, put the limits separated with commas, no spaces. 
//  <smoker>,<boomer>,<hunter>,<spitter>,<jockey>,<charger>
// -
// Default: "1,1,1,1,1,1"
zspawn_autosp_limit_class "1,1,1,1,1,1"

// Allow panic events to invalidate autospawn stops.
// 0 = Dont resume autospawn on panic events.
// 1 = Panic will invalidate autospawn stop with players not moving.
// 2 = Panic will invalidate autospawn stop with tank in game.
// 3 = Panic will invalidate all autos
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "3.000000"
zspawn_autosp_panic "1"

// If Survivors stop moving for a while, autospawn will stop.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_autosp_stop_notmoving "1"

// Stop autospawn if a tank is in game.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_autosp_stop_tank "1"

// When autospawn begins or resumes, add extra time to the first spawn.
// -
// Default: "10.0"
// Minimum: "0.000000"
zspawn_autosp_time_delay "10.0"

// Maximum amount of time in seconds between auto special spawn.
// -
// Default: "25.0"
// Minimum: "1.000000"
zspawn_autosp_time_max "25.0"

// Minimum amount of time in seconds between auto special spawn.
// -
// Default: "10.0"
// Minimum: "0.100000"
zspawn_autosp_time_min "10.0"

// Spawn time mode: 0 = random, 1 = incremental, 2 = decremental.
// Incremental: When more specials are alive time will approach to its maximum value.
// Decremental: its the opposite as incremental.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "2.000000"
zspawn_autosp_time_mode "1"

// Special weight will decrease based on the amount of zombies of its class alive.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_autosp_weight_scale "1"

// Autospawn zombie weights, it determines the chance that each special infected is spawned respect to the others.
// Chance of special spawn = Weight/sum of all Weights.
// Must place 6 values, separated by comma, no spaces.
// <smoker>,<boomer>,<hunter>,<spitter>,
// -
// Default: "1000,1000,1000,1000,1000,1000"
zspawn_autosp_weights "1000,1000,1000,1000,1000,1000"

// Maximum amount of tanks that will be autospawned on each map.
// -
// Default: "2"
// Minimum: "0.000000"
// Maximum: "64.000000"
zspawn_autotank_max "2"

// Minimum amount of tanks that will be autospawned on each map.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "64.000000"
zspawn_autotank_min "1"

// Determines the required score in scavenge to spawn a tank.
// When a tank has spawned, plugin will count again to spawn another one.
// This works in scavenge gamemode and in campaing scavenge finales.
// 0 = No tanks on scavenge.
// -
// Default: "10"
// Minimum: "0.000000"
zspawn_autotank_scav_amount "10"

// Maximum amount of witches that will be autospawned on each map.
// -
// Default: "3"
// Minimum: "0.000000"
// Maximum: "64.000000"
zspawn_autowitch_max "3"

// Minimum amount of witches that will be autospawned on each map.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "64.000000"
zspawn_autowitch_min "1"

// Director can spawn mobs. Does not affect vomit mobs (0 = deny, 1 = allow).
// Director is allowed to spawn always mobs on finales to prevent game errors.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_dir_allow_mob "1"

// Allow which special infected can be spawned by Director.
// 0 = Special denied, 1 = Special allowed.
// Must place 6 values, separated by commas, no spaces.
//  <smoker>,<boomer>,<hunter>,<spitter>,<jockey>,<charger>
// -
// Default: "1,1,1,1,1,1"
zspawn_dir_allow_special "1,1,1,1,1,1"

// Director can spawn tanks (0 = deny, 1 = allow).
// Director is always allowed to spawn tanks on finales to prevent game errors.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_dir_allow_tank "1"

// Director can spawn witches (0 = deny, 1 = allow).
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_dir_allow_witch "1"

// 0 = Plugin off, 1 = Plugin on.
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
zspawn_enable "1"

// Force plugin to work in the gamemode that you choose.
// Use this convar if your gamemode or mutation is not detected correctly.
// 0 = do not override, 1 = coop, 2 = versus, 3 = survival, 4 = Scavenge.
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "4.000000"
zspawn_gamemode_override "0"

// Enable the plugin in these gamemodes, separated by spaces. (Empty = all).
// -
// Default: ""
zspawn_gamemodes ""

// Maximum amount of zombies to spawn when a mob starts.
// Affects mobs generated by Director or by Plugin.
// -
// Default: "45"
// Minimum: "0.000000"
zspawn_mob_max "45"

// Minimum amount zombies to spawn when a mob starts.
// Affects mobs generated by Director or by Plugin.
// -
// Default: "20"
// Minimum: "0.000000"
zspawn_mob_min "20"

// Limit of special infected when survival starts. 
// Zombie limit will transition to 'zspawn_autosp_limit' over the time defined in'zspawn_survival_time'.
// -
// Default: "5"
// Minimum: "0.000000"
zspawn_survival_start_limit "5"

// Amount of time in seconds to reach default spawn times and zombie limits. 
// Set to 0 if you dont want spawn times and limits vary over survival game.
// -
// Default: "600.0"
// Minimum: "0.000000"
zspawn_survival_time "600.0"

// Maximum time between special autospawns when survival starts. 
// Time will transition to 'zspawn_autosp_time_man' over the time defined in'zspawn_survival_time'.
// -
// Default: "45"
// Minimum: "1.000000"
zspawn_survival_time_max "45"

// Minimum time between special autospawns when survival starts. 
// Time will transition to 'zspawn_autosp_time_min' over the time defined in'zspawn_survival_time'.
// -
// Default: "20"
// Minimum: "0.100000"
zspawn_survival_time_min "20"

// Maximum amount of zombies to spawn when someone is on vomit.
// -
// Default: "45"
// Minimum: "0.000000"
zspawn_vomitmob_max "45"

// Minimum amount zombies to spawn when someone is on vomit.
// -
// Default: "20"
// Minimum: "0.000000"
zspawn_vomitmob_min "20" 
Credits:
- Weapon Spawn, I copied raytrace system to spawn weapons and modify it to fit into my plugin.
- Auto Infected Spawner, for the weight and incremental/decremental times idea.
- Infected Bots Control, For the gamemode filter.

Changelog:
HTML Code:
* 1.0 (03-May-21)
	- Initial release.

* 1.1 (05-May21)
	- Improved zombie spawn performance to decrease lag when spawning high amount of infected at once.
	- Prevent plugin errors when trying to use commands via server console.
	- Modified ConVar description and fixed some gramatical errors, ConVars are not affected, is not needed to update the cfg.
	- Fixed bug in sm_zspawn command which found witches or common infected as obstacles to spawn zombies.
	- "sm_zspawn" and "sm_zauto" now accept as an optional argument the amount of zombies to spawn (max 16), if not specified, the commands will spawn 1 zombie.
	- Admin commands now return messages via ReplyToCommand() instead of PrintToChat().
	- Addmin commmands return a message if a spawn was successful.

* 1.2	(09-May-2021)
	- Added support for Left 4 Dead.
	- Plugin uses "info_gamemode" to check current gamemode (thanks to Silvers for the suggestion).
	- Fixed some spelling mistakes (again thanks to Silvers).
	- New ConVar "zspawn_gamemode_override" can force the plugin to emulate another gamemode, it can be used to solve bugs in mutations if the gamemode is not detected correctly.
	- [L4D2]Trying to add more than 6 values in special limits and weight convars will report and error instead of accepting the first 6 values.
	- Fixed leaks with ray trace handles.
	- Solved CloseHandle errors with timers.
	- Fixed the error getting invalid client (Client index 65 is invalid).
	- Solved bug in scavenge that stopped autospawn if "zspawn_autosp_stop_notmoving" was set to 1.
	- Plugin now can spawn tanks in scavenge when survivors reach specific scores (new ConVar "zspawn_autotank_scav_amount").
	- Admin spawn commands now report the amount of infected spawned, if no infected could be spawned it will report an error.
	- Autospawn of tanks and witches now uses the survivor closest to the end of map to get the spawn position.
	- If admins try to spawn more than 16 zombies the value will be clamped to 16.
	- Added tags in plugin messages.

* 1.2.1 (09-May-2021)
	- Added extra check if plugin was able to find a valid location for auto spawning and prevent spawn errors (thanks to HarryPotter for the advice).
	- Deleted PrintToServer() functions used as debugging.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_zspawn.sp - 13 views - 57.4 KB)
File Type: smx l4d_zspawn.smx (21.8 KB, 12 views)

Last edited by Earendil; 05-09-2021 at 06:48. Reason: Update to v1.2.1
Earendil is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 05-03-2021 , 12:53   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.0)[03-May-2021]
Reply With Quote #2

Nice work!

Btw I would suggest changing "GetGameMode" to support all mutations simply create and fire the "info_gamemode" entity how most of my plugins use it. That way you can get unknown mutations and their game mode types.
__________________
Silvers is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-03-2021 , 16:16   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.0)[03-May-2021]
Reply With Quote #3

Quote:
Originally Posted by Silvers View Post
to support all mutations simply create and fire the "info_gamemode" entity how most of my plugins use it. That way you can get unknown mutations and their game mode types.
For the mutations below, this method doesn't work (unless you set "unknown" mutations to a default mode like coop)
  • holdout
  • dash
  • shootzones
__________________

Last edited by Marttt; 05-03-2021 at 16:17.
Marttt is offline
foxhound27
Senior Member
Join Date: Sep 2019
Location: Argentina
Old 05-04-2021 , 00:25   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.0)[03-May-2021]
Reply With Quote #4

Bravo!
foxhound27 is offline
Earendil
Junior Member
Join Date: Jan 2020
Location: Spain
Old 05-04-2021 , 15:35   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.0)[03-May-2021]
Reply With Quote #5

Quote:
Originally Posted by Silvers View Post
Nice work!

Btw I would suggest changing "GetGameMode" to support all mutations simply create and fire the "info_gamemode" entity how most of my plugins use it. That way you can get unknown mutations and their game mode types.
Thanks to you for that awesome plugin! It gives tons of possibilities. I will take a look with using "info_gamemode".
Quote:
Originally Posted by Marttt View Post
For the mutations below, this method doesn't work (unless you set "unknown" mutations to a default mode like coop)
I will add a cvar that can override the gamemode decision by plugin, if server is running an unknown mutation or a custom map where the default gamemode selector does not work server admin can modify that cvar to force the plugin to play in the gamemode they want.

So, what im working in now:
- Fix all gramar errors (sorry, I have not practised english for some years).
- Fix performance issues: If you spawn a lot of specials at once server usually lags, thats because A lot of code is running on each spawn, so Im optimizing the spawn section.
- Add the option to spawn tanks/witches via timer, solo or with map progress.
- I need to find out how can I spawn zombies in Left 4 Dead, L4D2_SpawnTank, L4D2_SpawnSpecial and L4D2_SpawnWitch don't work in Left 4 Dead, and thats what can spawn infected bots in versus without messing up with infected players, or spawn up to 28 zombies of the same type.
Earendil is offline
Striker black
Member
Join Date: Apr 2013
Old 05-04-2021 , 19:53   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.0)[03-May-2021]
Reply With Quote #6

I was trying this plugin so cool but I got these messages in logs

PHP Code:
L 05/04/2021 17:18:02: [SMCall stack trace:
L 05/04/2021 17:18:02: [SM]   [0FakeClientCommand
L 05
/04/2021 17:18:02: [SM]   [1Line 928C:\Users\PERCY\Downloads\sourcemod 1.10\addons\sourcemod\scripting LEGACY\l4d_zspawn.sp::Mob_Timer
L 05
/04/2021 17:18:02: [SMException reportedClient index 65 is invalid
L 05
/04/2021 17:18:02: [SMBlamingl4d_zspawn.smx
L 05
/04/2021 17:18:02: [SMCall stack trace:
L 05/04/2021 17:18:02: [SM]   [0FakeClientCommand
L 05
/04/2021 17:18:02: [SM]   [1Line 928C:\Users\PERCY\Downloads\sourcemod 1.10\addons\sourcemod\scripting LEGACY\l4d_zspawn.sp::Mob_Timer
L 05
/04/2021 17:18:03: [SMException reportedClient index 65 is invalid
L 05
/04/2021 17:18:03: [SMBlamingl4d_zspawn.smx
L 05
/04/2021 17:18:03: [SMCall stack trace:
L 05/04/2021 17:18:03: [SM]   [0FakeClientCommand
L 05
/04/2021 17:18:03: [SM]   [1Line 928C:\Users\PERCY\Downloads\sourcemod 1.10\addons\sourcemod\scripting LEGACY\l4d_zspawn.sp::Mob_Timer
L 05
/04/2021 17:18:03: [SMException reportedClient index 65 is invalid
L 05
/04/2021 17:18:03: [SMBlamingl4d_zspawn.smx
L 05
/04/2021 17:18:03: [SMCall stack trace:
L 05/04/2021 17:18:03: [SM]   [0FakeClientCommand
L 05
/04/2021 17:18:03: [SM]   [1Line 928C:\Users\PERCY\Downloads\sourcemod 1.10\addons\sourcemod\scripting LEGACY\l4d_zspawn.sp::Mob_Timer 
__________________
Striker black is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 05-05-2021 , 02:51   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.0)[03-May-2021]
Reply With Quote #7

Quote:
Originally Posted by Earendil View Post
- I need to find out how can I spawn zombies in Left 4 Dead, L4D2_SpawnTank, L4D2_SpawnSpecial and L4D2_SpawnWitch don't work in Left 4 Dead, and thats what can spawn infected bots in versus without messing up with infected players, or spawn up to 28 zombies of the same type.
These natives work in L4D1, it's just the naming convention being kept for backwards compatibility.
__________________
Silvers is offline
Earendil
Junior Member
Join Date: Jan 2020
Location: Spain
Old 05-05-2021 , 13:02   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.0)[03-May-2021]
Reply With Quote #8

Update to v1.1:
HTML Code:
- Improved zombie spawn performance to decrease lag when spawning high amount of infected at once.
- Prevent plugin errors when trying to use commands via server console.
- Modified ConVar description and fixed some gramatical errors, ConVars are not affected, is not needed to update the cfg.
- Fixed bug in "sm_zspawn" command which found witches or common infected as obstacles to spawn zombies.
- "sm_zspawn" and "sm_zauto" now accept as an optional argument the amount of zombies to spawn (max 16), if not specified, both commands will spawn 1 zombie.
- Admin commands now return messages via "ReplyToCommand()" instead of "PrintToChat()".
- Addmin commmands return a message if a spawn was succeful.
Attached Files
File Type: smx l4d_zspawn.smx (19.0 KB, 1 views)
File Type: sp Get Plugin or Get Source (l4d_zspawn.sp - 6 views - 46.6 KB)
Earendil is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 05-05-2021 , 20:38   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.1)[05-May-2021]
Reply With Quote #9

Got this error
L 05/05/2021 - 19:09:28: SourceMod error session started
L 05/05/2021 - 19:09:28: Info (map "c1m1_hotel") (file "C:\servers\madhouse\left4dead2\addons\source mod\logs\errors_20210505.log")
L 05/05/2021 - 19:09:28: [SM] Exception reported: Handle 385f1083 is invalid (error 1)
L 05/05/2021 - 19:09:28: [SM] Blaming: l4d_zspawn.smx
L 05/05/2021 - 19:09:28: [SM] Call stack trace:
L 05/05/2021 - 19:09:28: [SM] [0] CloseHandle
L 05/05/2021 - 19:09:28: [SM] [1] Line 413, l4d_zspawn.sp::EndGame
L 05/05/2021 - 19:09:28: [SM] [2] Line 483, l4d_zspawn.sp::OnMapEnd
L 05/05/2021 - 19:094: Error log file session closed.
Krufftys Killers is offline
Earendil
Junior Member
Join Date: Jan 2020
Location: Spain
Old 05-05-2021 , 21:36   Re: [L4D2] ZSpawn: Zombie Spawn manager (v1.1)[05-May-2021]
Reply With Quote #10

Quote:
Originally Posted by Striker black View Post
I was trying this plugin so cool but I got these messages in logs
I found the problem, fixed for next update.

Quote:
Originally Posted by Krufftys Killers View Post
Got this error
Im not 100% if thats the cause sure but at the end of each round and at the end of map plugin deletes handles related to timers. Maybe trying to delete handles twice causes that error (can someone confirm if thats true?). I will take a look in that.

Last edited by Earendil; 05-05-2021 at 21:52.
Earendil is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:04.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode