Jump to content

OutSoundForUnit

From CMM Wiki
Revision as of 10:12, 11 November 2025 by Ozdeadmeat (talk | contribs) (outSoundForUnit – created via PowerShell script (2025-11-11T21:12:38Z))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Return to CMM Command Reference
Environment: Mission Scripting
Function: outSoundForUnit
Function Description: Plays a sound for a specified unit, either by unit object or unit ID. Supports both a single sound string or a table of sound strings, selecting randomly if a table is provided. Validates input to ensure the unit is valid and the sound is properly defined.
File Location: cmm.soundFunctions.lua
Syntax: CMM.outSoundForUnit( table or string UNIT , table or string: SOUND )
Return Value: nil
Parameters: Name Description
UNITREQUIRED, either a unit object or a unit ID string. If not valid, an error message is logged and no sound is played.
SOUNDREQUIRED, either a string path to a sound file or a table of sound file paths. A random entry is selected from the table if provided; otherwise, the string is used directly.
Example: CMM.outSoundForUnit(Unit.getByName("TEST-1"), CMM.SOUNDS.XPBanked)
Example Description: Plays a sound for the unit named "TEST-1" using the XPBanked sound from CMM.SOUNDS, leveraging unit object validation and sound selection logic.
Related Functions:
Notes: