What is the Problem?
-Im unable to transmit a message via this command: https://wiki.hoggitworld.com/view/DCS_command_transmitMessage
Code?
-Of course:
//-------------CODE-------------------
--RadioLib----------------------------------------------------------------
--Zonenames: 'NONE', 'MISSION AREA', ...
--Unit: 1 = SkyEye(AWACS), Unit: 2 = Mobius-2(WINGMAN)
--Modulation 0=AM, 1=FM
--The goal of this script is to create a scalable library of radio transmissions for all important units participating in the campaign.
function radioLib(unit, number, zoneName, frequency, modulation, power, duration) --frequency, modulation, power are unused. The script is in a proof of concept state.
local skyeyeCommPath = {
"l10n/DEFAULT/Missile hit.wav",
"l10n/DEFAULT/Missile hit!.wav",
"l10n/DEFAULT/Mobius 1 shot down a bandit.wav",
"l10n/DEFAULT/Mobius 1 shot down a target.wav",
"l10n/DEFAULT/Your callsign is Mobius 1, its your name forever.wav"
}
local skyeyeCommSub = {
'"[AWACS]SkyEye: Missile hit."', --1
'"[AWACS]SkyEye: Missile hit!"', --2
'"[AWACS]SkyEye: Mobius 1 shot down a bandit!"', --3
'"[AWACS]SkyEye: Mobius 1 shot down a target!"', --4
'"[AWACS]SkyEye: Your callsign is Mobius-1, we´ll refer to you by this name at all times."' --5
}
local wingmanPath = {
'"l10n/DEFAULT/Missile hit.wav"' --PLACEHOLDER
}
local wingmanSub = {
'"[WINGMAN]Mobius-2: Pickle!"', --1
'"[WINGMAN]Mobius-2: Target hit!"', --2
'"[WINGMAN]Mobius-2: Copy, attacking Number 1!"', --3
'"[WINGMAN]Mobius-2: Affirm, bombs ready. Engaging Turret 2"', --4
'"[WINGMAN]Mobius-2: Copy, attacking Turret-3!"', --5
'"[WINGMAN]Mobius-2: Confirm, attacking Number 4!"', --6
'"[WINGMAN]Mobius-2: Bombs ready, engaging Number 5!"', --7
'"[WINGMAN]Mobius-2: Engaging Number 6!"', --8
'"[WINGMAN]Mobius-2: Copy, attacking Number 7!"', --9
'"[WINGMAN]Mobius-2: Out of bombs!"', --10
'"[WINGMAN]Mobius-2: Stonehenge destruction confirmed."', --11
'"[WINGMAN]Mobius-2: One of the yellows is going down. Thats a kill for Mobius-1!"' --12
}
--The command "TransmitMessage" refuses to work. Inside or outside this function I'm unable to transmit a radio transmission. To rule this out, I tried different ogg and .wav files. At some point this function stopped transmitting. What is wrong with it?
if zoneName == 'NONE' then
if unit == 1 then
local msg1 = {
id = "TransmitMessage",
params = {
duration = duration,
subtitle = skyeyeCommSub[number],
loop = true,
file = skyeyeCommPath[number],
}
}
Unit.getByName('SkyEye'):getController():setCommand(msg1)
trigger.action.outText(skyeyeCommSub[number], 10)
end
if unit == 2 then
trigger.action.outText(wingmanSub[number], 10)
end
end
end
//-----------------CODE-----------------------
The final product is this function:
radioLib( 1 , 5 , 'NONE' , 0, 0, 0, 10)
It should play a message, but it stubbornly refuses. I still hear the other radio dialogue originating from the unit, just not my custom one. There was a short period of time when the same function, put into another script as a test, worked. It ceased to work after I rewrote the script.
Using the ME and manually activating the "TransmitMessage" command works with all audio files listed. They are ruled out as the culprits. I also tried using .ogg instead of .wav, without any success.
I tried to get this to work for quite some time now, to no avail. Is there something I missed?
In short: I'm using the command "TransmitMessage" via LUA and it refuses to work.
Cheers
cerious1409