L4D2 Vscripts

From Valve Developer Community
Revision as of 18:37, 10 February 2010 by ThaiGrocer (talk | contribs) (Started adding vscript information provided by Phil Co)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Left 4 Dead 2 L4D2 vscripts are scripts that can be run in-game to perform various tasks and changes. Some uses of vscripts include

  • Mini-games found in Dark Carnival
  • Scavenge finale logic, such as respawning and re-highlighting gas cans
  • Director manipulation, such as onslaughts
  • Model manipulation, such as diesel cans attached to survivors
  • Prohibition of boss infected (tanks and witches)
  • Much more!

The file extensions of vscripts are .nut and .nuc, where .nut files are human readable using a text editor. Official .nuc script files are located in left4dead2/scripts/vscripts within pak01_dir.vpk (you can open this file with third party programs like GCFScape).

Some entities that accept vscripts as inputs or properties include info_director, logic_script, and trigger_finale.

Note.png Note: There is currently little information on vscripts. Descriptions and information are subject to change.

Scripting Samples

Some General DirectorOptions

You can start a script with an input to the director "BeginScript" and then the name of the script in the parameters field. Place the script as a ".nut" file in your vscripts directory. To end the script, send an input to the director "EndScript".

Here are some examples:

DirectorOptions <-
ProhibitBosses = 1 (default is 0)
AlwaysAllowWanderers = 1 (default is 0)
MobMinSize = 10 (default)
MobMaxSize = 30 (default)
SustainPeakMinTime = 3 (default)
SustainPeakMaxTime = 5 (default)
IntensityRelaxThreshold = 0.9 (default)
RelaxMinInterval = 30 (default)
RelaxMaxInterval = 45 (default)
RelaxMaxFlowTravel = 3000 (default)
SpecialRespawnInterval = 45.0 (default)
NumReservedWanderers = 10 (default is 0)

You can play around with some of these numbers for specific events in your levels. For example, some of our scripts reduce the SpecialRespawnInterval to 30 seconds or we have some that reduce the RelaxMaxFlowTravel to 1000 so that the director won't stay relaxed if the survivors have continued far enough.

Some Scavenge Finale DirectorOptions

Part of the script of Scavenge-type finale found in the last map of Dead Center.

DirectorOptions <-
PreferredMobDirection = SPAWN_LARGE_VOLUME
PreferredSpecialDirection = SPAWN_LARGE_VOLUME
ShouldConstrainLargeVolumeSpawn = false
MobSpawnMinTime = 45
MobSpawnMaxTime = 90
CommonLimit = 15
ZombieSpawnRange = 3000

External links

See also