nyuuzyou/wikis huggingface dataset:
Left 4 Dead 2/Authoring Tools

The Left 4 Dead 2 Authoring Tools, also known as an SDK, is a set of software utilities that allow you to create your own levels, campaigns, common Infected, and other gameplay elements. They include versions of Source SDK tools that have been updated to work with the Left 4 Dead 2 version of the Source Engine.
The Left 4 Dead 2 Authoring Tools are freely available on Steam to all owners of the PC version of .
== Download and install ==
To install the Left 4 Dead 2 Authoring Tools, either [steam://install/563 click here] or:
# Open the Steam window. 
# Go to the Library.
# Click on the drop down filter box under the home button (usually displayed as Games or All by default).
# Check Tools, then search for Left 4 Dead 2 Authoring Tools or find it manually by scrolling down the list.
# Double-click on the Left 4 Dead 2 Authoring Tools entry, or click on Left 4 Dead 2 Authoring Tools, then click Install.
# The Left 4 Dead 2 Authoring Tools will download to your computer via Steam. 
# Once it has been fully installed, you will be able to launch it in the same way you installed it (from the Library tab, with Tools enabled on the Library filter).
You can also create a desktop shortcut by right-clicking on the Left 4 Dead 2 Authoring Tools entry and clicking Create desktop shortcut from the context menu. 
== System Requirements ==
Minimum:
* Storage: 1 GB free space
=== Run on Linux ===
* Run Left 4 Dead 2 Authoring Tools under Proton.
* To avoid rendering bugs, add a launch option: PROTON_USE_WINED3D=1 %command%
== See also ==
* L4D2 Level Design
Left 4 Dead 2/Scripting/Decrypted mutations

These are all official L4D2 mutation scripts and their included scripts. Most scripts have been decrypted on February 26th 2021 with L4D2 VScript Editor Beta 0.5 by Cynick and may be updated at any time.
==Valve Mutations==
===L4d1===
===L4d1coop - L4D1 Co-op===
===L4d1vs - L4D1 Versus===
===L4d1survival - L4D1 Survival===
===Mutation1 - Last Man on Earth===
===Mutation2 - Headshot!===
===Mutation3 - Bleed Out===
===Mutation4 - Hard Eight===
===Mutation5 - Four Swordsmen===
===Mutation6===
This 'mutation' is missing from gamemodes.txt since release, apparently. The .nuc was removed from the game files between 2.0.2.7 and 2.0.4.5.
===Mutation7 - Chainsaw Massacre===
===Mutation8 - Iron Man===
===Mutation9 - Last Gnome On Earth===
===Mutation10 - Room For One===
===Mutation11 - Healthpackalypse!===
===Mutation12 - Realism Versus===
===Mutation13 - Follow the Liter===
===Mutation14 - Gib Fest===
===Mutation15 - Versus Survival===
===Mutation16 - Hunting Party===
===Mutation17 - Lone Gunman===
===Mutation18 - Bleed Out Versus===
===Mutation19 - Taaannnk!!===
===Mutation20 - Healing Gnome===
===RocketDude===
Technically, RocketDude was made by community members for the "The Last Stand" update, but listed as official because it is an official mutation.
====RocketDude Additional Scripts====
These scripts are all included in the main RocketDude script.
=====rd_custom_map_support=====
=====rd_damage_controll=====
=====rd_debug=====
=====rd_decals=====
=====rd_detonation_analysis=====
=====rd_director=====
=====rd_events=====
=====rd_hud_controller=====
 
=====rd_last_chance=====
=====rd_map_specifics=====
=====rd_meds=====
=====rd_melee_getter=====
=====rd_mode_description=====
=====rd_saferoom_timer=====
=====rd_speedrun_mode=====
=====rd_utils=====
==Community Mutations==
These mutations were made by the community, eventually added to the base game by Valve.
===Community1 - Special Delivery===
===Community2 - Flu Season===
===Community3 - Riding My Survivor===
===Community4 - Nightmare===
===Community5 - Death's Door===
===Community6 - Confogl===
====Confogl Additional Scripts====
These scripts are included in the main Confogl and globals scripts.
=====globals=====
=====gamestate_model=====
=====globaltimers=====
=====utils=====
=====modules=====
==EMS Mutations==
These have been introduced with the L4D2 EMS Update
===Dash===
===Holdout===
===ShootZones===
===GunBrain===
===Tank Run===
== See also ==
=== Intros ===
*VScript
*L4D2 VScripts
*Mutation Gametype (L4D2)
*L4D2 Gamemodes File
=== Documentations ===
*VSLib
*L4D2 Vscript Examples
*L4D2 Director Scripts
*L4D2 Script Functions
*L4D2 Level Design/Boss Prohibition
*Custom Finales Contains all original finale scripts as reference.
*Extended Mutation System
=== Miscelleanous ===
*logic_script
*trigger_finale
*info_director
*List of L4D2 Cvars
*Official Vscripts Decompiled
Left 4 Dead 2/Scripting/Director Scripts/AllowFallenSurvivorItem

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:
__NOTOC__
== 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 ===
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
		}
	}
}
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Director Scripts/AllowWeaponSpawn

