Env speaker: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(52 intermediate revisions by 28 users not shown)
Line 1: Line 1:
{{wrongtitle|title=env_speaker}}
{{tabsBar|main=Speaker}}
==Entity Description==
{{LanguageBar}}
Announcement Speaker, used in several maps it uses the NPC response context system. You can specify time between announcements. When it makes an announcement, it looks at its Context rule script, chooses the best rule(Response Contexts and Concept name are used here), then dispatches a response which could be a .vcd scene that controls a NPC, a sentense, or just a sound. See [[Response System]] for more information about context rule script grammer.
{{CD|CSpeaker|file1=env_speaker.cpp}}
{{this is a|point entity|game=Half-Life 2 series|game1=Portal|name=env_speaker}} It randomly emits announcements using the [[response rules]] system.
 
{{stray ent|{{as|2.bold}} and {{portal2|2.bold}}}}
 
==Flags==
{{fl|1|Start Silent}}
{{fl|2|Play Everywhere}}


==Keyvalues==
==Keyvalues==
* '''name'''
{{KV Targetname}}
:targetname <target_source> The name that other entities refer to this entity by.
{{KV|Min Delay Between Announcements|intn=delaymin|float|Minimum time between announcements in seconds.}}
* '''Response Contexts'''
{{KV|Max Delay Between Announcements|intn=delaymax|float|Maximum time between announcements in seconds.}}
:ResponseContext <string> Response system context(s) for this entity. Format should be: 'key:value,key2:value2,etc'. When this entity speaks, the list of keys & values will be passed to the response rules system.
{{KV|Context rule script|intn=rulescript|string|The response rules script file to load.}}
* '''Min Delay Between Announcements'''
{{KV|Concept name|intn=concept|string|The [[Response rules#Concepts|concept]] to speak.}}
:delaymin <string>
* '''Max Delay Between Announcements'''
:delaymax <string>
* '''spawnflags'''
:spawnflags <flags>
* '''Context rule script'''
:rulescript <string> Script file containing rules for playing appropriate sounds.
*'''Concept name'''
:concept <string> High level concept name used as primary search key.


==Inputs==
==Inputs==
*'''Kill'''
{{I|TurnOn|Start random announcements.}}
:Removes this entity from the world.
{{I|TurnOff|Stop random announcements.}}
*'''KillHierarchy'''
{{I|Toggle|If on, turn off. If off, turn on.}}
:Removes this entity and all its children from the world.
*'''AddOutput'''
:<string> Adds an entity I/O connection to this entity. Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>. 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.
*'''AddContext'''
:<string> Adds a context to this entity's list of response contexts. The format should be 'key:value'.
*'''RemoveContext'''
"<string> Remove a context from this entity's list of response contexts. The name should match the 'key' of a previously added context.
*'''ClearContext'''
:Removes all contexts in this entity's list of response contexts.
*'''TurnOn'''
:Turn on the random announcements.
*'''TurnOff'''
:Turn off the random announcements.
*'''Toggle'''
:Toggle the random announcements off and on.
 
==Outputs==
*'''OnUser1'''
:Fired in response to FireUser1 input.
 
*'''OnUser2'''
:Fired in response to FireUser2 input.
 
*'''OnUser3'''
:Fired in response to FireUser3 input.


*'''OnUser4'''
==See also==
:Fired in response to FireUser4 input.
*{{ent|func_monitor}}
*{{ent|env_microphone}}




[[Category:Sound System]]
[[Category:Sound System]]
[[Category:Entities]]

Latest revision as of 19:49, 29 April 2025

edit
English (en)Translate (Translate)
C++ Class hierarchy
CSpeaker
CPointEntity
CBaseEntity
C++ env_speaker.cpp

env_speaker is a point entity available in Half-Life 2 series Half-Life 2 series and Portal Portal. It randomly emits announcements using the response rules system.

Note.pngNote:This entity is also in the code for Alien Swarm Alien Swarm and Portal 2 Portal 2. Its functionality is not guaranteed.


Flags

Start Silent : [1]
Play Everywhere : [2]

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Min Delay Between Announcements (delaymin) <float>
Minimum time between announcements in seconds.
Max Delay Between Announcements (delaymax) <float>
Maximum time between announcements in seconds.
Context rule script (rulescript) <string>
The response rules script file to load.
Concept name (concept) <string>
The concept to speak.

Inputs

TurnOn
Start random announcements.
TurnOff
Stop random announcements.
Toggle
If on, turn off. If off, turn on.

See also