Jump to content

Playing sounds or radio transmissions with lua


Recommended Posts

Hey,

 

I'm currently working on a script that is supposed to transmit several messages to the players radio. After digging through the forum I thought I found the solution. I initialized the sounds via trigger so they get saved into the miz, then I've added 'l10n/DEFAULT/' to the path. Sadly it doesn't seem to work. I can see the function is called because I've added a outText line but no sound is playing.

 

I've also tried trigger.action.outSound but no success. The log gives me no error, I have no idea what I'm missing, it actually drives me crazy

Based on the following two posts it should work but I guess an update must have changed something. Playing the sounds via ME trigger works for both, radio transmissions and generic sounds.

 

I'd appreciate any help or recommendations on where I could find a solution for this. Thank you!

 

https://forums.eagle.ru/showthread.php?t=151519

https://forums.eagle.ru/showthread.php?t=158299

 

 

local function BASE_Homing() 
trigger.action.outText("<< Example Text >>", 10) 
end

local function BASE_Homing_v()
trigger.action.radioTransmission("l10n/DEFAULT/BASE_Homing_start.ogg", trigger.misc.getZone("ATC1").point, radio.modulation.AM, true, 30000000, 39.6, "ATC_test")
end


timer.scheduleFunction(BASE_Homing, {}, timer.getTime() + 3)
timer.scheduleFunction(BASE_Homing_v, {}, timer.getTime() + 3)

 

 

Logs

2020-06-20 12:36:13.200 INFO    VISUALIZER: TerrainRenderer::release
2020-06-20 12:36:13.528 WARNING LOG: 2 duplicate message(s) skipped.
2020-06-20 12:36:13.528 INFO    DCS: Screen: MissionEditor
2020-06-20 12:36:15.486 INFO    Dispatcher: loadMission C:\Users\Kirschi\AppData\Local\Temp\DCS\tempMission.miz
2020-06-20 12:36:15.487 INFO    WORLDGENERAL: loading mission from: "C:\Users\Kirschi\AppData\Local\Temp\DCS\tempMission.miz"
2020-06-20 12:36:15.569 INFO    EDCORE: (dDispatcher)enterToState_:4
2020-06-20 12:36:15.572 INFO    Dispatcher: Start
2020-06-20 12:36:15.605 INFO    Dispatcher: Terrain theatre Caucasus
2020-06-20 12:36:15.607 INFO    TERRAIN: lSystem::load(./Mods/terrains/Caucasus\terrain.cfg.lua)
2020-06-20 12:36:15.607 INFO    TERRAIN: lSystem::CleanScenes()
2020-06-20 12:36:15.607 INFO    TERRAIN: lSystem::InitScenes()
2020-06-20 12:36:15.607 INFO    EDTERRAIN4: lTerraDispatchImpl::setDate( day=21, month=6)
2020-06-20 12:36:15.616 WARNING GRAPHICSCORE: already registered Renderer callback
2020-06-20 12:36:15.626 INFO    VISUALIZER: StartSimulation
2020-06-20 12:36:17.281 INFO    VISUALIZER: cascade shadows init (preset:'current' quality:0 layers:1 size:1)
2020-06-20 12:36:17.292 ERROR_ONCE DX11BACKEND: render target 'fftw_foam' not found
2020-06-20 12:36:17.729 ERROR_ONCE DX11BACKEND: render target 'mainDepthBuffer_copy' not found
2020-06-20 12:36:17.729 ERROR_ONCE DX11BACKEND: render target 'DummyShadowMap' not found
2020-06-20 12:36:17.734 INFO    Dispatcher: initial random seed = 6578355
2020-06-20 12:36:17.734 INFO    Dispatcher: apply random seed = 6578355
2020-06-20 12:36:17.763 INFO    WORLDGENERAL: loaded from mission Scripts/World/GPS_GNSS.lua
2020-06-20 12:36:18.132 INFO    WORLDGENERAL: loaded from mission Config/View/SnapViewsDefault.lua
2020-06-20 12:36:18.133 INFO    WORLDGENERAL: loaded from mission Config/View/View.lua
2020-06-20 12:36:18.134 INFO    WORLDGENERAL: loaded from mission Config/View/Server.lua
2020-06-20 12:36:18.195 INFO    Config: netview started
2020-06-20 12:36:18.198 INFO    VISUALIZER: CameraIndependedPreload()
2020-06-20 12:36:18.198 INFO    VISUALIZER: CameraIndependedPreload() finished
2020-06-20 12:36:18.198 INFO    DCS: use_xRay: no
2020-06-20 12:36:18.653 INFO    DCS: MissionSpawn:initScript
2020-06-20 12:36:18.653 INFO    DCS: MissionSpawn:spawnCoalition red
2020-06-20 12:36:18.653 INFO    DCS: MissionSpawn:spawnCoalition blue
2020-06-20 12:36:18.653 INFO    DCS: MissionSpawn:spawnPlanes 66
2020-06-20 12:36:18.657 INFO    DCS: MissionSpawn:spawnLocalPlayer 1,Bf-109K-4
2020-06-20 12:36:18.669 WARNING EDCORE: Source ./Mods/aircraft/Bf-109K-4/Cockpit/Scripts/../Textures/Cockpit_Bf-109K-4_Textures is already mounted to the same mount /textures/.
2020-06-20 12:36:18.670 WARNING EDCORE: Source ./Mods/aircraft/Bf-109K-4/Cockpit/Scripts/../Shape is already mounted to the same mount /models/.
2020-06-20 12:36:18.828 INFO    COCKPITBASE: lua state still active MACROS, 12 (status undefined)
2020-06-20 12:36:18.828 INFO    COCKPITBASE: lua state still active INTERCOM, 15 (status undefined)
2020-06-20 12:36:18.833 INFO    WORLDGENERAL: loaded from mission Scripts/World/birds.lua
2020-06-20 12:36:20.888 INFO    VISUALIZER: Preload() camera=-373044.068618, 1998.990688, 612587.117788 radius=9800.000000
2020-06-20 12:36:20.888 INFO    EDTERRAINGRAPHICS41: ITerrainGraphicsImpl4::forceLoading(): pos=(-373044, 1998.99, 612587), radius=9800
2020-06-20 12:36:21.978 INFO    EDTERRAINGRAPHICS41: surface5 clean up LOD 0: left 4  released 2
2020-06-20 12:36:21.978 INFO    EDTERRAINGRAPHICS41: surface5 clean up LOD 1: left 4  released 47
2020-06-20 12:36:21.978 INFO    EDTERRAINGRAPHICS41: surface5 clean up 0.893200 ms
2020-06-20 12:36:23.179 ERROR_ONCE DX11BACKEND: texture 'bf-109k-4_spec' not found. Asked from 'NGMODEL'
2020-06-20 12:36:23.181 ERROR   DX11BACKEND: Texture /textures/flame_EXH_1_2.dds is 3d but has depth == 1.
2020-06-20 12:36:24.436 INFO    VISUALIZER: Preload() finished
2020-06-20 12:36:24.571 INFO    DCS: Screen: mission_offline
2020-06-20 12:36:24.573 INFO    Dispatcher: precache units resources in slots
2020-06-20 12:36:24.596 INFO    Lua: Lua CPU usage: metric: average mission loading: 23.6336 %
2020-06-20 12:36:24.596 INFO    Dispatcher: loadMission Done: Сontrol passed to the player
2020-06-20 12:37:01.707 INFO    Lua: Lua CPU usage: metric: average mission execution: 4.5581 %
2020-06-20 12:37:02.637 INFO    Dispatcher: Stop
2020-06-20 12:37:02.881 INFO    Config: netview stopped
2020-06-20 12:37:02.896 INFO    TERRAIN: lSystem::CleanScenes()
2020-06-20 12:37:02.900 INFO    VISUALIZER: StopSimulation
2020-06-20 12:37:02.901 INFO    VISUALIZER: Stopped collection of statistic.
2020-06-20 12:37:02.932 INFO    EDCORE: (dDispatcher)enterToState_:3
2020-06-20 12:37:02.943 INFO    VISUALIZER: TerrainRenderer::release
2020-06-20 12:37:04.630 WARNING LOG: 3 duplicate message(s) skipped.
2020-06-20 12:37:04.630 INFO    DCS: Screen: MissionEditor


