nyuuzyou/wikis huggingface dataset:
Left 4 Dead 2/Scripting/Expanded Mutation System/GnomeHunter tutorial 8

__NOTOC__
== Message Tickers ==
The Mutation System allows you to display messages on the HUD for players. If your Mutation's VScript supplies a function called SetupModeHUD() the Mutation System it will call it when your Mutation starts up.
Inside SetupModeHUD() you can create a table with some information about your HUD and then use HUDLoadLayout( table ) to load it:
// HUD setup
function SetupModeHUD( )
{
	ModeHUD <-
	{
 Fields =
 {
		gamename = { slot = HUD_MID_TOP, name = "mutation_name", dataval = "Gnome Hunter!" }
 }
	}
	// load the ModeHUD table
	HUDSetLayout( ModeHUD )
}
In addition to displaying strings you can display variables. In this case we're just displaying the title "Gnome Hunter!" but we could also display other information like how many infected we've killed.
@@@TODO: more detail on hud slots, data types, scope [id actually say we have that detail in the appendix... what we should do here is have 1 dynamic element so we can show how that works]
You can also display any text string on the screen as a message ticker. Add the Ticker_AddToHud() function call inside your SetupModeHUD() function:
// Set up a message ticker that will be displayed below the Mutation's HUD
Ticker_AddToHud( ModeHUD, "Find the gnome! (Hint: it is glowing green)" )
Now go back to GetNextStage() and use the the Ticker_NewStr() function to customize the ticker message for each stage of gameplay:
// SECOND_STAGE ticker - display ticker string based on gnome state
Ticker_NewStr( "Here come the infected! Defend yourselves!" )
// THIRD_STAGE ticker
Ticker_NewStr( "Phew... you cleared out all the infected." )
// FOURTH_STAGE ticker
Ticker_NewStr( "You saved the gnome! Good job. Resetting..." )
You can also display a string when the gnome is picked up. Place this ticker call inside GnomePickedUp():
Ticker_NewStr("Take the gnome to the locker up the stairs!")
In GnomeDropped(), remind the Survivors to pick it up again:
Ticker_AddToHud( ModeHUD, "Pick up the gnome! (Hint: it is glowing green)" )
And one more for when the gnome is placed in the locker. Add this inside the slow poll where the gnome kill() method is called:
// Display some ticker text confirming the rescue of the gnome
Ticker_NewStr("You saved the gnome! Kill all remaining infected to win!")
What next?
NEXT -->
Category:Left_4_Dead_2Category:ScriptingCategory: Tutorials
Left 4 Dead 2/Scripting/Expanded Mutation System/GnomeHunter tutorial 9

__NOTOC__
Now you have finished writing a complete Mutation using VScript, you may want to keep practicing before starting your very own Mutation.
== Suggestions for expanding GnomeHunter ==
Here are some things you can try now that you have a basic version of GnomeHunter implemented:
== Mixing up the gnome spawn rules ==
*Try adding more gnome spawn points. Your Mutation will automatically spawn one gnome per point if you simply add more spawn points.
**If you add more gnomes try changing your win condition to collecting all the gnomes, not just one gnome
**You can also try adding multiple spawn points but only spawning one gnome. In order to do so, you'll have to change your ModeSpawns entry to include SPAWN_FLAGS.NOSPAWN for your gnome Entity Group, like so:
	["GnomehunterGnome", <...> SPAWN_FLAGS.NOSPAWN]
Then you'll want to manually spawn your gnome using this pattern:
	// get the entity group
	local gnomeEntityGroup = GetEntityGroup( "GnomehunterGnome" )
	// set the spawn point name (the map can contain multiple entities with this name)
	gnomeEntityGroup.SpawnPointName <- "gnome_spawn"
	// spawn a single gnome 
	SpawnMultiple( gnomeEntityGroup , { count = 1 } )
