Left 4 Dead 2/Scripting/Director Scripts/AllowFallenSurvivorItem: Difference between revisions
< Left 4 Dead 2 | Scripting | Director Scripts
Jump to navigation
Jump to search
(Removed "printl" section at the introduction; Merged == Debugging == with introduction) |
m (Nescius moved page Left 4 Dead 2/Scripting/Script Functions/Director Scripts/AllowFallenSurvivorItem to Left 4 Dead 2/Scripting/Director Scripts/AllowFallenSurvivorItem without leaving a redirect) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{LanguageBar}} | |||
On DirectorOptions load, this is called for every item a Fallen Survivor can equip. Return ''<code>true</code>'' 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 (<code>c6m2_bedlam</code>), thus its recommended to use commands that can force spawning of fallen survivors: | On DirectorOptions load, this is called for every item a Fallen Survivor can equip. Return ''<code>true</code>'' 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 (<code>c6m2_bedlam</code>), thus its recommended to use commands that can force spawning of fallen survivors: | ||
{{varcom|start}} | {{varcom|start}} | ||
Line 6: | Line 7: | ||
{{varcom|z_forcezombiemodelname|common_male01|[[Left_4_Dead_Infected_Populations#List_of_Population-Supported_Infected_Types|Name of a Common's model]]|When<code>z_forcezombiemodel</code>is active, force all Common Infected to use this model. If the model isn't precached, ignore.}} | {{varcom|z_forcezombiemodelname|common_male01|[[Left_4_Dead_Infected_Populations#List_of_Population-Supported_Infected_Types|Name of a Common's model]]|When<code>z_forcezombiemodel</code>is active, force all Common Infected to use this model. If the model isn't precached, ignore.}} | ||
{{varcom|end}} | {{varcom|end}} | ||
__NOTOC__ | |||
{{note|Unlike the [[L4D2_Director_Scripts/AllowWeaponSpawn|AllowWeaponSpawn]] callback, this can only disallow items on Fallen Survivor, and not allow any new ones.}} | {{note|Unlike the [[L4D2_Director_Scripts/AllowWeaponSpawn|AllowWeaponSpawn]] callback, this can only disallow items on Fallen Survivor, and not allow any new ones.}} | ||
Line 19: | Line 20: | ||
| string | | string | ||
| classname | | classname | ||
| | |||
* weapon_molotov | * weapon_molotov | ||
* weapon_pipe_bomb | * weapon_pipe_bomb | ||
* weapon_pain_pills | * weapon_pain_pills | ||
* weapon_first_aid_kit | * weapon_first_aid_kit | ||
| Name of a weapon's classname; Only 4 are given. | | Name of a weapon's classname; Only 4 are given. | ||
|} | |} | ||
Line 41: | Line 41: | ||
[[File:L4D2DirectorScript_Callbacks-Health-pack-alypseFallens.jpg|thumb|right|super|upright=1.2]] | [[File:L4D2DirectorScript_Callbacks-Health-pack-alypseFallens.jpg|thumb|right|super|upright=1.2]] | ||
When ran, Fallen Survivors will ''sometimes'' only spawn with a [[weapon_first_aid_kit]] equipped, and never spawn equipped with any other gear. | When ran, Fallen Survivors will ''sometimes'' only spawn with a [[weapon_first_aid_kit]] equipped, and never spawn equipped with any other gear. | ||
<syntaxhighlight lang=js> | |||
// A Fallen Survivor Healthpack-alypse! | // A Fallen Survivor Healthpack-alypse! | ||
DirectorOptions <- | DirectorOptions <- | ||
Line 59: | Line 59: | ||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Left 4 Dead 2]] | [[Category:Left 4 Dead 2]] | ||
[[Category:Scripting]] | [[Category:Scripting]] |
Latest revision as of 14:04, 15 September 2024


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/Command | Parameters or default value | Descriptor | Effect |
---|---|---|---|
z_fallen_kill_suppress_time | 300 | Seconds | When a Fallen Survivor is killed, how long in seconds should pass before another can spawn. |
z_fallen_max_count | 1 | Arbitrary number | How many Fallen Survivors can be active at once. |
z_forcezombiemodel | 0 | 0 disables, 1 enables | Determines ifz_forcezombiemodelname is allowed to be used. |
z_forcezombiemodelname | common_male01 | Name of a Common's model | Whenz_forcezombiemodel is active, force all Common Infected to use this model. If the model isn't precached, ignore. |

Parameters
bool AllowFallenSurvivorItem(string classname)
Type | Name | Arguments | Description |
---|---|---|---|
string | classname |
|
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
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
}
}
}