Edited by DonCalzone
Link to comment
Share on other sites

Thanks for the reply, it's working now via trigger.action.outSound but I still can't hear the radio transmission. One thing was the filename in the scipt as you mentioned but I also made another mistake by inizializing the sounds only for the red faction. Had to use PlaySoundToAll. I've also realized that I messed up the syntax of trigger.action.radioTransmission because I switched Hz with power.

 

The 'l10n/DEFAULT/' part seems to be obsolete.

 

Now it looks like this (without the ouText func)

local function BASE_Homing_v() trigger.action.radioTransmission("BASE_Homing_start.ogg", trigger.misc.getZone("ATC1").point, radio.modulation.AM, true, 039600000, 420) end


timer.scheduleFunction(BASE_Homing_v, {}, timer.getTime() + 3)

 

The wiki says that Hz requires 9 digits, so 39.6 MHz should be 039600000, right? I did set up the trigger zone 'ATC1' and the player is withing the zone when broadcasting the message. The radio is also turned on and every channel is set to 39.6MHz.


Edited by DonCalzone
Link to comment
Share on other sites

Turns out the 'l10n/DEFAULT/' is necessary for trigger.action.radioTransmission.

 

So if anyone is stumbling upon the same issue, here is the final snippet of the syntax:

 

local function BASE_Homing_v() trigger.action.radioTransmission("l10n/DEFAULT/BASE_Homing_start.ogg", trigger.misc.getZone("ATC1").point, radio.modulation.AM, false, 39600000, 420, "ATC1") end

local function BASE_Homing_v2() trigger.action.outSound("The Storm.ogg" )	end


timer.scheduleFunction(BASE_Homing_v, {}, timer.getTime() + 3)
timer.scheduleFunction(BASE_Homing_v2, {}, timer.getTime() + 3)

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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