Nuclide
Software Development Kit for id Tech
random_speaker Class Reference

Server-Entity: Sound Emitter With Random Intervals. More...

Inheritance diagram for random_speaker:
NSPointTrigger

Public Member Functions

void random_speaker (void)
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle. More...
 
virtual void Restore (string, string)
 Similar to NSIO::SpawnKey but for save-game fields. More...
 
virtual void SpawnKey (string, string)
 This method handles entity key/value pairs on map load. More...
 
virtual void Respawn (void)
 Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state. More...
 
virtual void Trigger (entity, triggermode_t)
 Called whenever we're legacy triggered by another object or function. More...
 
nonvirtual void PlaySample (void)
 
nonvirtual void Enable (void)
 
nonvirtual void Disable (void)
 

Detailed Description

Server-Entity: Sound Emitter With Random Intervals.

QUAKED random_speaker (1 0 0) (-8 -8 -8) (8 8 8)

OVERVIEW

This entity plays a .wav file at random intervals.

KEYS

  • "targetname" : Name
  • "target" : Target when triggered
  • "killtarget" : Target to kill when triggered
  • "rsnoise" : Path to the sound file.
  • "volume" : Volume to play the sound as (normalized, 0.0 - 1.0).
  • "wait" : Minimum time for sound repetition in %.
  • "random" : Random % of this added to wait.

NOTES

To explain the math behind it: The 'wait' key specifies the minimum time it waits to play itself again, however we always add a bit of a random interval on top. The random interval is a set percentage of the specified 'wait' time. For example, if 'wait' is 10 and 'random' is 50, then it'll always be a random interval between 10 and 15 seconds in total.

TRIVIA

It was introduced in Gunman Chronicles (2000).

Constructor & Destructor Documentation

◆ random_speaker()

void random_speaker::random_speaker ( void  )

Member Function Documentation

◆ Disable()

void random_speaker::Disable ( void  )

◆ Enable()

void random_speaker::Enable ( void  )

◆ PlaySample()

void random_speaker::PlaySample ( void  )

◆ Respawn()

void random_speaker::Respawn ( void  )
virtual

Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state.

Reimplemented from NSPointTrigger.

◆ Restore()

void random_speaker::Restore ( string  strKey,
string  strValue 
)
virtual

Similar to NSIO::SpawnKey but for save-game fields.

Whatever you write into file handles within your NSIO::Save() method needs to be read back in here.

Reimplemented from NSPointTrigger.

◆ Save()

void random_speaker::Save ( float  handle)
virtual

Handles saving a copy of this entity to a given filehandle.

Within you want to use the NSIO::SaveFloat() etc. methods to write the internal member attributes to the specified file handle.

Reimplemented from NSPointTrigger.

◆ SpawnKey()

void random_speaker::SpawnKey ( string  strKey,
string  strValue 
)
virtual

This method handles entity key/value pairs on map load.

You can easily convert the strValue parameter using the ReadFloat etc. methods that are part of NSIO.

Reimplemented from NSPointTrigger.

◆ Trigger()

void random_speaker::Trigger ( entity  act,
triggermode_t  state 
)
virtual

Called whenever we're legacy triggered by another object or function.

Reimplemented from NSTrigger.


The documentation for this class was generated from the following file: