This article's documentation is for anything that uses the Source engine. Click here for more information.
This article's documentation is for Source 2. Click here for more information.

logic_script

From Valve Developer Community
Jump to: navigation, search

English (en)
... Icon-Important.png
class hierarchy
CLogicScript
CPointEntity
CBaseEntity
Source 1 editor sprite
Source 2 editor sprite

logic_script is a point entity available in all Source Source games since Left 4 Dead 2 Left 4 Dead 2. It is also available in Team Fortress 2 Team Fortress 2 and Mapbase Mapbase and it is the container for VScripts. In Left 4 Dead 2, for example, this entity is used extensively for the logic in "carnival games" found in the Dark Carnival campaign, such as Peanut Gallery, Strongman Contest, Whack-a-Stach, etc.

KeyValues

Key (?) Variable Source (?) Property Name Default Value Description
Group00 to Group15 <targetname> EntityGroup[0] to EntityGroup[15]
Entities to add in the EntityGroup array for the script.
vscripts <scriptlist> Entity Scripts
(in all games since Left 4 Dead 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
thinkfunction <string> Think function
(in all games since Left 4 Dead 2)
Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Avoid expensive operations in this function, as it may cause performance problems.

Inputs

RunScriptFile <script> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Icon-Bug.pngBug:In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.
Fix: Remove the string argument manually with a text editor.
Note.pngNote:Team Fortress 2 Backtick characters ` are replaced with quotation marks at runtime, allowing quotation marks to be used when normally not possible.
CallScriptFunction <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2) !FGD
Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope  (only in Team Fortress 2) !FGD
Destroys the script scope of the receving entity.

See also

External links