Point template: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(turned things into templates, and resimplified + reformatted a lot of things)
Line 2: Line 2:
|zh-cn =Point_template:zh-cn
|zh-cn =Point_template:zh-cn
}}
}}
{{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. 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.bTo spawn the template in other places, an [[env_entity_maker]] can be used


Any [[logic_relay]] within the template, if it has one, will fire its OnSpawn output when spawned.
{{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 {{csgo}}, spawning a [[func_breakable_surf]] with this entity will crash the game.}}
{{note|[[S_PreserveEnts]] cannot be instanced by this entity.}}
{{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 {{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.}}


If there are interdependencies (entity I/O, hierarchy, or other name references) between the entities
=== Name Fix-up ===
in the template, the entities in the template will have their names changed and the interdependencies will
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.
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| 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'' for template entities spawned by output. The outputs of the point_template are ''not'' name fixed, and neither are the outputs of other objects referring to template entities.
Name fixing is ''only'' for template entities spawned by output. The outputs of the point_template are ''not'' name fixed, and neither are the outputs of other objects referring to template entities.


Line 31: Line 19:
With fixup on, the first (batch of) entities spawned will be postfixed<code>&0002</code>. If<code>spawnflag 2</code>is active, the unremoved entity will have its name postfixed with<code>&0001</code>.
With fixup on, the first (batch of) entities spawned will be postfixed<code>&0002</code>. If<code>spawnflag 2</code>is active, the unremoved entity will have its name postfixed with<code>&0001</code>.


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.
{{warning| Point_template ''will not'' do any name fixuppance in the parameter override boxes of its templated entities.}}
=== Tutorial ===
=== Tutorial ===
A [[Respawning_Items|tutorial]] has been created for respawning items using this entity.
A [[Respawning_Items|tutorial]] has been created for respawning items using this entity.


== Keyvalues ==
== Keyvalues ==
{{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 PointTemplate}}
{{KV Targetname}}


== Flags ==
== Flags ==
* 1 : Don't remove template entities
{{Fl PointTemplate}}
: 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 ==
== Inputs ==
{{IO|ForceSpawn|Spawn an instance of the template at the original position.}}
{{I PointTemplate}}
{{I Targetname}}


== Outputs ==
== Outputs ==
{{IO|OnEntitySpawned|Fired after spawning an instance of this template.}}
{{O PointTemplate}}
{{O Targetname}}


== See also ==
== See also ==

Revision as of 00:43, 19 March 2021

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. 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.bTo spawn the template in other places, an env_entity_maker can be used

Any logic_relay within the template, if it has one, will fire its OnSpawn output when spawned.

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 ?]
Icon-Bug.pngBug:In Counter-Strike: Global Offensive, spawning a func_breakable_surf with this entity will crash the game.  [todo tested in ?]
Note.pngNote:S_PreserveEnts cannot be instanced by this entity.

Name Fix-up

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.

Name fixing is only for template entities spawned by output. The outputs of the point_template are not name fixed, and neither are the outputs of other objects referring to template entities.

The special targetnames (!self and such) work on spawned objects, so a trigger_multiple with an output to!activatorcan be used to affect individual spawned objects. Wildcards can refer to all entities spawned by a fix-up-enabled point_template.

With fixup on, the first (batch of) entities spawned will be postfixed&0002. Ifspawnflag 2is active, the unremoved entity will have its name postfixed with&0001.

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.

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

Tutorial

A tutorial has been created for respawning items using this entity.

Keyvalues

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.


Flags

Template:Fl PointTemplate

Inputs

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


Outputs

Template:O PointTemplate

See also

  • env_entity_maker - automatic respawning and/or spawning at a different location
  • npc_maker - an alternative spawning entity, also with optional automatic respawning
  • Left 4 Dead 2 point_script_template - version of point_template catered to VScripting