A callback for the DirectorOptions table. When DirectorOptions is loaded, this function will be called each time for all current weapons in the map, values being strings that represent their respective weapon entities, with a majority being classnames of the weapons's entities. Return true to allow the string's respective weapon to spawn.
Its best to see all the arguments value withprintlfirst to know what to expect, especially since there are oddities for how weapon_ammo_spawn and upgrade_laser_sight are represented; Both respectively are represented asammoandupgrade_itemstrings. Like so:
This callback can be undesirable to work with in certain occasions, as it can't account for specific melees, carryable props, or mounted guns. If so, refer to this sub-section of Code Samples section for an alternative.
__TOC__
== Parameters ==
bool AllowWeaponSpawn(string classname)
Type 	Name 	Description
string	classname	Name of a weapon's classname, though a small few aren't their exact classnames.
== Expected Returns ==
Type	Description
bool	Return true to allow the respective weapon from spawning, false or none is otherwise.
== Code Samples ==
=== Array Approach ===
A common approach used in many mutations, including Valve's; This method makes the function find if the argument it gets called back is in theItemsToAllowarray, then it returns true if it finds it.
=== String Similiarity Approach ===
In the example below, the function will only look for strings that contain a specific keyword in it. This is meant to be used if you need all weapons under a specific weapon category (shotguns, smgs) to be allowed, otherwise just use the above example, as you'll probably add unneeded complexity for your function.
=== Custom 'AllowWeaponSpawn' Implementation ===
Sometimes, this callback may be undesirable to use, as it can't account for specific melees, carryable props, or mounted guns. Using OnGameEvent_' prefixed functions, hook the eventround_start_post_navand make our own 'AllowWeaponSpawn' implementation.
This implementation works by comparing the items's model path names, and deleting them if their model paths match the ones in theItemstoRemove_ModelPathsarray.
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Expanded Mutation System/Appendix: Debugging

__NOTOC__ 
== Helpful Scripted Mode console commands ==
* script_attach_debugger: attaches the game to the VS2010 Visual Squirrel debugger
* script_attach_debugger_at_startup : attaches the debugger as soon as possible after loading a map
* script_debug : toggles console debugging of functions and watches printed to the console
** when script_debug is active passing 'watch' (or just 'w') will turn off watch rendering, 'messages' (or 'm') will turn of non-watch messages
*script_add_debug_filter : Add a filter to the game debug overlay
*script_remove_debug_filter : Remove a filter from the game debug overlay
*script_add_watch : Add a watch to the game debug overlay
*script_add_watch_pattern : Add a watch to the game debug overlay with a name match
*script_remove_watch : Remove a watch from the game debug overlay
*script_remove_watch_pattern : Remove a watch from the game debug overlay
*script_clear_watches : Clear all watches from the game debug overlay
*script_find : Find a key in the VM
** after finding a key you can add it as a watch and it will appear in script_debug w in green
*script_help : Lists system-y functions you can call from script with a bit of help text
Category: Left 4 Dead 2Category: Level Design
Left 4 Dead 2/Scripting/Expanded Mutation System/Appendix: DirectorOptions

