Jump to content

[ISSUE] "TransmitMessage" command via LUA script.


Go to solution Solved by cfrag,

Recommended Posts

Posted

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 

 

My Stuff:    I've got basic 3D CAD knowledge, intermediate LUA/C# knowledge and high DCS mission editor, scripting and livery creation skills.

Hit me up if Your needs overlap with my abilities. 

I'm developing an Ace Combat-04 inspired campaign/fan fiction. If You are a hobby storywriter, Ace Combat fan or green beret at DCS scripting and/or want to embed Your ideas into this passion project, DM me.  

image.png

My YouTube: https://www.youtube.com/@cerious1409

  • Solution
Posted
16 hours ago, cerious1409 said:

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. 

This may be a silly question: how do you make sure that the audio file still is inside your mission? If you strip all the trigger rules that refer to your audio file, Mission Editor will also strip the audio file from the mission. This means that mission designers usually add a 'output sound' trigger for all audio files that are only referenced by Lua scripts to their missions, and these sounds play very late (some 9999999 seconds after mission start) to ensure that the sound files are present in the miz

Posted
vor 6 Stunden schrieb cfrag:

This may be a silly question: how do you make sure that the audio file still is inside your mission? If you strip all the trigger rules that refer to your audio file, Mission Editor will also strip the audio file from the mission. This means that mission designers usually add a 'output sound' trigger for all audio files that are only referenced by Lua scripts to their missions, and these sounds play very late (some 9999999 seconds after mission start) to ensure that the sound files are present in the miz

 Thank you. That was the problem and the reason why it stopped working in the first place. It's fixed now

My Stuff:    I've got basic 3D CAD knowledge, intermediate LUA/C# knowledge and high DCS mission editor, scripting and livery creation skills.

Hit me up if Your needs overlap with my abilities. 

I'm developing an Ace Combat-04 inspired campaign/fan fiction. If You are a hobby storywriter, Ace Combat fan or green beret at DCS scripting and/or want to embed Your ideas into this passion project, DM me.  

image.png

My YouTube: https://www.youtube.com/@cerious1409

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...