Logic script: Difference between revisions
Jump to navigation
Jump to search
Note:For other vscript keyvalues notable for this entity like vscripts, thinkfunction and inputs like RunScriptCode, CallScriptFunction see Generic Keyvalues, Inputs and Outputs
(hl2dm now has this entity after the anniversary update (switched to tf2 "subbranch" of source 2013)) |
m (oops, remove extra period) |
||
Line 5: | Line 5: | ||
[[File:Logic_script_src2.png|left|Source 2 editor sprite]] | [[File:Logic_script_src2.png|left|Source 2 editor sprite]] | ||
{{this is a|point entity|name=logic_script|since=Left 4 Dead 2}} | {{this is a|point entity|name=logic_script|since=Left 4 Dead 2}} It is also available in {{tf2|4}}, {{hl2dm|4}} and {{mapbase|4}}. | ||
This entity functions as a container for [[VScript]]s. In Left 4 Dead 2, for example, it 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. | This entity functions as a container for [[VScript]]s. In Left 4 Dead 2, for example, it 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. |
Revision as of 11:50, 26 November 2024
![]() |
---|
CLogicScript |
logic_script
is a point entity available in all Source games since
Left 4 Dead 2. It is also available in
Team Fortress 2,
Half-Life 2: Deathmatch and
Mapbase.
This entity functions as a container for VScripts. In Left 4 Dead 2, for example, it 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
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- EntityGroup[0] (Group00) to EntityGroup[15] (Group15) <targetname>
- All specified entity names will be searched for upon this entity spawning and their script handles are added to an array named
EntityGroup
inlogic_script
's script scope.EntityGroup[0]
contains handle of entity with name specified in EntityGroup[0] property etc. If multiple entities with the given named exists, handle of first found will be used. - Table
MyEntityGroup
is also created which contains the handles with keys being the names. (for some reason there is alsoMyEntityGroupArray
which is same asEntityGroup
)
The following vscript is run in logic_script scope when it spawns. EntityGroup <- [];
MyEntityGroup <- {};
MyEntityGroupArray <- EntityGroup;
function __AppendToScriptGroup( name )
{
if ( name.len() == 0 )
{
EntityGroup.append( null );
}
else
{
local ent = Entities.FindByName( null, name );
EntityGroup.append( ent );
if ( ent != null )
{
ent.ValidateScriptScope();
MyEntityGroup[name] <- ent;
ent.GetScriptScope().EntityGroup <- EntityGroup;
}
}
}
|

See also
External links
- It's the vscripting documentation FAQ! (Steam Forums)
- Scripting for Left 4 Dead 2 (Leeland.net) - Example uses of logic_script