Point script template: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Updated old entity format to {{this is a}}. This action was perfomed by a bot.)
(Document behavior)
Line 7: Line 7:
The<code>point_template</code>entity relies on compiled data from the map file to function properly, so trying to spawn entities with a<code>point_template</code>made by scripts will return it having no templates and fail, even though it still can delete its own template entities.
The<code>point_template</code>entity relies on compiled data from the map file to function properly, so trying to spawn entities with a<code>point_template</code>made by scripts will return it having no templates and fail, even though it still can delete its own template entities.


This entity is identical to<code>point_template</code>, so things like name fixup behavior quirks should still be taken into account.
This entity is similar to to<code>point_template</code>, however it does NOT have precaching or name fixups. The number of templates is unlimited unlike <code>point_template</code>, although they can only be added by the <code>AddTemplate</code> function.
See the [[Team_Fortress_2/Scripting/Script_Functions#CPointScriptTemplate|VScript documentation]] for details on usage.


When [[L4D2_EMS/ConfigureHammerForEntityGroupCompilation|compiling Entity Groups]],<code>point_template</code> entities are converted to<code>point_script_template</code>.  
When [[L4D2_EMS/ConfigureHammerForEntityGroupCompilation|compiling Entity Groups]],<code>point_template</code> entities are converted to<code>point_script_template</code>.  


== Vscript functions ==
== Vscript functions ==
{{todo|explain more}}
{| class=standard-table style="width: 100%;"
{| class=standard-table style="width: 100%;"
! Function  
! Function  
Line 19: Line 19:
|-
|-
|<code>AddTemplate</code>
|<code>AddTemplate</code>
|<code>void AddTemplate(string, handle)</code>
|<code>void AddTemplate(string ''classname'', handle ''keyvalues'')</code>
|Add an entity to the template spawner.
|Add an entity to the template spawner with the specified classnames (similar to <code>SpawnEntityFromTable</code>}
|-
|-
|<code>SetGroupSpawnTables</code>
|<code>SetGroupSpawnTables</code>
Line 30: Line 30:
{{KV Targetname}}
{{KV Targetname}}
{{KV PointTemplate}}
{{KV PointTemplate}}
== Flags ==
{{Fl PointTemplate}}


== Inputs ==
== Inputs ==

Revision as of 12:05, 1 February 2024

Icon-NotInFGD.png
This entity is not in the FGD by default.
It should not be put directly in a map because point_template already is an accessible option.
C++ Class hierarchy
CPointScriptTemplate
CPointTemplate
CLogicalEntity
CServerOnlyEntity
CBaseEntity

point_script_template is an e0 available in Left 4 Dead 2 Left 4 Dead 2. It is also available in Team Fortress 2 Team Fortress 2. It is a version of point_template readjusted to work for spawning-on-runtime, such as VScripts.

Thepoint_templateentity relies on compiled data from the map file to function properly, so trying to spawn entities with apoint_templatemade by scripts will return it having no templates and fail, even though it still can delete its own template entities.

This entity is similar to topoint_template, however it does NOT have precaching or name fixups. The number of templates is unlimited unlike point_template, although they can only be added by the AddTemplate function. See the VScript documentation for details on usage.

When compiling Entity Groups,point_template entities are converted topoint_script_template.

Vscript functions

Function Signature Description
AddTemplate void AddTemplate(string classname, handle keyvalues) Add an entity to the template spawner with the specified classnames (similar to SpawnEntityFromTable}
SetGroupSpawnTables void SetGroupSpawnTables(handle, handle) Cache the group spawn tables.

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Template 1 (Template01) to Template 16 <targetname>
Targetname(s) to search for entities to template. These can be exact matches, or wildcards (*). If multiple entities are matched, all entities will be included in the template.


Inputs

ForceSpawn
Spawn an instance of the template at the original position.


Outputs

Template:O PointTemplate

See also