Left 4 Dead 2/Scripting/Director Scripts/AllowFallenSurvivorItem: Difference between revisions
(added 2 debugging related commands) |
m (Update to the used "Template:Varcom" arguments) |
||
Line 1: | Line 1: | ||
A callback for the DirectorOptions table. When its DirectorOptions is registered, this function receives callbacks on the spawning of all items from a Fallen Survivor. Arguments with the callback are strings representing a weapon's classname; return''<code>true</code>''for that string to allow Fallen Survivors to have a chance of equipping the weapon. | A callback for the DirectorOptions table. When its DirectorOptions is registered, this function receives callbacks on the spawning of all items from a Fallen Survivor. Arguments with the callback are strings representing a weapon's classname; return''<code>true</code>''for that string to allow Fallen Survivors to have a chance of equipping the weapon. | ||
With usage of the<code>printl</code>function, the exposed arguments are: | With usage of the<code style="color:#E5E5E5;">printl</code>function, the exposed arguments are: | ||
{{ExpandBox|<syntaxhighlight lang=js> | {{ExpandBox|<syntaxhighlight lang=js> | ||
Msg("VSCRIPT: Running director_base_addon.nut; VDC's!\n") | Msg("VSCRIPT: Running director_base_addon.nut; VDC's!\n") | ||
Line 24: | Line 24: | ||
=== Debugging === | === Debugging === | ||
Not only that Fallen Survivors spawn in certain maps only, like<code>c10m4_mainstreet</code>(Death Toll - Streets) or<code>c6m2_bedlam</code>(The Passing - Bedlam), they also are too rare to reliably debug any code with them on those maps. With these commands, once set up properly can be used to debug Fallen Survivors efficiently: | Not only that Fallen Survivors spawn in certain maps only, like<code style="color:#E5E5E5;">c10m4_mainstreet</code>(Death Toll - Streets) or<code style="color:#E5E5E5;">c6m2_bedlam</code>(The Passing - Bedlam), they also are too rare to reliably debug any code with them on those maps. With these commands, once set up properly can be used to debug Fallen Survivors efficiently: | ||
{{varcom|start}} | {{varcom|start}} | ||
{{varcom|z_fallen_kill_suppress_time|300||When a Fallen Survivor is killed, how long in seconds should pass before another can spawn.}} | {{varcom|z_fallen_kill_suppress_time|300|Seconds|When a Fallen Survivor is killed, how long in seconds should pass before another can spawn.}} | ||
{{varcom|z_fallen_max_count|1||How many Fallen Survivors can be active at once.}} | {{varcom|z_fallen_max_count|1|Arbitrary number|How many Fallen Survivors can be active at once.}} | ||
{{varcom|z_forcezombiemodel|0|01|Determines if<code>z_forcezombiemodelname</code>is allowed to be used.}} | {{varcom|z_forcezombiemodel|0|01|Determines if<code>z_forcezombiemodelname</code>is allowed to be used.}} | ||
{{varcom|z_forcezombiemodelname|common_male01|[[Left_4_Dead_Infected_Populations#List_of_Population-Supported_Infected_Types| | {{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}} | ||
__TOC__ | __TOC__ |
Revision as of 12:03, 14 June 2021
A callback for the DirectorOptions table. When its DirectorOptions is registered, this function receives callbacks on the spawning of all items from a Fallen Survivor. Arguments with the callback are strings representing a weapon's classname; returntrue
for that string to allow Fallen Survivors to have a chance of equipping the weapon.
With usage of theprintl
function, the exposed arguments are:
Msg("VSCRIPT: Running director_base_addon.nut; VDC's!\n")
DirectorOptions <-
{
function AllowFallenSurvivorItem( classname )
{
printl(classname)
}
}
//----------------------------------------------
/*Output:
** VSCRIPT: Running director_base_addon.nut; VDC's!
** weapon_molotov
** weapon_pipe_bomb
** weapon_pain_pills
** weapon_first_aid_kit
*/

Debugging
Not only that Fallen Survivors spawn in certain maps only, likec10m4_mainstreet
(Death Toll - Streets) orc6m2_bedlam
(The Passing - Bedlam), they also are too rare to reliably debug any code with them on those maps. With these commands, once set up properly can be used to debug Fallen Survivors efficiently:
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.
// its now a Health-pack-alypse from the Fallens!
DirectorOptions <-
{
function AllowFallenSurvivorItem(classname)
{
if( classname == "weapon_first_aid_kit" )
{
printl("Allowed "+classname);
return true
}
else
{
printl("Disallowed "+classname);
return false
}
}
}