PrepFrequencyForUnit
Appearance
| 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 |
| unitId | The Unit ID of the aircraft/vehicle whose radio should be configured (obtained via Unit.getByName(name):getID()). | |
| freq | Desired frequency. Accepts MHz or Hz – values ≥ 500 are treated as Hz, otherwise they are multiplied by 1 000 000 to convert to Hz. | |
| modulationID | Modulation 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: | ||