• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Problem with playing music

Status
Not open for further replies.
Level 5
Joined
Oct 20, 2019
Messages
60
Hello, i imported a music file and what im trying to do is to play this music to specific players during boss fights

But the music only works when im playing it to everyone on the map simultaneously and not when im trying to play it to specific players only

Also i dont know if this would cause any desync problems, hopefully someone can confirm that for me

This is what it looks like now

  • Start Boss Music Left
    • Events
      • Unit - A unit enters Player 12 Spawn Left <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Trekk the Wise 6
              • (Unit-type of (Triggering unit)) Equal to Mhodrok the Mighty 12
              • (Unit-type of (Triggering unit)) Equal to Sarix the Merciless 18
              • (Unit-type of (Triggering unit)) Equal to Zhakkro the Voodoo Shaman 24
              • (Unit-type of (Triggering unit)) Equal to Kozka the Ogre Warlord 30
              • (Unit-type of (Triggering unit)) Equal to Izri the Corrupted Spirit of Eternity 36
              • (Unit-type of (Triggering unit)) Equal to Ylfidir the Corrupted Ancient Treant of Life 42
              • (Unit-type of (Triggering unit)) Equal to Goro the Corrupt Nightmare 48
              • (Unit-type of (Triggering unit)) Equal to Narjz the God of Corruption 54
        • Then - Actions
          • Custom script: if GetLocalPlayer() == udg_Player1 then
          • Sound - Play When_Legends_Rise_Boss_Music <gen>
          • Custom script: endif
        • Else - Actions
 
Level 13
Joined
May 10, 2009
Messages
868
Your trigger is lacking some crucial information about which players are participating in that boss fight. As is, the trigger logic is just attempting to play a sound effect for player 1 only.

Is there any other trigger that keeps track of players that join in that boss fight?

Also i dont know if this would cause any desync problems, hopefully someone can confirm that for me
Playing sound effects locally shouldn't cause desync.
 
Last edited:
Level 5
Joined
Oct 20, 2019
Messages
60
I store every player in a player variable and those are in another trigger setup

The idea is like this, the map has a total of 10 players, there are two teams with 5 players each
when team 1 encounters a boss, the music starts and when the boss dies, the music ends and the exact same thing should happen with team 2

i guess the triggers should look something like this maybe?

  • Start Boss Music Left
    • Events
      • Unit - A unit enters Player 12 Spawn Left <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Trekk the Wise 6
              • (Unit-type of (Triggering unit)) Equal to Mhodrok the Mighty 12
              • (Unit-type of (Triggering unit)) Equal to Sarix the Merciless 18
              • (Unit-type of (Triggering unit)) Equal to Zhakkro the Voodoo Shaman 24
              • (Unit-type of (Triggering unit)) Equal to Kozka the Ogre Warlord 30
              • (Unit-type of (Triggering unit)) Equal to Izri the Corrupted Spirit of Eternity 36
              • (Unit-type of (Triggering unit)) Equal to Ylfidir the Corrupted Ancient Treant of Life 42
              • (Unit-type of (Triggering unit)) Equal to Goro the Corrupt Nightmare 48
              • (Unit-type of (Triggering unit)) Equal to Narjz the God of Corruption 54
        • Then - Actions
          • Set VariableSet Player1 = Player 1 (Red)
          • Set VariableSet Player2 = Player 2 (Blue)
          • Set VariableSet Player3 = Player 3 (Teal)
          • Set VariableSet Player4 = Player 4 (Purple)
          • Set VariableSet Player5 = Player 5 (Yellow)
          • Custom script: if GetLocalPlayer() == udg_Player1 then
          • Custom script: if GetLocalPlayer() == udg_Player2 then
          • Custom script: if GetLocalPlayer() == udg_Player3 then
          • Custom script: if GetLocalPlayer() == udg_Player4 then
          • Custom script: if GetLocalPlayer() == udg_Player5 then
          • Sound - Play When_Legends_Rise_Boss_Music <gen>
          • Custom script: endif
        • Else - Actions

  • Stop Boss Music Left
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Trekk the Wise 6
              • (Unit-type of (Triggering unit)) Equal to Mhodrok the Mighty 12
              • (Unit-type of (Triggering unit)) Equal to Sarix the Merciless 18
              • (Unit-type of (Triggering unit)) Equal to Zhakkro the Voodoo Shaman 24
              • (Unit-type of (Triggering unit)) Equal to Kozka the Ogre Warlord 30
              • (Unit-type of (Triggering unit)) Equal to Izri the Corrupted Spirit of Eternity 36
              • (Unit-type of (Triggering unit)) Equal to Ylfidir the Corrupted Ancient Treant of Life 42
              • (Unit-type of (Triggering unit)) Equal to Goro the Corrupt Nightmare 48
              • (Unit-type of (Triggering unit)) Equal to Narjz the God of Corruption 54
        • Then - Actions
          • Custom script: if GetLocalPlayer() == udg_Player1 then
          • Custom script: if GetLocalPlayer() == udg_Player2 then
          • Custom script: if GetLocalPlayer() == udg_Player3 then
          • Custom script: if GetLocalPlayer() == udg_Player4 then
          • Custom script: if GetLocalPlayer() == udg_Player5 then
          • Sound - Stop music After fading
          • Custom script: endif
        • Else - Actions

my knowledge with custom scripts are rather poor and this is only what i have found online so i dont know if this is on the right path or not

but i would be forever grateful if someone could show me how to make this work properly
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
You have two options :

1. Pick all players in team X and play the music for them.
  • Trigger 1
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in Team_A and do (Actions)
        • Loop - Actions
          • Custom script: if GetLocalPlayer () == GetEnumPlayer() then
          • Sound - Play When_Legends_Rise_Boss_Music <gen>
          • Custom script: endif
      • Custom script: call DestroyForce (udg_Team_A)
2. Play the music locally for each player.
  • Trigger 2
    • Events
    • Conditions
    • Actions
      • Set Music = When_Legends_Rise_Boss_Music <gen>
      • Custom script: call StartSoundForPlayerBJ(udg_Player1,udg_Music)
      • Custom script: call StartSoundForPlayerBJ(udg_Player2,udg_Music)
      • Custom script: call StartSoundForPlayerBJ(udg_Player3,udg_Music)
      • -------- etc --------
StartSoundForPlayerBJ works the same as GetLocalPlayer ()
JASS:
function StartSoundForPlayerBJ takes player whichPlayer, sound soundHandle returns nothing
    if (whichPlayer == GetLocalPlayer()) then
        call StartSound(soundHandle)
    endif
endfunction
 
Level 5
Joined
Oct 20, 2019
Messages
60
Thank you for providing me with this information(+rep), i tried option 1 and i am getting music whenever a boss appears, however its not the correct music for some reason, any idea why that is?

The imported music works ingame when i run it through a simple trigger so it should have been properly imported

I wanted to try option 2 aswell but i can't find wich type of variable you use on Set Music tho
 
Status
Not open for further replies.
Top