Riscorider Posted January 19, 2024 Posted January 19, 2024 (edited) I'm trying to have sounds play to an individual unit or group when certain events occur during a mission running on a multiplayer server. So far the sounds play for me in any unit I occupy when I am testing (When joining a unit on the server I am hosting) but when another player/client occupies a unit the targeted sound and text does not play to that individual. I've tried using the DCS Simulator Scripting Engine and Moose. Example script shown below: CPH_PLAYERENTERUNITHANDLER = {} function CPH_PLAYERENTERUNITHANDLER:onEvent(Event) if Event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then local PlayerUnit = Event.initiator local PlayerGroup = Event.initiator:getGroup() local PlayerGroupName = PlayerGroup:getName() local PlayerGroupID = Group.getByName(PlayerGroupName):getID() -- for SSE Sound to Group function local PlayerName = Event.initiator:getPlayerName() local PlayerUnitName = Event.initiator:getName() local PlayerUnitID = Event.initiator:getID() -- For SSE Sound to Unit Trigger function local StartupGroupName = GROUP:FindByName(PlayerGroupName) -- for Moose Sound function local StartupSound1 = USERSOUND:New("Start Me Up Edit.ogg") -- Moose --trigger.action.outText(PlayerName.." is the Player Name", 25) -- Used during debugging --trigger.action.outText(PlayerUnitName.." is the Player Unit Name", 25) -- Used during debugging --trigger.action.outText(PlayerUnitID.." is the Player Unit ID", 25) -- Used during debugging --trigger.action.outText(PlayerGroupName.." is the Player Group Name", 25) -- Used during debugging --trigger.action.outText(PlayerGroupID.." is the Player Group ID", 25) -- Used during debugging trigger.action.outSoundForGroup(PlayerGroupID, "Start Me Up Edit.ogg" ) -- DCS SSE command for sound to group (similar for unit) -- StartupSound1:ToGroup( StartupGroupName, 3 ) -- Moose command for sound to group (similar for unit) else end end world.addEventHandler(CPH_PLAYERENTERUNITHANDLER) Some lines currently shown as commented out as I've tried various combinations to get the sound file to play to an individual unit, or an individual group (only one unit in a group) and client. So far no joy using scripting. Even tried the mission editor (Unit Alive) but it didn't work in multiplayer either. I can use the event script shown above to send sound and/or text to a Coalition, or All successfully so I know the event handler works, just can't get the commands for an individual unit or group to work in multiplayer environment (except for the server host). Am I doing something wrong or is it just not possible to use the sound to unit or sound to group capability in multiplayer servers? Any help appreciated! Edited January 19, 2024 by Riscorider
cfrag Posted January 19, 2024 Posted January 19, 2024 AFAIK, the player enter doesn’t correctly trigger for multiplayer. Try the birth event, and then check if the birthed unit is a player unit.
Riscorider Posted January 20, 2024 Author Posted January 20, 2024 It hasn't been working with other event handlers either. The event handlers are working because I can use them to send messages and/or sound to coalition or to all but have been unsuccessful in sending sound or messages to a group or an individual unit other that the server host when in a multiplayer environment. Researching the DCS forum and Moose Discord seems to indicate its possible but I just haven't discovered what I'm doing wrong.
Recommended Posts