Jump to content

Moose GetGroup and trigger sound event to player


Recommended Posts

Posted (edited)

I'm working on a repeatable mission system using a radio item set flag to trigger a Moose script that spawns assets. Here's how the system works:

  • The mission allows players to use the comms menu to select a mission, which will spawn a set of assets that they can interact with.
  • Once the mission is completed (either successfully or failed), the flags are reset, and the mission is available again for users to select from the comms menu. Players can then try the mission again. This part is working as expected.

The issue I'm working on:

  • The spawned units are generated by a Moose script from a pool of assets and zones. For example, a group that gets spawned from a template like "B17escort" in the Mission Editor (ME) will appear as "B17escort#001".
  • I want to create a Moose script that will play a sound for human players whenever a specific group (e.g., "B17escort#001") enters a defined trigger zone, and the players are in a different trigger zone. This way, players flying near the assets will hear a sound cue, providing them with more dynamic interactions.

The logic I have in mind looks something like this:

  1. Define Zone 1: A trigger zone where the spawned asset (e.g., B17escort#001) will pass through.
  2. Define Zone 2: A trigger zone where human players might enter.
  3. Track the Spawned Group: As the "B17escort#001" group enters Zone 1, I want to grab its group ID for later use.
  4. Track the Human Player Groups: Players will be in Zone 2, I want to identify their group IDs. Since there might be multiple player groups in this zone, I need a way to capture and store all of them.
  5. Condition: If the spawned group (e.g., "B17escort#001") is in Zone 1, and any player group is in Zone 2, I want to play a sound to all players in Zone 2.

The problem I'm facing:

I'm struggling to figure out how to dynamically identify the group names of both the spawned asset and the players as they enter their respective zones. I’m also not sure how to trigger a sound specifically for the players in Zone 2 when the conditions are met.

Here’s a rough idea of how I think the script could work:

  • Define the zones by name (Zone1 for the B17escort#001 and Zone2 for players).
  • Check for group entry into Zone1 for the spawned asset and into Zone2 for the players.
  • Trigger the sound: If the asset enters Zone1 and the players are in Zone2, trigger a sound event for those players.

I would greatly appreciate any help, suggestions, or examples from the community on how to achieve this in DCS scripting. Specifically, I’m looking for guidance on:

  1. How to dynamically capture the group IDs when units (both players and assets) enter trigger zones.
  2. The best way to play a sound to players when a certain condition is met.
  3. General advice on improving this script to work reliably with Moose.

Thanks in advance for any help!

Current spawn script is ;
-- ----- B17 Escort Mission -------------------------------------------------------------------------------------------------------------
  MissionAssetTable1 = { "B17escort", "B17escort-1" }
 MissionZoneTable1 = { ZONE:New( "B17zone1" ), ZONE:New( "B17zone2" )}
 
 Spawn_Vehicle_1 = SPAWN:New( "B17escort" )
  :InitLimit( 4, 0 )
 -- :InitRandomizeRoute( 1, 1, 100 )
  :InitRandomizeZones( MissionZoneTable1 )
 :InitRandomizeTemplate( MissionAssetTable1 )
 :SpawnScheduled( 60, .2 )

Edited by 74DELTA
typo
  • Recently Browsing   0 members

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