Point template: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(S_PreserveEnts cannot be instanced with point_template, tested in csgo)
(wow, yep. point_template calls MapEntity_ParseEntity which calls ShouldCreateEntity which checks if the entity is in s_PreserveEnts. they probably didn't intend for this limit to point_template or know about it.)
Line 4: Line 4:
{{base point|point_template}} It turns an entity, or set of entities, into a single template that can be instanced anywhere, and multiple times.
{{base point|point_template}} It turns an entity, or set of entities, into a single template that can be instanced anywhere, and multiple times.


{{note| In {{csgo}}, [[S_PreserveEnts]] cannot be instanced by this entity. ({{todo| Other games?}})}}
{{note|[[S_PreserveEnts]] cannot be instanced by this entity.}}
{{bug| In {{csgo}}, spawning a [[func_breakable_surf]] with this entity will crash the game.}}
{{bug|In {{csgo}}, spawning a [[func_breakable_surf]] with this entity will crash the game.}}
{{bug|In {{insurgency}}{{doi}}, this entity is broken and will usually crash the game.  Although if the gamemode is set to training in {{insurgency}}, it will work normally.}}
{{bug|In {{insurgency}}{{doi}}, this entity is broken and will usually crash the game.  Although if the gamemode is set to training in {{insurgency}}, it will work normally.}}



Revision as of 14:38, 17 November 2020

Template:Otherlang2 Template:Base point It turns an entity, or set of entities, into a single template that can be instanced anywhere, and multiple times.

Note.pngNote:S_PreserveEnts cannot be instanced by this entity.
Icon-Bug.pngBug:In Counter-Strike: Global Offensive, spawning a func_breakable_surf with this entity will crash the game.  [todo tested in ?]
Icon-Bug.pngBug:In InsurgencyDay of Infamy, this entity is broken and will usually crash the game. Although if the gamemode is set to training in Insurgency, it will work normally.  [todo tested in ?]

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.

Warning.pngWarning: Point_template will not do any name fixuppance in the parameter override boxes of its templated entities.

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.

When the template is spawned, any logic_relay within the template will fire its OnSpawn output.

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 ([todo internal name (i)]) 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.
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

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.


Outputs

OnEntitySpawned
Fired after spawning an instance of this template.


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.