Point template: Difference between revisions
(turned things into templates, and resimplified + reformatted a lot of things) |
m (Description changed up, and added a little FGD snippet (leak) from teamspeens's hammer addons) |
||
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. 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. | {{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. To spawn the template in other places, an [[env_entity_maker]] can be used. For any [[logic_relay]] entities within a template, 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|Any entity from [[S_PreserveEnts]] cannot be instanced.}} | |||
Before using this entity, consider sections like [[#Name Fix-up|Name Fix-up]] and [[#FGD Enhancement(s)|FGD Enhancement(s)]] first. | |||
=== Name Fix-up === | === Name Fix-up === | ||
To prevent interdependencies (entity I/O, hierarchy, or other name references) between entities, the entities in the template will have their names changed, with the interdependencies outputs reconnected to the changed names. The name change format is as follows: '<original name>&XXXX', where the '&XXXX' will be replaced with the current global template instance spawn count, 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. | |||
Name fixing is ''only'' for template entities spawned by output | |||
The special [[targetname|targetnames]] (!self and such) work on spawned objects, so a [[trigger_multiple]] with an output to<code>!activator</code>can be used to affect individual spawned objects. Wildcards can refer to all entities spawned by a fix-up-enabled point_template. | The special [[targetname|targetnames]] (!self and such) work on spawned objects, so a [[trigger_multiple]] with an output to<code>!activator</code>can be used to affect individual spawned objects. Wildcards can refer to all entities spawned by a fix-up-enabled point_template. | ||
Note that if '"Don't remove template entities"' flag is active, the first (batch of) entities spawned will be postfixed<code>&0002</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. | |||
{{confirm|If<code>spawnflag 2</code>is active, will the unremoved entity 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.}} | {{warning| Point_template ''will not'' do any name fixuppance in the parameter override boxes of its templated entities.}} | ||
=== Tutorial === | === Tutorial === | ||
Line 36: | Line 31: | ||
== Outputs == | == Outputs == | ||
{{O PointTemplate}} | {{O PointTemplate}} | ||
== FGD Enhancement(s) == | |||
From [https://github.com/TeamSpen210/HammerAddons TeamSpen210's Hammer Addons],<code>point_template</code>can be made to show connecting lines to all entities part of its template. | |||
First, go to this line in your<code>base.fgd</code>and highlight the same characters: | |||
<source lang="cpp">@PointClass base(Targetname) iconsprite("editor/point_template.vmt") = point_template : </source> | |||
Then copy all of this, and paste all of this over it: | |||
<source lang="cpp">@PointClass base(BaseEntityPoint) | |||
iconsprite("editor/point_template.vmt") | |||
line(255 255 0, targetname, Template01) | |||
line(255 255 0, targetname, Template09) | |||
line(255 255 0, targetname, Template02) | |||
line(255 255 0, targetname, Template10) | |||
line(255 255 0, targetname, Template03) | |||
line(255 255 0, targetname, Template11) | |||
line(255 255 0, targetname, Template04) | |||
line(255 255 0, targetname, Template12) | |||
line(255 255 0, targetname, Template05) | |||
line(255 255 0, targetname, Template13) | |||
line(255 255 0, targetname, Template06) | |||
line(255 255 0, targetname, Template14) | |||
line(255 255 0, targetname, Template07) | |||
line(255 255 0, targetname, Template15) | |||
line(255 255 0, targetname, Template08) | |||
line(255 255 0, targetname, Template16) | |||
= point_template: </source> | |||
== See also == | == See also == |
Revision as of 03:42, 14 April 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. To spawn the template in other places, an env_entity_maker can be used. For any logic_relay entities within a template, will fire its OnSpawn output when spawned.







Before using this entity, consider sections like Name Fix-up and FGD Enhancement(s) first.
Name Fix-up
To prevent interdependencies (entity I/O, hierarchy, or other name references) between entities, the entities in the template will have their names changed, with the interdependencies outputs reconnected to the changed names. The name change format is as follows: '<original name>&XXXX', where the '&XXXX' will be replaced with the current global template instance spawn count, 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!activator
can be used to affect individual spawned objects. Wildcards can refer to all entities spawned by a fix-up-enabled point_template.
Note that if '"Don't remove template entities"' flag is active, the first (batch of) entities spawned will be postfixed&0002
. 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.

spawnflag 2
is active, will the unremoved entity have its name postfixed with&0001?

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
Inputs
- ForceSpawn
- Spawn an instance of the template at the original position.
Outputs
FGD Enhancement(s)
From TeamSpen210's Hammer Addons,point_template
can be made to show connecting lines to all entities part of its template.
First, go to this line in yourbase.fgd
and highlight the same characters:
@PointClass base(Targetname) iconsprite("editor/point_template.vmt") = point_template :
Then copy all of this, and paste all of this over it:
@PointClass base(BaseEntityPoint)
iconsprite("editor/point_template.vmt")
line(255 255 0, targetname, Template01)
line(255 255 0, targetname, Template09)
line(255 255 0, targetname, Template02)
line(255 255 0, targetname, Template10)
line(255 255 0, targetname, Template03)
line(255 255 0, targetname, Template11)
line(255 255 0, targetname, Template04)
line(255 255 0, targetname, Template12)
line(255 255 0, targetname, Template05)
line(255 255 0, targetname, Template13)
line(255 255 0, targetname, Template06)
line(255 255 0, targetname, Template14)
line(255 255 0, targetname, Template07)
line(255 255 0, targetname, Template15)
line(255 255 0, targetname, Template08)
line(255 255 0, targetname, Template16)
= point_template:
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
point_script_template - version of point_template catered to VScripting