Entity Article Template: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(added more common keys and inputs)
m (Split IO template links)
 
(68 intermediate revisions by 26 users not shown)
Line 1: Line 1:
==Entity Description==
{{LanguageBar|title = Entity Article Template}}
{{Multiple issues|
{{Orphan|date=January 2024}}
{{Update|How a page as important as this is as out of date as it is in incomprehensible. Should be update as soon as possible. {{tl|lang}} and {{tl|entity}} are both out of date.}}
}}


Description of the entity goes here. This should be a plainly-worded but accurate description of the basic function of the entity. A basic description for most entities is included in the help built into [[Hammer]].
{{Back|Help:Page Creation}}
These are (optional) templates for the first text of an entity page. Find other useful templates at [[Help:Templates#Notice Templates]].
{{Note|1=The template that is marked with a character "<strong style="color: yellow; ">*</strong>" is required for the entity page.}}
{| class=wikitable
| <strong style="color: yellow; ">*</strong>{{Code|1=<nowiki>{{</nowiki>[[Template:This is a|This is a]]{{!}}<entity type>{{!}}name=<entity classname>{{!}}game=<full game name><nowiki>}}</nowiki>}}
| Creates a first sentence with a link to the game.
{{syntax2 |in=<nowiki>{{This is a|point entity|name=ammo_57mm|game=Counter-Strike: Source}}</nowiki>|out={{this is a|point entity|name=ammo_57mm|game=Counter-Strike: Source|nocat=1|notitlechange=1}}}}
{{tip|If the entity is ''available in all Source games'', don't use {{Code|style=1|{{Param|game}}}}. If available in multiple games, use {{Code|style=1|{{Param|game1}}}} (See [[Template:This is a|the documentation of the template]] for details).}}{{Note|See [[Template:This is a|the documentation of the template]] for the details of entity types.}}
|-
| {{T|LanguageBar}} || Adds the flags on the top right for language pages and adds this page to an appropriate language [[Help:Categories|Category]].
|-
| {{T|Distinguish|{{P|Other Page Name}}}} || Adds a note with a link to a page that this page should not be confused with.
|-
| {{T|Stub}} || Adds a notice and a category for incomplete pages.
|-
| {{T|Ent not in fgd}} || Adds a notice for entities that are not available in Hammer. Its text contains a link to a section "FGD Code" on the same page where code can be provided to make it available in Hammer. If it shouldn't add the parameter <code>nolink=1</code>. If the entity is available in Hammer but not in the game, use {{T|Ent not in game}}.
|}


The quick brown fox jumps over the lazy dog. 1234567890. Description of entity goes here, blah blah. The quick brown fox jumps over the lazy dog. 1234567890. Description of entity goes here, blah blah. The quick brown fox jumps over the lazy dog. 1234567890.  
== Entity Description ==
This should be a plainly-worded but accurate description of the basic function of the entity. A very basic description for most entities is included in the help built into {{Hammer|1}}. If the description isn't overly long, omit the header and put it at the top with the first sentence on the page.


For an NPC's inputs, outputs etc. the [[Npc_sniper|npc_sniper]] article could be handy. Many of the details seem the same for different NPCs, so it could save typing.
[[.fgd|FGDs]] (and by extension the Hammer properties window) are good sources for information on an entity's keyvalues, inputs, outputs, and flags, however FGDs often will not list ''everything'' available for an entity. Because of this, the wiki uses a mix of [[Help:Templates|templates]] that roughly follow the engine's class hierarchy and ones that follow FGDs.


The information for the entity Keys, Outputs, and Inputs can be found inside the Hammer entity help, or in the [[FGD]]. Flag names can only be found in the [[FGD]].
Also include [[:Template:Code class]]:
{{Syntax2
| in = {{T|Code class|{{P|CEntityClass}}{{P|entityfile}}}}
| out = {{Code class|CEntityClass|entityfile}}
}}
The entity's code class name can be found by searching <code>LINK_ENTITY_TO_CLASS</code> in the CPP file defining it.


==Entity Values==
== Dedicated Console Variables and Commands (omit if none exist) ==
===Keys===
Console variables and commands can be found by searching <code>ConVar</code> and <code>ConCommand</code> in the CPP file that defines the entity. Note a parameter if any exist.
;cvar_name <data type>
:Description.
;sk_barney_health <integer>
:Barney's spawn health.


* '''Key''' ''value <type of value>''
== Flags (omit if none exist) ==
: Replace this with a description of what the key is used for.
{{Tip|See [[:Category:Flag Templates]] for a list of available templates.}}
For each flag, write one of the following.


* '''Name''' ''targetname <target_source>''
{{T|Fl|{{P|<integer>}}{{P|<flag name>}}}}
: The name that other entities refer to this entity by.


* '''Parent''' ''parentname <target_destination>''
{{T|Fl|{{P|<integer>}}{{P|<flag name>}}{{P|<description>}}}}
: The name of this entity's parent in the movement hierarchy. Entities with parents move with their parent.


* '''Pitch Yaw Roll (Y Z X)''' ''angles <angle>''
Which could look like this:
: This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
{{Fl|Integer value|Flag Name|Description if necessary.}}
{{Fl|16|Start Silent|The map will start without this sound playing. Enabled by default.}}


* '''Color (R G B)''' ''rendercolor <color255>''
== Keyvalues ==
: The color of the spotlight cone.
Since every entity inherits {{ent|CBaseEntity}}, all entity pages should have [[:Template:KV BaseEntity]] if not more. The only exceptions are [[:Category:Internal entities|internal entities]], which are removed during the compiling of a map and cannot receive I/O and most base keyvalues. This all applies to inputs and outputs as well.


===Flags===
Individual keyvalues are defined with [[:Template:KV]].
{{Tip|See [[:Category:Keyvalue Templates]] for a list of available templates.}}
{{KV|Keyvalue Name|intn=non-SmartEdit name)|vartype|A description of the keyvalue.}}
{{KV|Render Amount|intn=renderamt|integer|Transparency amount, requires a Render Mode other than Normal. 0 is invisible, 255 is fully visible.}}


* '''Flag Name'''
==Inputs==
: Replace this with a description of the flag.
Individual inputs are defined with [[:Template:I]]
{{Tip|See [[:Category:Input Templates]] for a list of available templates.}}


* '''Flag Name'''
{{I|InputName|A description of the input.|param=optional vartype}}
: Replace this with a description of the flag.
{{I|SetSpeed|Set the speed of the train, as a ratio of max speed [0, 1]|param=float}}


===Inputs===
==Outputs==
Individual outputs are defined with [[:Template:O]]
{{Tip|See [[:Category:Output Templates]] for a list of available templates.}}


* '''Intput Name'''
{{O|OutputName|A description of the output.}}
: Replace this with a description of the Input.
{{O|OnPressed|Fired when the button is pressed.}}


* '''Kill'''
==See also==
: Removes this entity from the world.
{{Todo|Add links to related articles, entities, or tutorials here.}}


* '''KillHierarchy''' 
*[[Assault]]s
: Removes this entity and all its children from the world.
*{{ent|ambient_generic}}


* '''AddOutput''' ''<string> <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>''
[[Category:Entities]]
: Adds an entity I/O connection to this entity. Very dangerous, use with care.
 
* '''FireUser1'''
: Causes this entity's OnUser1 output to be fired.
 
* '''FireUser2'''
: Causes this entity's OnUser2 output to be fired.
 
* '''FireUser3'''
: Causes this entity's OnUser3 output to be fired.
 
* '''FireUser4'''
: Causes this entity's OnUser4 output to be fired.
 
* '''SetParent''' ''<string>''
: Changes the entity's parent in the movement hierarchy.
 
* '''SetParentAttachment''' ''<string>''
: Change this entity to attach to a specific attachment point on its parent. Entities must be parented before being sent this input. The parameter passed in should be the name of the attachment.
 
* '''ClearParent'''
: Removes this entity from the the movement hierarchy, leaving it free to move independently.
 
===Outputs===
 
* '''Output Name'''
: Replace this with a description of the Output.
 
* '''OnUser1'''
: Fired in response to FireUser1 input.
 
* '''OnUser2'''
: Fired in response to FireUser2 input.
 
* '''OnUser3'''
: Fired in response to FireUser3 input.
 
* '''OnUser4'''
: Fired in response to FireUser4 input.
 
==See Also==
 
* Add links to related articles, entities, or tutorials here.
* [[Assaults]] - appropriate links to tutorials, related articles and entities etc.
* [[ambient_generic]]
* [[trigger_auto]]

Latest revision as of 15:16, 21 April 2025

English (en)Translate (Translate)
Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Broom icon.png
This article or section needs to be updated to include current information regarding the subject because:
How a page as important as this is as out of date as it is in incomprehensible. Should be update as soon as possible. {{lang}} and {{entity}} are both out of date.
Remember to check for any notes left by the tagger at this article's talk page.
Help:Page Creation

These are (optional) templates for the first text of an entity page. Find other useful templates at Help:Templates#Notice Templates.

Note.pngNote:The template that is marked with a character "*" is required for the entity page.
*{{This is a|<entity type>|name=<entity classname>|game=<full game name>}} Creates a first sentence with a link to the game.
 
 Example {{This is a|point entity|name=ammo_57mm|game=Counter-Strike: Source}} 
   Results ammo_57mm is a point entity available in Counter-Strike: Source Counter-Strike: Source.
Tip.pngTip:If the entity is available in all Source games, don't use {{{game}}}. If available in multiple games, use {{{game1}}} (See the documentation of the template for details).
Note.pngNote:See the documentation of the template for the details of entity types.
{{LanguageBar}} Adds the flags on the top right for language pages and adds this page to an appropriate language Category.
{{Distinguish|Other Page Name}} Adds a note with a link to a page that this page should not be confused with.
{{Stub}} Adds a notice and a category for incomplete pages.
{{Ent not in fgd}} Adds a notice for entities that are not available in Hammer. Its text contains a link to a section "FGD Code" on the same page where code can be provided to make it available in Hammer. If it shouldn't add the parameter nolink=1. If the entity is available in Hammer but not in the game, use {{Ent not in game}}.

Entity Description

This should be a plainly-worded but accurate description of the basic function of the entity. A very basic description for most entities is included in the help built into Hammer. If the description isn't overly long, omit the header and put it at the top with the first sentence on the page.

FGDs (and by extension the Hammer properties window) are good sources for information on an entity's keyvalues, inputs, outputs, and flags, however FGDs often will not list everything available for an entity. Because of this, the wiki uses a mix of templates that roughly follow the engine's class hierarchy and ones that follow FGDs.

Also include Template:Code class:

 
 Example {{Code class|CEntityClass|entityfile}} 
   Results
C++ In code, it is represented by theCEntityClassclass, defined in theentityfilefile.

The entity's code class name can be found by searching LINK_ENTITY_TO_CLASS in the CPP file defining it.

Dedicated Console Variables and Commands (omit if none exist)

Console variables and commands can be found by searching ConVar and ConCommand in the CPP file that defines the entity. Note a parameter if any exist.

cvar_name
Description.
sk_barney_health <integer>
Barney's spawn health.

Flags (omit if none exist)

Tip.pngTip:See Category:Flag Templates for a list of available templates.

For each flag, write one of the following.

{{Fl|<integer>|<flag name>}}

{{Fl|<integer>|<flag name>|<description>}}

Which could look like this:

Flag Name : [Integer value]
Description if necessary.
Start Silent : [16]
The map will start without this sound playing. Enabled by default.

Keyvalues

Since every entity inherits CBaseEntity, all entity pages should have Template:KV BaseEntity if not more. The only exceptions are internal entities, which are removed during the compiling of a map and cannot receive I/O and most base keyvalues. This all applies to inputs and outputs as well.

Individual keyvalues are defined with Template:KV.

Tip.pngTip:See Category:Keyvalue Templates for a list of available templates.
Keyvalue Name (non-SmartEdit name)) <vartype>
A description of the keyvalue.
Render Amount (renderamt) <integer>
Transparency amount, requires a Render Mode other than Normal. 0 is invisible, 255 is fully visible.

Inputs

Individual inputs are defined with Template:I

Tip.pngTip:See Category:Input Templates for a list of available templates.


InputName <optional vartype>
A description of the input.
SetSpeed <floatRedirectInput/float>
Set the speed of the train, as a ratio of max speed [0, 1]

Outputs

Individual outputs are defined with Template:O

Tip.pngTip:See Category:Output Templates for a list of available templates.


OutputName
A description of the output.
OnPressed
Fired when the button is pressed.

See also

Todo: Add links to related articles, entities, or tutorials here.