Difference between revisions of "Template:I BaseEntity"

From Valve Developer Community
Jump to: navigation, search
m (weoops left in developer stuff, removed it)
m (CSGO param - TeamNum input now supports a 'teamnum_dont_put_nofgd' value)
Line 7: Line 7:
 
<pre>{{I BaseEntity|base=1}}</pre>
 
<pre>{{I BaseEntity|base=1}}</pre>
 
'''Game as a parameter:''' display the inputs that <code>base</code> displays, AND inputs that were added to the class, by the specified game. You can specify as many games as needed. You must specify ALL the games you want to include (e.g. <code>l4d2</code> will not automatically include <code>l4d</code> inputs as well).
 
'''Game as a parameter:''' display the inputs that <code>base</code> displays, AND inputs that were added to the class, by the specified game. You can specify as many games as needed. You must specify ALL the games you want to include (e.g. <code>l4d2</code> will not automatically include <code>l4d</code> inputs as well).
<pre>{{I BaseEntity|l4d2=1}}</pre>
+
<pre>{{I BaseEntity|tf2=1}}</pre>
  
 
All parameters for this template:
 
All parameters for this template:
Line 53: Line 53:
 
<!--
 
<!--
 
   ++ SetTeam (along with 'TeamNum' in CS:GO) related things go here ++
 
   ++ SetTeam (along with 'TeamNum' in CS:GO) related things go here ++
 +
 
 +
There isn't a better way to do those switch cases, is there
 
-->
 
-->
 
<!-- IF: TF2 == 'setteam_dont_put_nofgd' -->{{#switch: {{{tf2|}}} | setteam_dont_put_nofgd =
 
<!-- IF: TF2 == 'setteam_dont_put_nofgd' -->{{#switch: {{{tf2|}}} | setteam_dont_put_nofgd =
Line 70: Line 72:
 
| }} <!-- IF: CSS, ELSE IF: L4D, ELSE IF: L4D2 --> {{#if:{{{css|}}}||{{#if:{{{l4d|}}}||{{#if:{{{l4d2|}}}|
 
| }} <!-- IF: CSS, ELSE IF: L4D, ELSE IF: L4D2 --> {{#if:{{{css|}}}||{{#if:{{{l4d|}}}||{{#if:{{{l4d2|}}}|
 
{{IO|SetTeam|Doesn't do anything in {{l4ds}}.
 
{{IO|SetTeam|Doesn't do anything in {{l4ds}}.
:{{todo|Does this work in {{css}}?}}
+
{{confirm|Works in {{css}}?}}
 
<!--
 
<!--
 
:*0: None
 
:*0: None
Line 79: Line 81:
 
|deprecated=1|nofgd=1 }}
 
|deprecated=1|nofgd=1 }}
 
| }}}}}} <!-- IF: CSGO --> {{#if:{{{csgo|}}}|
 
| }}}}}} <!-- IF: CSGO --> {{#if:{{{csgo|}}}|
{{IO|SetTeam|Only<code>TeamNum</code>works in {{csgo}}.|deprecated=1}}
+
<!-- IF: CSGO == 'teamnum_dont_put_nofgd' --> {{#switch:{{{csgo|}}} | teamnum_dont_put_nofgd =
 +
{{IO|SetTeam|Only<code>TeamNum</code>works in {{csgo}}.|deprecated=1}}| <!-- ELSE IF: CSGO == 1 --> 1 =
 +
{{IO|SetTeam|Only<code>TeamNum</code>works in {{csgo}}.|deprecated=1|nofgd=1}}
 +
}}
 +
<!-- SCOPE 1 END -->
 
{{IO|TeamNum|Reassign the team of this entity as the team using this number.
 
{{IO|TeamNum|Reassign the team of this entity as the team using this number.
 
:*0: None
 
:*0: None

Revision as of 12:12, 13 April 2021

 English Русский 简体中文 

This template is our holder for all inputs assigned through CBaseEntity. The template has a very specific syntax that you must follow to apply properly, because new games have added new features throughout the years. See Help:Templates for more info on named parameters. No parameters: display inputs for ALL games.

{{I BaseEntity}}

Base: display inputs that have only existed since whatever game added the class (most have existed since HL2, the first Source game).

{{I BaseEntity|base=1}}

Game as a parameter: display the inputs that base displays, AND inputs that were added to the class, by the specified game. You can specify as many games as needed. You must specify ALL the games you want to include (e.g. l4d2 will not automatically include l4d inputs as well).

{{I BaseEntity|tf2=1}}

All parameters for this template:

  • base - (Use if the entity was available before L4D2.)
  • l4d2
  • portal2
  • prel4d - (DEPRECATED 9/28/18: This parameter existed to hide DispatchEffect for games (ones before l4d) that did not have it. There's many cases of similar inputs and keyvalues that aren't in absolutely everything, and making similar parameters for all of those simply isn't worth the trouble, especially considering having to comb through every existing use of those templates. Parameter is totally removed from code and affects nothing.)
  • tf2 - AlterSetTeaminput to show TF2 specific information. Usetf2=setteam_dont_put_nofgdto remove the !FGD tag.
Note.png Note: If you want to edit something on this template, please make sure you edit it in both places. Per-game inputs are duplicated, for complex technical reasons.

For full documentation on this family of templates, see FGD Template Prototype. Still confused on something? Ask for help before editing this template.

Note.png Note: Some CBaseEntity inputs are not covered here. See the talk page.

Base:

AddOutput <string>
Evaluates a keyvalue/output on this entity.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
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 thanKillinput.
SetParent <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
AddContext <string>
Adds to the entity's list of response contexts. Format is <key>:<value>.
RemoveContext <string>
Remove a context from this entity's list. The name should match the key of an existing context.
ClearContext <string>
Removes all contexts from this entity's list.
DispatchEffect <string> (removed since <Left 4 Dead>) !FGD
Dispatches a special effect from the entity's origin. Removed and replaced entirely by the particle system since <Left 4 Dead>.
DispatchResponse <string> !FGD
Dispatches a response to the entity. See Response and Concept.
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> (in all games since <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> (in all games since <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.png Bug:  In <Left 4 Dead 2>, the code is executed in the script scope of the entity that fires the output, not the one receiving the input.
Warning.png 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> (in all games since <Left 4 Dead 2>) !FGD
Execute a VScript function in the scope of the receiving entity.
SetLocalOrigin <coordinates> (in all games since <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> (in all games since <Alien Swarm>) !FGD
Set this entity's angles.