Point script template: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(point_script_template difference vs point_template)
No edit summary
 
(17 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{l4d2 point|point_script_template}} It is [[point_template]], but with internal elements of it readjusted for [[VScript|scripting]]. point_template relies on the map file to function properly; Trying to spawn entities with point_template created by scripts will return that it has no templates, though it will still delete its own template entities. One can work with this as if they're working on a point_template entity.
{{Ent not in fgd|nolink=1|because=[[point_template]] already is an accessible option}}


When [[L4D2_EMS/ConfigureHammerForEntityGroupCompilation|compiling Entity Groups]], point_template entities are converted to point_script_template.  
{{CD|CPointScriptTemplate|file1=1}}
{{this is a|point entity|name=point_script_template|game=Left 4 Dead 2}} It is also available in {{tf2branch|4}}.
It is a version of [[point_template]] readjusted to work for spawning-on-runtime, such as VScripts.


== Keyvalues ==
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.
{{KV|Template 1|to=Template 16|target_destination| [[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.}}
{{KV Targetname}}


== Flags ==
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.
* 1 : Don't remove template entities - Prevent entities part of the templates being removed automatically.
See the [[Team_Fortress_2/Scripting/Script_Functions#CPointScriptTemplate|VScript documentation]] for details on usage.
* 2 : Preserve entity names (Don't do name fixup) -  Disregard renaming entities to have a number postfix. See [[point_template#Flags|point_template flags]] for more info.


== Inputs ==
When [[L4D2_EMS/ConfigureHammerForEntityGroupCompilation|compiling Entity Groups]],<code>point_template</code> entities are converted to<code>point_script_template</code>.  
{{IO|ForceSpawn|Spawn an instance of the template at the original position.}}
{{I Targetname}}


== Outputs ==
{{OtherKIO|point_template|All}}
{{IO|OnEntitySpawned|Fired after spawning an instance of this template.}}
 
{{O Targetname}}
== Vscript functions ==
{| class=standard-table style="width: 100%;"
! Function
! Signature
! Description
|-
|<code>AddTemplate</code>
|<code>void AddTemplate(string ''classname'', handle ''keyvalues'')</code>
|Add an entity to the template spawner with the specified classnames (similar to <code>SpawnEntityFromTable</code>}
|-
|<code>SetGroupSpawnTables</code>
|<code>void SetGroupSpawnTables(handle, handle)</code>
|Cache the group spawn tables.
|}


== See also ==
== See also ==
* [[List_of_L4D2_Script_Functions#CPointScriptTemplate|CPointScriptTemplate VScript Functions]]
* [[point_template]] - Non-script version of this entity
* [[List_of_L4D2_Script_Functions#CPointTemplate|CPointTemplate VScript Functions]]
* [[Left 4 Dead 2/Script Functions#CPointScriptTemplate|CPointScriptTemplate VScript Functions]]
* [[Left 4 Dead 2/Script Functions#CPointTemplate|CPointTemplate VScript Functions]]
 
<!-- for cats not added by {{this is a}} template -->
[[Category:Team Fortress 2 entities]]
[[Category:Team Fortress 2 point entities]]

Latest revision as of 01:06, 24 April 2025

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
C++ point_template.cpp

point_script_template is a point entity available in Left 4 Dead 2 Left 4 Dead 2. It is also available in Team Fortress 2 branch Team Fortress 2 branch. 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.

Note.pngNote:All Keyvalues / Inputs / Outputs are same as point_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.

See also