View Single Post
Author Message
Thraka
AlliedModders Donor
Join Date: Aug 2005
Old 02-25-2010 , 03:19   [L4D2] Infected Loot Drops (2.3d)
Reply With Quote #1

Only supports L4D2
Requires Sourcemod 1.3+

Required:
SourceMod Extension Config 1.0.2: http://forums.alliedmods.net/showthread.php?t=69167 Download the config.ext.zip file from the end of the first post. Inside the zip file, go into the addons\sourcemod\extensions folder and extract the config.ext.dll or config.ext.so file and upload it to your servers Addons/SourceMod/Extensions folder.

Optional:
AtomicStrykers Uncommon Infected Horde: http://forums.alliedmods.net/showthread.php?t=109623 - This enables the uncommon mobs in your config files. Without it, they will not spawn.

Note:
If you want to use a L4D1 version of this plugin, use version 1.3 in this thread: http://forums.alliedmods.net/showthread.php?t=107681

Additionally, your config cvar defaults to the file:
cfg\sourcemod\ l4d2_infected_loot_drops_loot_settings.conf
so MAKE THIS FILE!

This plugin hooks the death event of a player or infected. This includes common zombies and the witch! When that infected dies, the type of thing it was (tank, common, smoker etc) is checked against the config file. The config file has two categories of actions, one for dice to roll and react, and another for things that happen 100% of the time.

The dice can be configured to be any number of dice of any number of sides. The whole roll is added up and it's compared against set of "things" defined for that class. If the dice roll is in the range set by a thing, that thing is executed.

Things can be infected spawns, items spawns, weapon spawns, upgrade spawns, or melee spawns. The example config file has all the information you need on configuring the plugin. You will need to take time to config and balance this out. Giving too many items make it too frustrating for the infected, while too little items make it frustrating on the survivors.

All game modes are supported.

Todo
  • Add german game weapons, if the Weapon Unlock plugin adds commands to run, I can hook into that.
  • Optionally notify players when something drops.
Version History
2.3d
  • Fixed critical bug which prevented human infected from triggering the loot for the class they played as. Thanks Eraa!!
2.3c
  • Checked for uncommon plugin at OnMapStart.
  • InfectedFactory was storing "thing count" wrong for normal z_spawn commands.
  • InfectedFactory was spawning thing with the _ still in the name for normal z_spawn commands.
  • InfectedFactory was storing "thing counts" for the individual spawns caused by "infected-team".
  • Added new "boss-team" type to InfectedFactory.
2.3b
  • Config file handle is erased properly. This helps reloading configs if you use the loot_reloadconfig command.
  • Announce system had a bug which didn't load the convar into the global variable.
  • Announce system looked for announce = 0 to announce. This is fixed and changed to look for 1.
2.3a
  • "Things no roll" wouldn't process more than one if multiple matched. Introduced in 2.3. Fixed!
  • Made announce method slightly more efficient by checking if announce was shutoff when we get into the method.
2.3
  • Changed the way the plugin fails for non l4d2 servers
  • Added announcement system.
  • Added new l4d2_loot_announce_mode cvar.
  • Cleared handle to config file when closing the file.
  • Updated the example config with announcement example (global section)
2.2
  • Added two categories (like the global category) for infected types.
    normal_infected - Any of the normal infected classes: smoker, hunter, charger, boomer, spitter, jockey
    boss_infected - Any of the boss classes: tank, witch
  • Updated the example config
2.1
  • Factory limit system is active! You can define global limits for any thing. For example, no matter how you spawn defibs through this plugin, you can specify only 2 maximum can ever spawn.
  • Added some commands to help check your settings regarding current spawn counts for things, and max amounts.
  • Updated the example config. Everything in the example is now WORKING.
  • Infected factory (that uses z_spawn commands) can NOT contain spaces. It must have a _ separating: charger_auto
2.0a
  • Reload the config on the OnMapStart forward.
  • Updated the response to loot_sim to provide examples.
2.0
  • Initial L4D2 Support. Dropped L4D1.
  • Things different from 1.3
  • Support witch and common infected
  • Support global (anytime anything dies) definition
  • Support all standard weapons and items, melee items, and upgrade items.
  • Configure any number of dice of any amount of sides.
1.3
Commands
All commands require ADMFLAG_KICK permissions
loot_reloadconfig - Reloads the current conf file specified by the l4d2_loot_config_filename cvar.
loot_sim - Simulates an infected killed, so you can see what would happen.
loot_get_thingcount - Gets how many times a specific thing has spawned.
loot_add_thingcount - Adds 1 to a specific thing count of how many times it's spawned.
loot_get_thingmax - Gets the max spawn setting of a thing.
loot_thing_ismaxed - Informs you of if a thing has already reached the max spawn limit.


CVARS
l4d2_loot_config_filename - The name of the config file located in the cfg/sourcemod folder.
l4d2_loot_enabled - Is the infected loot plugin enabled or not.
l4d2_loot_logging - Enable logging.
l4d2_loot_announce_mode - Announces text to client teams when something spawns (if defined) 0 = Off; 1 = Hint text; 2 = Team chat.

Example
Starting off, I have a global config that rolls a 500 sided die. If 1-10 lands, a defibrillator will spawn. I set the plugin max for the defib to two. Regardless of if the global section spawns it, or any other thing, only TWO can ever show up for the level. If it spawns, it displays a message only to the survivor team:

Code:
max_spawns:
{
	item:
	{
		weapon_defibrillator_spawn = 1;
	};
};

global:
{
	repeat = 1;
	dice = [1500];
	
	tell_survivors = "You hear something that can save lives drop to the ground.";

	things = (
	{	name	=	"weapon_defibrillator_spawn";
		type	=	"item";
		min	=	1;
		max	=	10;
	}
	);
};
Attached Files
File Type: txt l4d2_infected_loot_drops_loot_settings-example1.conf.txt (9.0 KB, 5283 views)
File Type: sp Get Plugin or Get Source (l4d2_infected_loot_drops.sp - 3716 views - 30.6 KB)
File Type: smx l4d2_infected_loot_drops.smx (15.5 KB, 5605 views)

Last edited by Thraka; 01-17-2012 at 19:34. Reason: Updated the example config
Thraka is offline