__NOTOC__ 
== The DirectorOptions Table ==
And yes, in a new mutation, you'll use SessionOptions to refer to this stuff, not DirectorOptions.
== The Options Table ==
Check out the following, for the previous info about all the DirectorOptions Settings
https://developer.valvesoftware.com/wiki/L4D2_Vscripts#Director_options
There are also some new options provided in the extended mutation support.
They will probably be documented on the page above eventually, but here are a few worth calling out.
* Total<SpecialType> - if you want a panic wave with a specific # of a specific type of special
* TotalSpecials - if you just want a given # of specials in a wave, but you don't care exactly which
* PanicSpecialsOnly - the Panic should end when we finish with Specials, not wait for the MegaMob
* SpawnSetRule/SpawnDirectionMask - see Spawning Infected
* InfectedFlags - allows you to change sensory behavior for common infected. Values are:
** INFECTED_FLAG_CANT_SEE_SURVIVORS
** INFECTED_FLAG_CANT_HEAR_SURVIVORS
** INFECTED_FLAG_CANT_FEEL_SURVIVORS
Example of how to OR all three flags so commons can't see, hear, or feel survivors touch them:
 InfectedFlags = INFECTED_FLAG_CANT_SEE_SURVIVORS | INFECTED_FLAG_CANT_HEAR_SURVIVORS | INFECTED_FLAG_CANT_FEEL_SURVIVORS
These flags are set on spawn so if you set flags they will not apply to any infected that are currently in the world. In order to apply flags to already spawned infected you can use this function call:
* ReapplyInfectedFlags( int, handle ): Apply Infected Flags. Applies to all common (spawned and unspawned) unless a handle to a specific infected is specified.
== Warning: The Fields interact a lot! ==
For instance, SpecialRespawnInterval is "how long after a special of type X dies can we spawn another one." Setting this fairly high (the default) makes a lot of sense in a flow based movement. Whereas if you are building a mutation where you stay in a single place, or where you want a ton of boomers, keeping it set high means that whenever you kill a boomer there will be a long wait until the Director is allowed to spawn a new one. So you'd want to set this value very low if your mod wants to do that.
This brings up the main point: often things don't work as expected, because the DirectorOptions have been set in ways that conflict, causing unexpected behaviors. You can set 3 variables to get what you want, but a 4th may default to something that thwarts you. So it is worth learning about all the options, because it is very easy to over-constrain the Director. When you see odd behavior, think about what other variables and settings might be interfering with your plans.
Category: Left 4 Dead 2Category: Level Design
Left 4 Dead 2/Scripting/Expanded Mutation System/Appendix: Game Events

__NOTOC__ 
== Left 4 Dead Game Events ==
Game Events are messages that get broadcast when specific events in the game occur. The messages can then be acted upon by game systems other than the one that caused the event.
Game Events are defined in plain text .res files in the /resource/ folder of your game. 
General game events can be found in this file:
 /resource/gameevents.res
The Left 4 Dead game events can be found in this file:
 /resource/modevents.res
== Creating functions that get called when Game Events occur ==
If you add a function to your script that is prefixed with OnGameEvent_ and appended with the event you want to react to it will get called when the game event occurs.
In this example, when a player leaves the starting area the game event player_left_start_area occurs, and this function would then be called:
function OnGameEvent_player_left_start_area( params )
{
 // ...
}
The params table passed to the function contain data specific to the game event. In the case of player_left_start_area the params table contains the userid of the player who left the start area.
This is the player_left_start_area event definition, taken from resource/modevents.res:
	"player_left_start_area"		// when a player leaves the player start area
	{
		"userid"	"short"		// person who left
	}
== Printing game events to the console as they occur while playing the game ==
You can view game events as they occur in game by enabling game event printing to the console:
 developer 1
 display_game_events 1
Category: Left 4 Dead 2Category: Level Design
Left 4 Dead 2/Scripting/Expanded Mutation System/Appendix: Game Mode using Game Events

