AddOutput: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Equalizer5118 moved page AddOutput to AddOutput/en)
(this page is barebone. fix it up a bit and be clearer)
Line 1: Line 1:
{{langsp}}
{{langsp}}
The AddOutput output in [[Hammer]] uses the syntax : <code><key> <value></code> '''or''' <output name> <target name>:<input name>:<parameter>:<delay>:<max times to fire (-1 = infinity, 1 = once only)> to be used in the parameters field of the [[output]]
AddOutput lets mappers change the properties of an entity. Anything that is in the entity's properties can be changed/added to with the [[AddOutput]] input. This includes targetname, rendercolor, solid and more that is defined in the [[FGD]].


{{Warning|Don't use quotation characters (") in the ''Text Message'' field (not even <code>\"</code> characters). It will cause fatal errors with opening and/or compiling your map and may need to be fixed by manually editing the [[VMF]] in a text editor. Instead, use detailed quotes (i.e. <code>&ldquo;</code> and <code>&rdquo;</code>) or two apostrophes ( <nowiki>''</nowiki> ).}}
Due to how much AddOutput lets you manipulate entities properties it is therefore a good way to optimize maps which utilize [[env_entity_maker]], [[point_teleport]], [[game_text]] and more which counts as [[edict]].
{{Tip|Abusing AddOutput too much makes your map harder to understand. Avoid abusing it unless neccesary for you use case.}}
{{Note|Somethings wont change, like classname wont make the entity a different one but special rules that are in source titles like making an entity a permanent entity will apply if you as an example make a [[math_counter]] a [[info_target]].}}
{{Warning|Changing the classname of a player causes problems and should be avoided at all cost.}}
{{Warning|Don't use quotation characters (") in any of the fields (not even <code>\"</code> characters). It will cause fatal errors with opening and/or compiling your map and may need to be fixed by manually editing the [[VMF]] in a text editor. Instead, use detailed quotes (i.e. <code>&ldquo;</code> and <code>&rdquo;</code>) or two apostrophes ( <nowiki>''</nowiki> ).}}


Syntax example with parameters: OutputName TargetName:Color:255 255 255:0:-1


Syntax example with NO parameters: OutputName TargetName:Open::0:-1
Changing the properties of an entity using AddOutput in [[Hammer]] uses the syntax : <code><property> <value></code>


{{note|Syntax is different in Source 2. Syntax example with NO parameters in Source 2: OutputName>TargetName>InputName>Parameter>Delay>MaxTimesToFire}}
It can also add [[output]] to an entity with the syntax: <code><output> <targetname>:<input>:<parameter>:<delay>:<refires (-1 = infinity, 1 = once)></code>
{{Note|If the input you use takes no parameter then it should be '''empty'''}}


It is worth noting that if you have no parameters, then put nothing between the two colons or ">."
* Example with parameters: <code>Output TargetName:Color:255 255 255:0:-1</code>
* Example with no parameters: <code>Output TargetName:Lock::0:-1</code>


Max times to fire can work with values other than 1 or -1.  
{{Note|You can only AddOutput '''one''' output to an entity. Stacking 2 or more in the same AddOutput will '''not''' work due to how the Engine reads the colon's.}}
 
 
Just like in Hammer you are not limited to only <code>1, -1</code> for refires as it can be defined to any positive number.
* 1 = fire once, 2 = fire twice, [...] , -1 = fire infinite times {{todo|People sometimes report this not working. It might not work in some games or when done through hammer vs ent_fire.}}
 
 
[[AddOutput]] exists in a barebone ways in [[Source 2]] and has a lot of quirks. You are unable to edit a lot of keyvalues without 3rd party plugins.
{{note|Syntax is different in Source 2. Syntax example with NO parameters in Source 2: <code>Output>Targetname>Input>Parameter>Delay>MaxTimesToFire</code>}}


1 = fire once, 2 = fire twice, [...] , -1 = fire infinite times {{todo|People sometimes report this not working. It might not work in some games or when done through hammer vs ent_fire.}}


==Examples==
==Examples==
:Format: <code><key> <value></code>
:Format: <code><key> <value></code>
  {
  {
  "classname" "prop_physics"
  "classname" "trigger_once"
"targetname" "prop01"
  .
  .
  .
  .
  .
  .
  '''"OnHealthChange" "!self,AddOutput,targetname prop9001"'''
  ''''OnStartTouch" "game_text,AddOutput,message There is a fire ahead. Go the other way!,0,1'''
''''OnStartTouch" "game_text,Display,,0.02,1'''
  }  
  }  
This changes the target name of the prop. In this case, it is changing it's own name, so !self == prop01.
This changes the text of a game_text and then displays it. This is useful as to prevent having an unneccesary amount of game_text which counts as [[edict]]


:Format: <code><output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, 1 means once and -1 means infinite></code>
:Format: <code><output> <targetname>:<input>:<parameter>:<delay>:<refire></code>
  {
  {
  "classname" "tf_logic_auto"
  "classname" "tf_logic_auto"
Line 34: Line 46:
  .
  .
  .
  .
  '''"OnMapSpawn" "team_round_timer_red,AddOutput,OnFinished game_round_win:RoundWin::0:-1,0,-1"'''
  ''''OnMapSpawn" "team_round_timer_red,AddOutput,OnFinished game_round_win:RoundWin::0:-1,0,-1'''
  }
  }
This adds an output to an entity with the targetname "team_round_timer_red".
This adds an output to an entity with the targetname "team_round_timer_red".
Line 68: Line 80:


==See Alsо==
==See Alsо==
*[https://www.youtube.com/watch?v=Ri8r7lUEB0w&feature=youtu.be|briefly about the AddOutput]
*[https://rafuron.wordpress.com/2011/05/19/2nd-mapping-trick-templates-and-ent-limits/ Optimizing Edict's & Mapping Tricks]

Revision as of 07:41, 20 June 2024

English (en)Русский (ru)中文 (zh)Translate (Translate)

AddOutput lets mappers change the properties of an entity. Anything that is in the entity's properties can be changed/added to with the AddOutput input. This includes targetname, rendercolor, solid and more that is defined in the FGD.

Due to how much AddOutput lets you manipulate entities properties it is therefore a good way to optimize maps which utilize env_entity_maker, point_teleport, game_text and more which counts as edict.

Tip.pngTip:Abusing AddOutput too much makes your map harder to understand. Avoid abusing it unless neccesary for you use case.
Note.pngNote:Somethings wont change, like classname wont make the entity a different one but special rules that are in source titles like making an entity a permanent entity will apply if you as an example make a math_counter a info_target.
Warning.pngWarning:Changing the classname of a player causes problems and should be avoided at all cost.
Warning.pngWarning:Don't use quotation characters (") in any of the fields (not even \" characters). It will cause fatal errors with opening and/or compiling your map and may need to be fixed by manually editing the VMF in a text editor. Instead, use detailed quotes (i.e. and ) or two apostrophes ( '' ).


Changing the properties of an entity using AddOutput in Hammer uses the syntax : <property> <value>

It can also add output to an entity with the syntax: <output> <targetname>:<input>:<parameter>:<delay>:<refires (-1 = infinity, 1 = once)>

Note.pngNote:If the input you use takes no parameter then it should be empty
  • Example with parameters: Output TargetName:Color:255 255 255:0:-1
  • Example with no parameters: Output TargetName:Lock::0:-1
Note.pngNote:You can only AddOutput one output to an entity. Stacking 2 or more in the same AddOutput will not work due to how the Engine reads the colon's.


Just like in Hammer you are not limited to only 1, -1 for refires as it can be defined to any positive number.

  • 1 = fire once, 2 = fire twice, [...] , -1 = fire infinite times
    Todo: People sometimes report this not working. It might not work in some games or when done through hammer vs ent_fire.


AddOutput exists in a barebone ways in Source 2 and has a lot of quirks. You are unable to edit a lot of keyvalues without 3rd party plugins.

Note.pngNote:Syntax is different in Source 2. Syntax example with NO parameters in Source 2: Output>Targetname>Input>Parameter>Delay>MaxTimesToFire


Examples

Format: <key> <value>
{
"classname" "trigger_once"
.
.
.
'OnStartTouch" "game_text,AddOutput,message There is a fire ahead. Go the other way!,0,1
'OnStartTouch" "game_text,Display,,0.02,1
} 

This changes the text of a game_text and then displays it. This is useful as to prevent having an unneccesary amount of game_text which counts as edict

Format: <output> <targetname>:<input>:<parameter>:<delay>:<refire>
{
"classname" "tf_logic_auto"
.
.
.
'OnMapSpawn" "team_round_timer_red,AddOutput,OnFinished game_round_win:RoundWin::0:-1,0,-1
}

This adds an output to an entity with the targetname "team_round_timer_red".


Trigger_Multiple
Name: Ghost


Outputs
My Output Named: OnEndTouch
Targets entities named: !activator
Via this input: Alpha
With a parameter override of: 255
After a delay in seconds: 0.10


My Output Named: OnStartTouch
Targets entities named: !activator
Via this input: AddOutput
With a parameter override of: rendermode 1
After a delay in seconds: 0.00


My Output Named: OnStartTouch
Targets entities named: !activator
Via this input: Alpha
With a parameter override of: 120
After a delay in seconds: 0.00


Results in translucent player when standing in the trigger_multiple (OnStartTouch) and visible again when not in the trigger_multiple (OnEndTouch).

See Alsо