Mutation Gametype

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)

Stub

This article or section is a stub. You can help by expanding it.

Introduction

SquirrelLeft 4 Dead 2 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

Note.pngNote:Not all cvars will "work" and will need testing
Note.pngNote:Only one mode definition is allowed per file
Icon-Bug.pngBug:When starting local server while having sv_cheats 1 active all cheat flagged cvars are reset to default values even those that were set in mode file. Since -dev launch option starts the game with sv_cheats 1 be aware of it when testing stuff.  [todo tested in?]
Warning.pngWarning:info_gamemode On<mode> On<mode>PostIO outputs check the specified base so if you specify something else than coop, realism, versus, survival, scavenge none of its outputs will fire
"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

Documentations

Miscelleanous


External links