NOTE: You can read more about SpawnMultiple and other ways to spawn entity groups here: Appendix:Spawning
== Changing the locker rules ==
*Add multiple lockers to your Mutation
*Make the lockers start glowing with EntFire inputs when you approach with the gnome
*Change the locker so it will start glowing, but not open until some amount of time has passed with the gnome being nearby
*Make storing the gnome in the locker spawn guns or items (boxes of fireworks!) as a reward
== Locker revisions ==
*Add a push brush to the locker to prevent the gnome from interpenetrating the model until it opens
**Add the push_brush in hammer, and then when the locker spawns search around the locker model in a very small radius for a push brush with a specific name. Then you can enable and disable it when the locker opens and closes.
*Change the locker to use the models from the Dark Carnival map, or another model that has a collision model. Add a trigger and change the gnome detection method to be trigger based instead of script based.
== Changing the escape conditions ==
*After storing the gnome in the locker have the player fulfill another condition to win
**Perhaps the players must defeat a wave of special infected before winning
**Have the players return to their starting place at the gazebo, or another point in the map before triggering the win. Use the message ticker or glowing props to guide the player to their goal.
**Create a huge panic wave of 1000 infected and instruct the player to mow them all down to win! Display the updated kill count and goal count on the HUD.
Category:Left_4_Dead_2Category:ScriptingCategory: Tutorials
Left 4 Dead 2/Scripting/Script Functions/AddThinkToEnt

