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

logic_eventlistener

From Valve Developer Community
Jump to: navigation, search
English (en)Español (es)
... Icon-Important.png
logic_eventlistener
Missing entity icon.png
TypePoint entity
Availability(in all games since Portal 2)
(also in Team Fortress 2)
 
class hierarchy
CLogicEventListener
CLogicalEntity
CServerOnlyEntity
CBaseEntity

logic_eventlistener is a point entity available in all Source Source games since Portal 2 Portal 2. It is also available in Team Fortress 2 Team Fortress 2.

It can listen to events fired from code and fire and output when it happens.

All event declarations can be found in these files:

resource/gameevents.res
resource/modeevents.res
resource/demoimportantevents.res
resource/serverevents.res
resource/hltvevents.res
resource/replayevents.res 
Icon-Bug.pngBug:In singleplayer, the entity will stop working (firing outputs) after a save is reloaded, and must be respawned with a point_template.
Icon-Bug.pngBug:In Team Fortress 2, when overtime is reached in KOTH maps, the entity does not fire on the teamplay_overtime_begin and teamplay_overtime_end events.
In code, it is represented by the CLogicEventListener class, defined in the logic_eventlistener.cpp file. It is a subclass of both CLogicalEntity and CGameEventListener.

Keyvalues

Targetname:

Name (targetname) <string>
The targetname that other entities refer to this entity by.
Event Name (eventname) <string>
The name of the event that you want to listen for.
Fetch Event Data (fetcheventdata) <boolean> (in all games since Counter-Strike: Global Offensive) (also in Team Fortress 2)
Copies the game event data to the event_data table in the script scope of the listener entity when the event is fired.
Team Number (teamnum) <integer>
If set, will only fire its output if the event is generated from someone of the specified team.
  • -1: Don't care
  • 0: Unassigned !FGD
  • 1: Team 1 Portal 2, Spectators Counter-Strike: Global Offensive!FGD
  • 2: Team 2 (ORANGE) Portal 2, Terrorists Counter-Strike: Global Offensive
  • 3: Team 3 (BLUE) Portal 2, Counter-Terrorists Counter-Strike: Global Offensive

EnableDisable:

Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Inputs

EnableDisable:

Enable
Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Outputs

OnEventFired
Fired when the event has been detected.

See Also