Skip to content

Field manual / Level editor

sound — Sound

Sounds and ambient.

Summary

sound::PlayPlays a sound at the calling object's position; a nonzero loop makes it loop.
sound::PlayRandom2DPlays a random sound from a comma-separated list (up to 10) at background point (x, y).
sound::NewAmbientCreates an ambient object: a looping sound at background point (x, y).

Functions

sound::Play(sound, ?int) → int

Classic: PlaySound

Plays a sound at the calling object's position; a nonzero loop makes it loop.

sound::PlayRandom2D(int, int, string, ?int) → int

Classic: PlayRandomSound2D

Plays a random sound from a comma-separated list (up to 10) at background point (x, y). With chance > 0 it plays only with probability 1/chance.

sound::NewAmbient(string, int, int, string) → int

Classic: Ambient_New

Creates an ambient object: a looping sound at background point (x, y). Does nothing if an object with this name already exists.