__NOTOC__ 
== Using a Game Event ==
In this example we are going to use the game event generated when a Boomer is killed to make the survivors laugh.
First, create a new mutation titled laughtrack. If you do not know how to make a new mutation definition check out the Creating A Simple Mutation tutorial and look under the heading Adding the Mutation Definition.
Next, create a new script file in the vscripts folder titled laughtrack.nut
The first thing we need to do is get the name of the game event we wish to act upon. By playing the game with display_game_events 1 set we can see that the game event boomer_exploded occurs when a Boomer pops. Alternatively, you can look through the game event .res file to find the game event name.
Now that we know the game event boomer_exploded occurs when a Boomer pops we know that our function must be called OnGameEvent_boomer_exploded( params )
Add the function to your script:
//=========================================================
// Called when a boomer explodes. 
// According to the modevents.res file boomer_exploded Params will contain:
//	"userid" "short" 	// Boomer that exploded
//	"attacker"	"short"		// player who caused the explosion
//	"splashedbile"	"bool"		// Exploding boomer splashed bile on Survivors
//=========================================================
function OnGameEvent_boomer_exploded( params )
{
	// so funny!
	Laugh()
}
Next, implement the Laugh() function:
function Laugh()
{
	local playerEnt = null
	while ( playerEnt = Entities.FindByClassname( playerEnt, "player" ) )
	{
		if (playerEnt.IsSurvivor() )
		{
			// fire entity IO at "!activator" and pass the player ent as the activator
			EntFire( "!activator", "SpeakResponseConcept", "PlayerLaugh", 0, playerEnt )
		}
	}
}
Time to test! Fire up the game and load any coop map. Be sure to load with the Laughtrack mutation enabled (e.g., from the console type "map c5m2_park laughtrack" to load c5m2_park with the laughtrack mutation) Find a boomer (or type z_spawn boomer in the console to create one) and verify that your function gets called when the boomer explodes.
Category: Left 4 Dead 2Category: Level Design
Left 4 Dead 2/Scripting/Expanded Mutation System/Appendix: System VScripts

__NOTOC__ 
----
= VScript files that are part of the Mutation System =
Here lies a list of all VScript files that are now used by the Mutation System. Because the game depots ship with compiled versions of these files, the originals have been provided for reference purposes as part of the SDK. Launch the Left 4 Dead 2 Authoring Tools depot and select Example Content.
* The Core Systems code, and helpers 
** scriptedmode.nut - the master system file where most C++ calls land, and that calls to rest of system 
** sm_spawn.nut - helper code that manages spawning entities, name fixup in entity interfaces, and so on 
** sm_stages.nut - helper code to take a table that defines a "stage" of director options and sets them up 
** sm_utilities.nut - misc utilities of various forms 
** sm_resources.nut - the "resource" system, used heavily in holdout - an example of a shared system 
* scripted_holdout.nut - the holdout game mode
* and then all the holdout map specific scripts 
** scripted_c3m1_plankcountry_holdout.nut 
** scripted_c4m1_milltown_holdout.nut 
** scripted_c10m3_ranchhouse_holdout.nut 
** scripted_c10m5_houseboat_holdout.nut 
* scripted_dash.nut - the dash game mode
* and then all the dash map specific scripts 
** scripted_c5m2_park_dash.nut 
* entity scripts - i.e. that get placed on spawned entities 
** startbox.nut - script that sits on a startbox and waits for players to leave/calls back to notify scripts 
** whacker_counter.nut - helper for stachewhacker display 
** whacker_timer.nut - helper for stachewhacker 
** cash_resource.nut - placed on cash piles in pvpcash for players to gather 
** dash_waypoint.nut - a script on dash waypoints to note if players come near, trigger continuing 
** holdout_resource_package.nut - the resource backpack that drops / can be found in holdout 
** holdout_searchlight.nut - manages the generator/searchlight you put gas into @todo: rename to generator? generalize? 
* spawn managers and other helpers for various specific game systems (@TODO: standardize naming!) 
** tank_spawn_manager.nut 
** witch_spawn_manager.nut 
** gascan_manager.nut 
** holdout_gascan_manager.nut 
* helicopters/balloons/other flying entities... 
** rescue_helicopter.nut 
** resupply_helicopter.nut 
** resupply_balloon_spawn_manager.nut 
* Sanitize Data for various maps 
** sanitize_c3m1_plankcountry.nut 
** sanitize_c4m1_milltown.nut 
** sanitize_c10m3_ranchhouse.nut 
** sanitize_c10m5_houseboat.nut
Category: Left 4 Dead 2Category: Level Design
Left 4 Dead 2/Scripting/Expanded Mutation System/Appendix: Table Save Restore

