point_template
point_template is a point entity available in all Source games. It turns an entity, or set of entities, into a single template that can be instanced anywhere, and multiple times.


If there are interdependencies (entity I/O, hierarchy, or other name references) between the entities in the template, the entities in the template will have their names changed and the interdependencies will be reconnected to the changed names. The name change format is as follows: '<original name>&0000', where the 0000 will be replaced with the current global template instance, so wildcard searches for '<original name>*' will still find them.
If you don't want the name fixup to happen, because you're only spawning the template once, or you want inputs to trigger all instances of the template, check the 'Preserve entity names' spawnflag.
When activated, this entity will spawn the entities in the template at the same positions, relative to this entity, that they had when this entity was created. This will be their original positions if the point_template has not been moved.
To spawn the template in other places, an env_entity_maker can be used.
Notes on name fixup
Name fixing is only performed on the outputs of template entities (the entities being spawned). The outputs of the point_template are not fixed, and neither are the outputs of other objects referring to template entities.
The special targetnames (see the targetname article) work on spawned objects, so a trigger_multiple with an output to !activator
can be used to effect individual spawned objects. Wildcards can refer to all entities spawned by a fix-up-enabled point_template.
With fixup on, the first entity spawned will be named with &0002
. If the Do not remove template spawnflag of the point_template is enabled, the unremoved template entity will have its name fixed with number &0001
.

Tutorial
A tutorial has been created for respawning items using this entity.
Keyvalues
- Template 1 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.
Targetname:
- Name
<string>
- The targetname that other entities refer to this entity by.
- Entity Scripts
<scriptlist>
(New with 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.
- Script think function
<string>
(New with Left 4 Dead 2) - Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call.
Note:Try to avoid expensive operations in this function, as it may cause performance problems.
Flags
- 1 : Don't remove template entities
- By default, a point_template will first remember all of its template entities, then it will kill them (remove them from the map completely). This flag overrides that, leaving the template entities in the map.
- 2 : Preserve entity names (Don't do name fixup)
- Causes the spawned entities to be named exactly as their templates were (as opposed to renamed; see above).
Inputs
-
ForceSpawn
- Spawn an instance of the template at the original position.
Targetname:
-
Kill
- Removes this entity and any entities parented to it from the world.
-
KillHierarchy
- Functions the same as
Kill
, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKill
. -
AddOutput
<string>
- Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format:<key> <value>
Format:<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
-
FireUser1
toFireUser4
- Fire the
OnUser
outputs; see User Inputs and Outputs. -
Use
!FGD - Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs. -
RunScriptFile
<script>
(New with Left 4 Dead 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>
(New with Left 4 Dead 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.
Bug: In
, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
-
CallScriptFunction
<string>
(New with Left 4 Dead 2) !FGD - Execute a VScript function in the scope of the receiving entity.
-
SetLocalOrigin
<coordinates>
(New with Alien Swarm) !FGD - Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
-
SetLocalAngles
<angles>
(New with Alien Swarm) !FGD - Set this entity's angles.
Outputs
-
OnEntitySpawned
- Fired after spawning an instance of this template.
Targetname:
-
OnUser1
toOnUser4
- These Outputs each fire in response to the firing of the like-numbered
FireUser1
toFireUser4
Input; see User Inputs and Outputs. -
OnKilled
(Only in the Left 4 Dead series) - This Output fires when the entity is killed and removed from the game.
See also
- env_entity_maker - automatic respawning and/or spawning at a different location - and npc_maker - an alternative spawning entity, also with optional automatic respawning.