Turns a function of an entity's script into a think function, which then the function automatically calls itself in an interval set by number returns if they exist, otherwise the sv_script_think_interval cvar is used (0.1 seconds by default). There can only be one think function for each entity at a time, so you can't chain think functions.
To remove think functions, call this function with null as an argument under the funcname parameter. See this sub-section of the Entity Scripts page to know more about think functions.
__TOC__
== Parameters ==
void AddThinkToEnt(CBaseEntity entity,string funcname)
Type 	Name 	Description
CBaseEntity	entity 	Target entity to be applied a think function.
string 	funcname	Given the string, find the function of the exact same name (no brackets allowed!). Passnullto remove it.
== Code Samples ==
=== Fastest Rethink Rate ===
When ran, an info_target will be spawned with a think function that automatically uses the fastest possible rethink rate (that's capped). The think function uses ClientPrint() and fills the chatbox about how long the game has been running. When it has sent the messages 30 times, the entity will then delete itself, thus halting the think function.
Since runs on 30 ticks by default, think functions can never run faster than 0.03333... seconds. See this sub-section of the Entity Scripts page to know more about think functions.
=== Survivor Health Decay ===
This script applies a slow think function onto all players, which will then slowly decay their normal health, and turn it into temporary health. It also implements a buffer system, a period where health decay attempts will not be allowed.
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Script Functions/ClientPrint

== Function Description ==
 void ClientPrint(CTerrorPlayer player, int destination, string message) 
Print a client message. If you pass null instead of a valid player, the message will be sent to all clients.
Printing to the chat box supports using a limited amount of color codes for custom colors. To use them add the characte before the colored text, either as a \x escape code into the string, or as a char with the integer value.
== Parameters ==
Type 	Name 	Description
CTerrorPlayer	player 	The handle of the player who receives the message or null for everyone.
int 	destination	The destination to print to. See Print Destinations for a list of destinations.
string 	message 	The message to print.
== Example ==
function ConsolePrint()
{
	// Print a chat message visible to everyone
	ClientPrint(null, DirectorScript.HUD_PRINTTALK, "\x03" + "Hello everyone!")
	local player = null
	
	// Iterate through every player
	while(player = Entities.FindByClassname(player, "player"))
	{
		// Only print to human controlled survivors and special infected
		if(!IsPlayerABot(player))
		{
			// Print a personalized chat message for the player
			ClientPrint(player, DirectorScript.HUD_PRINTTALK, "\x04" + "Hello " + "\x05" + player.GetPlayerName())
		}
	}
}
ConsolePrint()
== Print Destinations ==
These are the destinations that can be printed to.
Enumeration 	Value	Description
HUD_PRINTNOTIFY 	1 	
HUD_PRINTCONSOLE	2 	Prints the message to console.
HUD_PRINTTALK 	3 	Prints the message to the chat box. Supports custom color codes.
HUD_PRINTCENTER 	4 	Prints the message to the center of the screen.
(Unknown) 	5 	
== Color Codes ==
Color 	Value
Beige (default color)	\x01
Bright green 	\x03
Orange 	\x04
Olive green 	\x05
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Script Functions/CommandABot

== Function Description ==
 bool CommandABot(table commandTable) 
Issues commands to bots based on a table configuration.
Survivor bots, special infected and common infected can be commanded. The bot's normal AI is disable while it is commanded, and it will blindly follow the command until a new command is issued.
== Parameters ==
Type 	Name 	Description
table	commandTable	Table for passing configuration paramters for the bot command.
== Returns ==
bool - Whether the command was valid. If the command failed, an error message will also be printed to console. 
== Example ==
Here is an example of how to create a table that commands all bots to run to position 0,0,0:
commands <-
{
	cmd = DirectorScript.BOT_CMD_MOVE
	pos = Vector( 0,0,0 )
}
----
CommandABot( commands )
// Alternatively, you could send the data inline, like so:
 CommandABot( { cmd = DirectorScript.BOT_CMD_MOVE, pos = Vector( 0,0,0 ) } )
== Input Parameters ==
Passed to the commandTable to set up the command.
Type 	Name 	Description
CTerrorPlayer or Infected	bot 	The bot to command. When set to null or not set, all bots are given the command.
int 	cmd 	The command enumeation. Required.
Vector 	pos 	Where to move in a BOT_CMD_MOVE command.
CBaseEntity 	target	The entity to attack in BOT_CMD_ATTACK or retreat from in BOT_CMD_RETREAT.
== Commands ==
Enumeration 	Value	Description
BOT_CMD_ATTACK 	0 	Force the bot to attack a specific target, even bypassingCTerrorPlayer::SetSenseFlags(DirectorScript.BOT_CANT_SEE). Only works on forcing Survivor Bots to attack player-controllable Special Infected, and vice versa.
BOT_CMD_MOVE 	1 	Force the bot to move to a specific location, which then they will do it unconditionally without performing any other AI behaviors controlled by themselves. This means that Survivor Bots and most player-controllable Special Infected won't attack anything when commanded, but Common Infected still automatically attack enemies if they close in enough.
BOT_CMD_RETREAT	2 	Force the bot to retreat from a target entity. Only work when used on Survivor Bots, and if target is a Tank.
BOT_CMD_RESET 	3 	Removes the active bot command and lets the AI resume controlling the bot.
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Script Functions/GetInvTable

== Function Description ==
 void GetInvTable(CTerrorPLayer player,table invTable) 
Fills invTable with the specified player's inventory. This function works on survivors and special infected.
== Parameters ==
Type 	Name 	Description
CTerrorPlayer	player 	Player who's inventory to get.
table 	invTable	Table for writing the inventory in.
== Example ==
// Prints a list of weapons each player is carrying
function PrintWeapons()
{
	local player = null
	
	// Iterate through every player
	while(player = Entities.FindByClassname(player, "player"))
	{
		printl("Player: " + player.GetPlayerName())
		
		// Add an empty table to store the inventory in
		local invTable = {}
	
		// Call the function to fill the table
		GetInvTable(player, invTable)
	
		// Check if the player has a primary weapon
		if("slot0" in invTable)
		{
			printl("Primary weapon equipped: " + invTable.slot0)
		}
		else
		{
			printl("Primary weapon not equipped!")
		}
	
		// Print all equipped weapons
		foreach(slot, weapon in invTable)
		{
			printl("\t" + slot + "= " + weapon.GetClassname())
		}
	}
}
PrintWeapons()
== Output Parameters ==
Keys written to invTable by the function. 
Type 	Key 	Description
handle	slot0	Primary weapon
handle	slot1	Secondary weapon
handle	slot2	Throwable
handle	slot3	Medkit/Defib
handle	slot4	Pills/Adrenaline
handle	slot5	Carried physics object (L4D style, e.g. Gas can or the Gnome)
handle	Held 	Carried physics object (legacy style, from CanPickupObject() or PickupObject() )
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Script Functions/TraceLine

== Function Description ==
 bool TraceLine(table traceTable) 
Does a raycast along a line specified by two vectors, returning the first entity or geometry hit along the way. Script version of UTIL_TraceLine().
== Parameters ==
Type 	Name 	Description
table	traceTable	Table used for both input and output.
== Returns ==
bool - Whether the trace is successful. This only indicates that the trace was done, not whether it hit anything.
== Example == 
traceTable <-
{
	start = Vector( 0,0,0 )
	end = Vector( 0,0,256 )
}
if(TraceLine(traceTable))
{
	if(traceTable.hit)
	{
		printl("Trace hit!")
	}
	else
	{
		printl("Trace missed!")
	}
}
else
{
	printl("Trace failed!")
}
== Input Parameters ==
Passed to the parameters table to set up the trace. The only required information to make the trace is providing the start and end point.
Type 	Name 	Description
Vector 	start 	Global vector where to start the trace.
Vector 	end 	Global vector where to end the trace.
int 	mask 	Optional collision type bitmask. Masks: TRACE_MASK_VISIBLE_AND_NPCS (default), TRACE_MASK_ALL, TRACE_MASK_VISION, TRACE_MASK_SHOT, TRACE_MASK_PLAYER_SOLID,
CBaseEntity	ignore	Optional entity to ignore when tracing.
== Output parameters ==
Output written by the function to the parameters table.
Type 	Name 	Description
Vector 	pos 	World space vector where the trace hit.
float 	fraction 	Fraction from the start to end where the trace hit.
bool 	hit 	Whether the trace hit something. Always present.
CBaseEntity	enthit 	Handle of the entity the trace hit.
bool 	startsolid	Whether the trace started inside something.
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Script Functions/ZSpawn

== Function Description ==
 bool ZSpawn(table spawnTable) 
Spawns a zombie. This is essentially the z_spawn console command, except (a) you pass a table and (b) no raycast, you give it the position vector.
== Parameters ==
Type 	Name 	Description
table	spawnTable	Table used for spawn parameters.
== Returns ==
bool - Whether the zombie spawned successfully.
== Input Parameters ==
Passed to spawnTable to set up the spawn parameters.
Type 	Name	Description
int 	type	Zombie type enumeration. ZOMBIE_WITCH, etc - or the special ZSPAWN_MOB, or WITCHBRIDE, etc.
Vector	pos 	Vector position at which to spawn, optional (defaults to automatically spawn somewhere in the world).
QAngle	ang 	Angle for spawn, optional (defaults to 0,0,0).
== Zombie types ==
: ZOMBIE_SMOKER = 1
: ZOMBIE_BOOMER = 2
: ZOMBIE_HUNTER = 3
: ZOMBIE_SPITTER = 4
: ZOMBIE_JOCKEY = 5
: ZOMBIE_CHARGER = 6
: ZOMBIE_WITCH = 7
: ZOMBIE_TANK = 8
: ZSPAWN_WITCHBRIDE = 11
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead 2/Scripting/Script Functions/rr ProcessRules

== Function Description ==
 void rr_ProcessRules(handle rulesArray) 
Processes the rulesArray table/array to a concept that is then added to the Response System. Will override any existing concepts.This is an incomplete implementation of custom talker concepts for VScript, but it is mostly functional.
These concepts will last until the next map load or change.
This can be an effective system for scripts to utilize, allowing you to create concepts for both custom and vanilla campaigns while having minimal conflicts with other talker files.
Beware though, some values like predelay may not be implemented.
== Parameters ==
Type 	Name 	Description
handle	rulesArray	The table/array to use for creating/overriding talker concepts.
== Example == 
// Create a new concept for Nick to say "Close the door!" as well as another different concept for Coach. This can then be used with the SpeakResponseConcept input for custom maps and scripts. The included scripts are required if you wish to make a followup function, otherwise they are unnecessary.
IncludeScript("response_testbed", null)
local newrules =
[
 {
 name = "TestCustomConceptGambler", // The name of the concept. This will override any other concept with the same name
 criteria = // Criteria
 [
 [ "concept", "CustomConcept" ], // Required. The name to be used by SpeakResponseConcept and other parts of the game
 [ "who", "Gambler" ] // Survivor name. Acts like IsGambler
 ],
 responses =
 [
 { scenename = "scenes/Gambler/CloseTheDoor01.vcd", },
 { scenename = "scenes/Gambler/CloseTheDoor02.vcd", }
 ],
 group_params = g_rr.RGroupParams({ permitrepeats = true, sequential = false, norepeat = false })
 },
 // Multiple tables can be fit into one array to process more than one concept with just one table!
 {
 name = "CoachWantsPancakesButGetsClownsInstead",
 criteria =
 [
 [ "concept", "CoachPancakeTalk" ],
 [ "who", "Coach" ]
 ],
 responses =
 [
 { scenename = "scenes/Coach/EllisInterrupt09.vcd", }, // I'm listening, but this better be about pancakes!
 { scenename = "scenes/Coach/ReactionNegative02.vcd", }, // What the-
 { scenename = "scenes/Coach/SeeClowns01.vcd", } // CLOWNS?!
 ],
 group_params = g_rr.RGroupParams({ permitrepeats = false, sequential = true, norepeat = false })
 },
 // This demonstrates the "followup" function to allow for chained responses.
 {
 name = "FollowupDemonstration",
 criteria =
 [
 [ "concept", "NickPouncedButEllisDontCare" ],
 [ "who", "Gambler" ]
 ],
 responses =
 [
 { scenename = "scenes/Gambler/ScreamWhilePounced01.vcd", followup = RThen( "mechanic", "PlayerLaugh", {additionalcontext="null"}, 0.1 ) } //This makes Ellis play the PlayerLaugh response 0.1 seconds after Nick's scene finishes.
 ],
 group_params = g_rr.RGroupParams({ permitrepeats = true, sequential = false, norepeat = false })
 },
]
// Add the concept
g_rr.rr_ProcessRules( newrules );
Category:Left 4 Dead 2
Category:Scripting
Left 4 Dead Level Creation

This page contains articles relating specifically to Level Design for Left 4 Dead.
For Left 4 Dead 2 level creation articles, see Left 4 Dead 2 Level Creation.
== Getting started ==
* Downloading and Installing the Left 4 Dead Authoring Tools
* Level Design Basics
* Your First Map
* Your First Left 4 Dead Map
* General Level Design documentation
== Tutorials ==
* Creating Add-ons
* Custom Music
* Soundscripts
* Panic Events
* Finale Events
* Versus Gametype
* Survival Gametype
* Custom Graffiti and Wall Writings
== Design Theory ==
* Left 4 Dead Design Theory
* Common Mapping Problems
* Mapping Notes
* Left 4 Dictionary
== Reference Information ==
* List of L4D Entities
* List of L4D Particles
* List of L4D Skyboxes
* List of L4D Soundscapes
* List of L4D Instructor Messages
* List of L4D Missions Files
== Navigation meshes ==
===General===
* Navigation Meshes
* Navigation Mesh Commands
===Left 4 Dead===
* nav_mode.cfg - Essential time-saving key binds for nav mesh editing, provided by Valve
* Navigation Meshes (Left 4 Dead)
* Left 4 Dead Infected Populations
* Advanced Nav Editing
* Sorting out navigation flow
== Other ==
* GCFscape (updated to extract vpk. files.)
* User projects
* Creating Server Plugins
== Sites ==
* Official Left 4 Dead Website
* GameMaps Website
__NOTOC__
Category:Level Design
Category:Tutorials
Category:Left 4 Dead
Left 4 Dead series

Left 4 Dead is a series of cooperative first-person shooter survival horror video games published by Valve. Set in the days after a pandemic outbreak of a viral strain transforming people into zombie-like feral creatures, the games follow the adventures of four survivors attempting to reach safe houses and military rescue while fending off the attacking hordes.
*
*
== See Also ==
* 
== External links ==
* on Wikipedia
Category:Series pages
Category:Left 4 Dead
Category:Left 4 Dead 2
Category:Left 4 Dead series
Level Design Introduction (Portal 2)/Getting Started

__NOTOC__
The first step is to launch Hammer, the map editor for Portal 2 and other Source games. 
Open the Steam window, and in the Library tab, open the dropdown above the search bar, and check the Tools checkbox and double-click Portal 2 Authoring Tools. Because there are a lot of tools available on Steam, your library can get a bit cluttered, so once you install Portal 2 Authoring Tools, you can click on the ready to play button to the right of the dropdown menu. This will hide all of the uninstalled tools.
If this is your first time launching the Authoring Tools, it will take a little time to download and install. 
Double-click Hammer World Editor to start the Hammer level editor. 
 
Once Hammer is loaded, you can start a new level by going to the New from the File menu. 
 
A new window with four editing areas should appear. 
 
 
 
== Hammer Editor interface layout ==
 
Here is a basic description of the Hammer interface. You will learn how to use these items throughout this tutorial, so don't worry about learning about how they all function quite yet. 
=== Map Views and Operations bars ===
These bars across the top of the window contain a variety of buttons to control the viewing of objects in the map, as well as controls for the grid and snapping tools. 
=== Tools bar ===
The Tools bar switches the editor to different modes that allow you to select, build, place, texture, and manipulate different objects in your level. 
=== Selection Mode box ===
The Selection Mode box switches between modes of selecting objects in the map: 
* Groups — You will select the whole sets of objects that have been grouped together. 
* Objects — You will select an entire object even if it consists of more than 1 component. 
* Solids — You will select individual components even if it has been joined with others to make one object.
=== Texture box ===
The Texture box allows you to see the currently selected texture and to browse for other textures by going into the Browse... button. 
=== Object box ===
Used to place objects in your level that are not simple geometry. While brushes are the basic building blocks of levels, entities placed with the Object box are pretty much everything else. You can place lights, props (models) and items using the Object box. 
=== VisGroups box ===
VisGroups are a way to organize your level. You can place any type of object into VisGroups and label them so that you can hide them or reveal them as a group. This allows you to see what you're working on in a much cleaner way than leaving everything visible. 
=== Status bar ===
The strip along on the bottom of the interface gives valuable information while you're editing, such as the size of the selected objects and the current grid settings. 
Category:Portal 2 Level Design