Left 4 Dead 2/Scripting/Mutation Gametype

== Introduction ==
 With the "Expanded Mutation System" update, game modes are now handled via individual gamemode definition files. This gives a convenient way to create additional game mode entries that are based off the main four: coop, realism, versus, and scavenge, as well as brand new modes with advanced custom scripting.
Legacy mutations using the L4D2 Gamemodes File gamemodes.txt can still be used, but only one add-on can be active at a time.
Important aspects of mutations:
*A mutation is a modified game mode that mainly consists of modified cvars and a mutation vscript.
*A mutation name is the game mode entry name set in the mode definition file.
*All mutations can be loaded via the main menu GUI, but can also be loaded via console map <map name> <game mode name> Examples: map c1m1_hotel mutation13 or map c1m1_hotel survival
*Cvars are placed in a game mode definition.
*A vscript of the same name (<game mode name>.nut) is also loaded to complete additional tasks. For example, it may contain a function to replace weapons. Map-specific vscripts (<mapname>_<game mode name>.nut) are also loaded.
==Example game mode definition file==
The definition files are added as \left 4 dead 2\left4dead2\modes\<modename>.txt
For a list of nearly all of the available cvars in L4D2, please see List of L4D2 Cvars
"my_example_mode" // Name of the game mode and also the name of the vscript that will automatically load when a game mode is started, either via console or GUI.
{
	"base"				"none" // Game mechanics are inherited from this mode. It can be coop/versus/survival/scavenge/realism or an other mutation. It can also be "none" for novel game modes.
	"maxplayers" 		"4" // Set the number of players allowed. Allowed values are 1, 4 and 8.
	"hasdifficulty"			"1" // Sets if difficulty is allowed and if it's displayed next to the mutation name in the lobby screen. (Optional/Partially inheritable)
	"singlechapter"			"1" // Checks if there is only one level (Used in Survival/Scavenge). (Optional/Inheritable)
	"playercontrolledzombies"	"1" // Allows/Disallows players to control infected. Setting it to 1 also changes the maximum number of specials to 4 and disables pills conversion.
	"hasroundlimit"			"1" // Has rounds? (Optional/Inheritable)
	// These settings control how the mode is displayed in the Mutations menu.
	"DisplayTitle"			"Example Gamemode!"
	"Description"			"Shown in the main mutation selection screen (list)."
	"ShortDescription"		"Shown next to the mutation name below the main menu square."
	"Author"			"Me!"
	"Image"				"vgui/my_thumbnail_material" // Normally 512 x 256 pixels
 
	// This is the part where cvars can be added to alter the game mode, this allows hidden cvars as well.
	convar 
	{ 
		pain_pills_decay_rate 0.27
		z_speed 500
	}
}
== Mutation vscript examples ==
For all of the official mutation vscripts see L4D2_Decrypted_mutations.
== See also ==
=== Intros ===
*VScript
*L4D2 VScripts
*L4D2 Gamemodes File
=== Documentations ===
*VSLib
*L4D2 Vscript Examples
*L4D2 Director Scripts
*L4D2 Script Functions
*Decrypted Mutation Vscripts
*L4D2 Level Design/Boss Prohibition
*Custom Finales Contains all original finale scripts as reference.
*Extended Mutation System
*Left 4 Dead 2 Tool Updates
=== Miscelleanous ===
*logic_script
*trigger_finale
*info_director
*List of L4D2 Cvars
== External links ==
*Custom Mutations Tutorial (Steam Forums - Wayback Machine archive)
*"All Mutations Unlocked" (Steam Forums)
Category:Left_4_Dead_2
Category:Scripting