This article's documentation is for anything that uses the Source engine. Click here for more information.

AddOutput

From Valve Developer Community
Jump to navigation Jump to search
English (en)Русский (ru)Translate (Translate)

This is an input available in all Source Source games.

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 count as edict.

Tip.pngTip:Abusing AddOutput too much makes your map harder to understand. Avoid abusing it unless necessary for your use case.
Note.pngNote:Not all entity properties can be changed. For example, changing the classname won't make the entity into a different one, but special rules that are in source titles like making an entity a permanent entity will apply, such as making a math_counter a info_target.
Warning.pngWarning:Changing the classname of a player causes problems and should be avoided at all costs.
Warning.pngWarning:In Hammer 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

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.

Limitations

  • Only one output can be added with AddOutput to an entity. Stacking 2 or more in the same AddOutput will not work due to how the engine reads the colons.
  • It's not possible to add an output with this that uses AddContext input because AddContext also uses ':' in its syntax.

Firing AddOutput via ent_fire

Because AddOutput uses space in its syntax it's required to enclose the ent_fire parameter in quotes.

To change keyvalue:

ent_fire <entity name> addoutput "<key> <value>"

To add output:

ent_fire <entity name> addoutput "<OutputName> <targetname>:<InputName>:<parameter>:<delay>:<times to fire>"

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о