AllowFallenSurvivorItem

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)

On DirectorOptions load, this is called for every item a Fallen Survivor can equip. Return true to allow Fallen Survivors have a chance in equipping an item. Its hard to debug this function as Fallen Survivors are rare to come across in the maps they spawn in (c6m2_bedlam), thus its recommended to use commands that can force spawning of fallen survivors:

Cvar/CommandParameters or default valueDescriptorEffect
z_fallen_kill_suppress_time300SecondsWhen a Fallen Survivor is killed, how long in seconds should pass before another can spawn.
z_fallen_max_count1Arbitrary numberHow many Fallen Survivors can be active at once.
z_forcezombiemodel00 disables, 1 enablesDetermines ifz_forcezombiemodelnameis allowed to be used.
z_forcezombiemodelnamecommon_male01Name of a Common's modelWhenz_forcezombiemodelis active, force all Common Infected to use this model. If the model isn't precached, ignore.
Note.pngNote:Unlike the AllowWeaponSpawn callback, this can only disallow items on Fallen Survivor, and not allow any new ones.

Parameters

bool AllowFallenSurvivorItem(string classname)

Type Name Arguments Description
string classname
  • weapon_molotov
  • weapon_pipe_bomb
  • weapon_pain_pills
  • weapon_first_aid_kit
Name of a weapon's classname; Only 4 are given.

Expected Returns

Type Description
bool Return true to allow the respective weapon from spawning; false or none is otherwise.

Code Samples

Health-pack-alypse Fallens

L4D2DirectorScript Callbacks-Health-pack-alypseFallens.jpg

When ran, Fallen Survivors will sometimes only spawn with a weapon_first_aid_kit equipped, and never spawn equipped with any other gear.

// A Fallen Survivor Healthpack-alypse!
DirectorOptions <-	
{
  	function AllowFallenSurvivorItem(classname)
	{
		if( classname == "weapon_first_aid_kit" )
		{
			printl("Allowed "+classname);
			return true
		}
		else
		{
			printl("Disallowed "+classname);
			return false
		}
	}
}