__NOTOC__ 
== Saving and Restoring Tables across Map Transitions ==
The following functions can be used to save and restore table data across level transitions, round restarts, or team swaps:
* SaveTable( string, table ): Stores a table in a location that will persist across level transitions, round restarts, or team swaps. The first parameter is a string that is used to identify the table. The second parameter is the table to save.
* RestoreTable( string, table ): Retrieves a table from storage. The first parameter is a string that identifies the table you wish to retrieve. The second parameter is the destination for the restored data.
The game mode pvprace illustrates how the feature is used to save race times across level transitions and team swaps.
NOTE: When we say TABLE, we mean TABLE - this serializes to memory as key/value pairs, and thus an array is turned into a table with keys 0,1,2,etc and each key's value is the array entry. So really, you probably want to use this with tables only, and tables within tables, etc.
NOTE: When you exit the game and restart it, all this data goes away. This is all for within a single run
== Saving and Loading Strings to Disk ==
This is a very remedial system to allow you to store strings out to disk and load them back, primarily for doing simple stats or high score lists and so on. It is _very_ basic.
* StringToFile( file, string ): Stores the string into the file
* FileToString( file ): Returns the string from the file, null if no file or file is too big.
The Scoring_* functions in sm_utilities.nut have some examples of using this to do a very simple top 4 score list, which you can use as an example, or just use in full if you prefer.
NOTE: This is stored on the SPECIFIC SERVER FOR THE SESSION - so your high scores or character data or other cool info will not stay with you as you move between servers.
Category:Left_4_Dead_2Category:Scripting
Left 4 Dead 2/Scripting/Expanded Mutation System/Getting Started

__NOTOC__ 
== What do I need to get started? ==
In order to get the new Mutation System you will need to install the latest version of Left 4 Dead 2 on Steam. 
After installing Left 4 dead 2 install the Left 4 Dead 2 Authoring Tools 
== Creating Necessary Folders ==
AFTER you install Left 4 Dead 2 Beta you'll need to create a couple of folders before you can start working with the examples or building your own mutations.
 <Your Steam Folder>\steamapps\common\Left 4 Dead 2 Beta\left4dead2\modes
 <Your Steam Folder>\steamapps\common\Left 4 Dead 2 Beta\left4dead2\scripts\vscripts
== How do I launch the game and use the new Mutation System? ==
To use the new mutation system just run Left 4 Dead 2 as you normally would. When you select Mutations from the main menu you will be presented with a list of mutations to play. 
Tip: If you are developing your own mutation you may want to add developer launch parameters to your game like: -dev -sw -width 1680 -height 1050 -console -toconsole
== How do I play a Mutation in a specific map via the console? ==
To load a map and start a Mutation you can use the map command with the first parameter being the map name and the second parameter the name of the Mutation you wish to run. 
For example if you created a new Mutation named "mymutation" and want to play your mutation in the map 'c5m2_park' you would launch the map with this console command:
 map c5m2_park mymutation
and your map would load and start playing the 'mymutation' Mutation.
== What new Mutations are available in this release? ==
In addition to prior mutations, a few new Mutations are available in this version of Left4Dead2 which demonstrate what is now possible with the Mutation System:
dash - players must touch a series of waypoint poles spread throughout a map while under attack by infected. 
*supported maps: c5m2_park, c5m4_quarter
holdout - a 4 player COOP Mutation where players can defend a stronghold against waves of infected. Players signal a rescue helicopter by powering a spotlight with a steady supply of scavenged gas cans. 
*supported maps: c10m3_ranchhouse (training), c3m1_plankcountry, c10m5_houseboat, c4m1_milltown_a
== Hands-On Tutorial Mutations ==
This wiki includes complete, step-by-step instructions to walk you through authoring two basic Mutations:
simple - A very simple Mutation set in c3m3_plankcountry, covered in this tutorial. 
gnomehunter - Find and rescue Gnome Chompski. Implementation of this Mutation is covered in this tutorial
Category:Left_4_Dead_2Category: Level Design
Left 4 Dead 2/Scripting/Expanded Mutation System/GnomeHunter tutorial 1

__NOTOC__ 
== How To Use This Tutorial ==
In this tutorial we're going to create a new Mutation called GnomeHunter. We'll base GnomeHunter in the Park map from the Parish campaign (map c5m2_park) and will be building on some of the steps in the previous tutorial, such as how to use the Entity Placement Tool and how to spawn the Survivors in a different spot. You should complete the 'simple' Mutation tutorial before attempting to build GnomeHunter!
This tutorial also requires the use of Hammer. If you do not have Hammer installed you can learn how to set it up from the SDK on this page: Hammer Manual Configuration. It will not be necessary to compile a BSP from Hammer but you will need to be able to create and change properties on an entity and save it as a .VMF.
This tutorial is broken up into multiple steps with each completed step resulting in a VScript that you can load and run to see your progress.
NEXT -->
Category:Left_4_Dead_2Category:TutorialsCategory:Scripting