Jump to content

PrepFrequencyForUnit

From CMM Wiki
Revision as of 10:11, 11 November 2025 by Ozdeadmeat (talk | contribs) (PrepFrequencyForUnit – created via PowerShell script (2025-11-11T21:11:57Z))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Return to CMM Command Reference
Environment: Mission Scripting
Function: PrepFrequencyForUnit
Function Description: Creates a SetFrequencyForUnit command that sets the radio frequency of a specified unit. The function accepts either MHz (e.g. 235.75) or Hz; if the value is < 500 it is treated as MHz and converted to Hz internally.
File Location: cmm.DCSFunctions.lua
Syntax: CMM.PrepFrequencyForUnit( number unitId , number freq , number modulationID )
Return Value: table
Parameters: Name Description
unitIdThe Unit ID of the aircraft/vehicle whose radio should be configured (obtained via Unit.getByName(name):getID()).
freqDesired frequency. Accepts MHz or Hz – values ≥ 500 are treated as Hz, otherwise they are multiplied by 1 000 000 to convert to Hz.
modulationIDModulation type – use 0 for AM and 1 for FM.
Example: local cmd = CMM.PrepFrequencyForUnit(unit:getID(), 235.75, 0) -- AM at 235.75 MHz
Example Description: Sets the unit’s radio to AM on 235.75 MHz (converted internally to 235750000 Hz).
Related Functions:
Notes: