mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
Added new parameter to createRadioBeaconAtZone
Beacons can now be named using the mission editor DO SCRIPT ctld.createRadioBeaconAtZone
This commit is contained in:
45
CTLD.lua
45
CTLD.lua
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
See https://github.com/ciribob/DCS-CTLD for a user manual and the latest version
|
See https://github.com/ciribob/DCS-CTLD for a user manual and the latest version
|
||||||
|
|
||||||
Version: 1.25 - 19/07/2015 - Changes Autoload behaviour to load troops / vehicles in a pickup zone first
|
Version: 1.26 - 27/07/2015 - Added new parameter to Mission Editor added beacons so they can be named
|
||||||
- Fixed bug where AI would load troops while in the air in a heli by holding a perfect hover
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ ctld.buildTimeFOB = 120 --time in seconds for the FOB to be built
|
|||||||
ctld.radioSound = "beacon.ogg" -- the name of the sound file to use for the FOB radio beacons. If this isnt added to the mission BEACONS WONT WORK!
|
ctld.radioSound = "beacon.ogg" -- the name of the sound file to use for the FOB radio beacons. If this isnt added to the mission BEACONS WONT WORK!
|
||||||
ctld.radioSoundFC3 = "beaconsilent.ogg" -- name of the second silent radio file, used so FC3 aircraft dont hear ALL the beacon noises... :)
|
ctld.radioSoundFC3 = "beaconsilent.ogg" -- name of the second silent radio file, used so FC3 aircraft dont hear ALL the beacon noises... :)
|
||||||
|
|
||||||
ctld.deployedBeaconBattery = 20 -- the battery on deployed beacons will last for this number minutes before needing to be re-deployed
|
ctld.deployedBeaconBattery = 30 -- the battery on deployed beacons will last for this number minutes before needing to be re-deployed
|
||||||
|
|
||||||
ctld.enabledRadioBeaconDrop = true -- if its set to false then beacons cannot be dropped by units
|
ctld.enabledRadioBeaconDrop = true -- if its set to false then beacons cannot be dropped by units
|
||||||
|
|
||||||
@@ -483,12 +483,12 @@ end
|
|||||||
|
|
||||||
-- Creates a radio beacon on a random UHF - VHF and HF/FM frequency for homing
|
-- Creates a radio beacon on a random UHF - VHF and HF/FM frequency for homing
|
||||||
-- This WILL NOT WORK if you dont add beacon.ogg and beaconsilent.ogg to the mission!!!
|
-- This WILL NOT WORK if you dont add beacon.ogg and beaconsilent.ogg to the mission!!!
|
||||||
-- e.g. ctld.createRadioBeaconAtZone("beaconZone","red", 1440) will create a beacon at trigger zone "beaconZone" for the Red side
|
-- e.g. ctld.createRadioBeaconAtZone("beaconZone","red", 1440,"Waypoint 1") will create a beacon at trigger zone "beaconZone" for the Red side
|
||||||
-- that will last 1440 minutes (24 hours )
|
-- that will last 1440 minutes (24 hours ) and named "Waypoint 1" in the list of radio beacons
|
||||||
--
|
--
|
||||||
-- e.g. ctld.createRadioBeaconAtZone("beaconZoneBlue","blue", 20) will create a beacon at trigger zone "beaconZoneBlue" for the Blue side
|
-- e.g. ctld.createRadioBeaconAtZone("beaconZoneBlue","blue", 20) will create a beacon at trigger zone "beaconZoneBlue" for the Blue side
|
||||||
-- that will last 20 minutes
|
-- that will last 20 minutes
|
||||||
function ctld.createRadioBeaconAtZone(_zone, _coalition, _batteryLife)
|
function ctld.createRadioBeaconAtZone(_zone, _coalition, _batteryLife, _name)
|
||||||
local _triggerZone = trigger.misc.getZone(_zone) -- trigger to use as reference position
|
local _triggerZone = trigger.misc.getZone(_zone) -- trigger to use as reference position
|
||||||
|
|
||||||
if _triggerZone == nil then
|
if _triggerZone == nil then
|
||||||
@@ -498,10 +498,16 @@ function ctld.createRadioBeaconAtZone(_zone, _coalition, _batteryLife)
|
|||||||
|
|
||||||
local _zonePos = mist.utils.zoneToVec3(_zone)
|
local _zonePos = mist.utils.zoneToVec3(_zone)
|
||||||
|
|
||||||
|
ctld.beaconCount = ctld.beaconCount + 1
|
||||||
|
|
||||||
|
if _name == nil or _name == "" then
|
||||||
|
_name = "Beacon #"..ctld.beaconCount
|
||||||
|
end
|
||||||
|
|
||||||
if _coalition == "red" then
|
if _coalition == "red" then
|
||||||
ctld.createRadioBeacon(_zonePos, 1, 0, false, _batteryLife) --1440
|
ctld.createRadioBeacon(_zonePos, 1, 0, _name, _batteryLife) --1440
|
||||||
else
|
else
|
||||||
ctld.createRadioBeacon(_zonePos, 2, 2, false, _batteryLife) --1440
|
ctld.createRadioBeacon(_zonePos, 2, 2, _name, _batteryLife) --1440
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1955,7 +1961,11 @@ function ctld.unpackFOBCrates(_crates, _heli)
|
|||||||
--make it able to deploy crates
|
--make it able to deploy crates
|
||||||
table.insert(ctld.logisticUnits, _fob:getName())
|
table.insert(ctld.logisticUnits, _fob:getName())
|
||||||
|
|
||||||
local _radioBeaconDetails = ctld.createRadioBeacon(_args[1], _args[3], _args[2], true)
|
ctld.beaconCount = ctld.beaconCount + 1
|
||||||
|
|
||||||
|
local _radioBeaconName = "FOB Beacon #"..ctld.beaconCount
|
||||||
|
|
||||||
|
local _radioBeaconDetails = ctld.createRadioBeacon(_args[1], _args[3], _args[2], _radioBeaconName,nil,true)
|
||||||
|
|
||||||
ctld.fobBeacons[_name] = { vhf = _radioBeaconDetails.vhf, uhf = _radioBeaconDetails.uhf, fm = _radioBeaconDetails.fm }
|
ctld.fobBeacons[_name] = { vhf = _radioBeaconDetails.vhf, uhf = _radioBeaconDetails.uhf, fm = _radioBeaconDetails.fm }
|
||||||
|
|
||||||
@@ -2057,7 +2067,7 @@ end
|
|||||||
--spawns a radio beacon made up of two units,
|
--spawns a radio beacon made up of two units,
|
||||||
-- one for VHF and one for UHF
|
-- one for VHF and one for UHF
|
||||||
-- The units are set to to NOT engage
|
-- The units are set to to NOT engage
|
||||||
function ctld.createRadioBeacon(_point, _coalition, _country, _isFOB, _batteryTime)
|
function ctld.createRadioBeacon(_point, _coalition, _country, _name, _batteryTime,_isFOB)
|
||||||
|
|
||||||
local _uhfGroup = ctld.spawnRadioBeaconUnit(_point, _country, "UHF")
|
local _uhfGroup = ctld.spawnRadioBeaconUnit(_point, _country, "UHF")
|
||||||
local _vhfGroup = ctld.spawnRadioBeaconUnit(_point, _country, "VHF")
|
local _vhfGroup = ctld.spawnRadioBeaconUnit(_point, _country, "VHF")
|
||||||
@@ -2080,14 +2090,14 @@ function ctld.createRadioBeacon(_point, _coalition, _country, _isFOB, _batteryTi
|
|||||||
|
|
||||||
--local _mgrsString = mist.tostringMGRS(coord.LLtoMGRS(coord.LOtoLL(_point)), 5)
|
--local _mgrsString = mist.tostringMGRS(coord.LLtoMGRS(coord.LOtoLL(_point)), 5)
|
||||||
|
|
||||||
local _message = ""
|
local _message = _name
|
||||||
|
|
||||||
if _isFOB then
|
if _isFOB then
|
||||||
_message = "FOB " .. _message
|
-- _message = "FOB " .. _message
|
||||||
_battery = -1 --never run out of power!
|
_battery = -1 --never run out of power!
|
||||||
end
|
end
|
||||||
|
|
||||||
_message = _message .. _latLngStr
|
_message = _message.." - ".. _latLngStr
|
||||||
|
|
||||||
-- env.info("GEN UHF: ".. _freq.uhf)
|
-- env.info("GEN UHF: ".. _freq.uhf)
|
||||||
-- env.info("GEN VHF: ".. _freq.vhf)
|
-- env.info("GEN VHF: ".. _freq.vhf)
|
||||||
@@ -2096,7 +2106,7 @@ function ctld.createRadioBeacon(_point, _coalition, _country, _isFOB, _batteryTi
|
|||||||
|
|
||||||
_message = string.format("%s - %.2f MHz", _message, _freq.uhf / 1000000)
|
_message = string.format("%s - %.2f MHz", _message, _freq.uhf / 1000000)
|
||||||
|
|
||||||
_message = string.format("%s - %.3f MHz ", _message, _freq.fm / 1000000)
|
_message = string.format("%s - %.2f MHz ", _message, _freq.fm / 1000000)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2348,7 +2358,10 @@ function ctld.dropRadioBeacon(_args)
|
|||||||
--try to spawn at 12 oclock to us
|
--try to spawn at 12 oclock to us
|
||||||
local _point = ctld.getPointAt12Oclock(_heli, 50)
|
local _point = ctld.getPointAt12Oclock(_heli, 50)
|
||||||
|
|
||||||
local _radioBeaconDetails = ctld.createRadioBeacon(_point, _heli:getCoalition(), _heli:getCountry(), false)
|
ctld.beaconCount = ctld.beaconCount + 1
|
||||||
|
local _name = "Beacon #"..ctld.beaconCount
|
||||||
|
|
||||||
|
local _radioBeaconDetails = ctld.createRadioBeacon(_point, _heli:getCoalition(), _heli:getCountry(), _name,nil,false)
|
||||||
|
|
||||||
-- mark with flare?
|
-- mark with flare?
|
||||||
|
|
||||||
@@ -4237,6 +4250,8 @@ ctld.fobBeacons = {} -- stores FOB radio beacon details, refreshed every 60 seco
|
|||||||
|
|
||||||
ctld.deployedRadioBeacons = {} -- stores details of deployed radio beacons
|
ctld.deployedRadioBeacons = {} -- stores details of deployed radio beacons
|
||||||
|
|
||||||
|
ctld.beaconCount = 1
|
||||||
|
|
||||||
ctld.usedUHFFrequencies = {}
|
ctld.usedUHFFrequencies = {}
|
||||||
ctld.usedVHFFrequencies = {}
|
ctld.usedVHFFrequencies = {}
|
||||||
ctld.usedFMFrequencies = {}
|
ctld.usedFMFrequencies = {}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ The script supports:
|
|||||||
* BRMD-2
|
* BRMD-2
|
||||||
* FOB Building
|
* FOB Building
|
||||||
* Homing using FM Radio Beacon
|
* Homing using FM Radio Beacon
|
||||||
* Easy Beacon Creation using Mission Editor
|
* Easy Beacon Creation using Mission Editor plus Beacon Naming
|
||||||
* Radio Beacon Deployment
|
* Radio Beacon Deployment
|
||||||
* Ability to deploy a homing beacon that the A10C, Ka-50, Mi-8 and Huey can home on
|
* Ability to deploy a homing beacon that the A10C, Ka-50, Mi-8 and Huey can home on
|
||||||
* Pre loading of units into AI vehicles via a DO SCRIPT
|
* Pre loading of units into AI vehicles via a DO SCRIPT
|
||||||
@@ -199,11 +199,11 @@ ctld.spawnGroupAtTrigger("blue", 5, "spawnTrigger2", 2000)
|
|||||||
```
|
```
|
||||||
|
|
||||||
####Create Radio Beacon at Zone
|
####Create Radio Beacon at Zone
|
||||||
A radio beacon can be spawned at any zone by adding a Trigger Once with a Time More set to any time after the CTLD script has been loaded and a DO SCRIPT action of ```ctld.createRadioBeaconAtZone("beaconZone","red", 1440)```
|
A radio beacon can be spawned at any zone by adding a Trigger Once with a Time More set to any time after the CTLD script has been loaded and a DO SCRIPT action of ```ctld.createRadioBeaconAtZone("beaconZone","red", 1440,"Waypoint 1")```
|
||||||
|
|
||||||
Where ```"beaconZone"``` is the name of a Trigger Zone added using the mission editor, ```"red"``` is the side to add the beacon for and ```1440``` the time in minutes for the beacon to broadcast for.
|
Where ```"beaconZone"``` is the name of a Trigger Zone added using the mission editor, ```"red"``` is the side to add the beacon for and ```1440``` the time in minutes for the beacon to broadcast for. An optional parameter can be added at the end which can be used to name the beacon and the name will appear in the beacon list.
|
||||||
|
|
||||||
```ctld.createRadioBeaconAtZone("beaconZoneBlue","blue", 20)``` will create a beacon at trigger zone named ```"beaconZoneBlue"``` for the Blue coalition that will last 20 minutes.
|
```ctld.createRadioBeaconAtZone("beaconZoneBlue","blue", 20)``` will create a beacon at trigger zone named ```"beaconZoneBlue"``` for the Blue coalition that will last 20 minutes and have an auto generated name.
|
||||||
|
|
||||||
Spawned beacons will broadcast on HF/FM, UHF and VHF until their battery runs out and can be used by most aircraft for ADF. The frequencies used on each frequency will be random.
|
Spawned beacons will broadcast on HF/FM, UHF and VHF until their battery runs out and can be used by most aircraft for ADF. The frequencies used on each frequency will be random.
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
BIN
test-mission.miz
BIN
test-mission.miz
Binary file not shown.
Reference in New Issue
Block a user