Mutation Gametype (L4D2)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

For a list of nearly all of the available cvars in L4D2, please see List of L4D2 Cvars

Note: Not all cvars will "work" and will need testing
Note: Only one mode definition is allowed per file
"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.
"singlechapter"			"1" // Checks if there is only one level (Used in Survival/Scavenge).
"playercontrolledzombies"	"1" // Allows/Disallows players to control infected.
"hasroundlimit"			"1" // Has rounds?

// These settings control how the mode is displayed in the Mutations menu.
"DisplayTitle"			"Example Gamemode!"
"Description"			"An example mode to demonstrate the mutation system."
"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