PlaySound

From ZDoom Wiki
Jump to navigation Jump to search

void PlaySound (int tid, str sound [, int channel [, fixed volume [, bool looping [, fixed attenuation [, bool local]]]]])

Usage

Plays a sound at a thing. This is similar to A_PlaySound action function except it will not default to playing "weapons/pistol" sound. If tid is 0, the sound will be played by the activator of the script.

Parameters

  • tid: the TID of the actor to play the sound from.
  • sound: the sound to play, as defined in SNDINFO.
  • channel: the channel to play the sound on. Default is CHAN_BODY.
  • volume: the volume of the sound. This ranges from 0.0 (mute) to 1.0 (full volume). Default is 1.0.
  • looping: whether the sound should loop or not. If true, the sound loops, otherwise it does not. Default is false.
  • attenuation: how quickly the sound fades with distance from its source. The higher the value the quicker the sound fades out. The following are the standard attenuation values:
    • ATTN_NONE — 0 (no attenuation; the sound can be heard regardless of the distance).
    • ATTN_NORM — 1.0 (normal attenuation; this is the default value).
    • ATTN_IDLE — 1.001
    • ATTN_STATIC — 3.0 (the sound diminish very rapidly with distance).
  • local: If true, the sound is played if the player is either looking out the eyes of the actor from which the sound is coming, or said actor is the player and the player is looking out the eyes of a non-monster actor. Also, the sound is played with ATTN_NONE. Default is false.

Examples