• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Units in group with custom sound sets all speak for orders given

Status
Not open for further replies.
Level 3
Joined
Jan 8, 2022
Messages
64
Hello!

This is my first forum thread, if it isn't in the correct location please forgive me.

Problem:
Units with custom sound sets in the same group all speak at the same time when an order is given.

Example:
Order to move to a location, attack a unit, etc.

Additional Info:
-I have created custom unit sound sets using triggers.
-The trigger works great! Just need to solve this one issue.
-The template I used was from Uncle's Sound Example 2 which can be found here (pissed variation):
(Sound Help)

Question:
Is there a way to prioritize the sound set of the highlighted unit within a group when giving orders, and a way to silence all others in the group?

Any help would be much appreciated, Thanks!

(P.S. I am a noob with triggers and the solution would preferably need to be in GUI as I don't know how to code in JASS.)
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
can you show your triggers that aren't working?

 
Level 3
Joined
Jan 8, 2022
Messages
64
can you show your triggers that aren't working?


This is the trigger setup for each custom unit:

(Ignore the WarioPissed101/201 under Attack Sounds)

  • Wario Setup Sounds Pissed Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet WarioSelectSounds[1] = WarioWhat1 <gen>
      • Set VariableSet WarioSelectSounds[2] = WarioWhat2 <gen>
      • Set VariableSet WarioSelectSounds[3] = WarioWhat3 <gen>
      • Set VariableSet WarioSelectSounds[4] = WarioWhat4 <gen>
      • Set VariableSet WarioSelectDuration[1] = 1.50
      • Set VariableSet WarioSelectDuration[2] = 1.20
      • Set VariableSet WarioSelectDuration[3] = 0.90
      • Set VariableSet WarioSelectDuration[4] = 1.10
      • -------- --------
      • Set VariableSet WarioMoveSounds[1] = WarioYes1 <gen>
      • Set VariableSet WarioMoveSounds[2] = WarioYes2 <gen>
      • Set VariableSet WarioMoveSounds[3] = WarioYes3 <gen>
      • Set VariableSet WarioMoveSounds[4] = WarioYes4 <gen>
      • Set VariableSet WarioMoveSounds[5] = WarioYes5 <gen>
      • Set VariableSet WarioMoveSounds[6] = WarioYes6 <gen>
      • -------- --------
      • Set VariableSet WarioAttackSounds[1] = WarioAttack1 <gen>
      • Set VariableSet WarioAttackSounds[2] = WarioAttack2 <gen>
      • Set VariableSet WarioAttackSounds[3] = WarioAttack3 <gen>
      • Set VariableSet WarioAttackSounds[4] = WarioAttack4 <gen>
      • Set VariableSet WarioAttackSounds[5] = WarioAttack5 <gen>
      • Set VariableSet WarioAttackSounds[6] = WarioPissed101 <gen>
      • Set VariableSet WarioAttackSounds[7] = WarioPissed201 <gen>
      • -------- --------
      • Set VariableSet WarioPissedSounds[1] = Insane_Laugh_A <gen>
      • Set VariableSet WarioPissedSounds[2] = Insane_Laugh_B <gen>
      • Set VariableSet WarioPissedDuration[1] = 5.00
      • Set VariableSet WarioPissedDuration[2] = 10.00
  • Wario Additional Setup Sounds
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Summoned --------
      • Set VariableSet WarioSummonedSound = WarioReady1 <gen>
      • -------- Death Sounds --------
      • Set VariableSet WarioDeathSounds[1] = WarioDeath1 <gen>
      • Set VariableSet WarioDeathSounds[2] = WarioDeath2 <gen>
      • Set VariableSet WarioDeathSounds[3] = WarioDeath3 <gen>
      • Set VariableSet WarioDeathSounds[4] = WarioDeath4 <gen>
      • -------- ----------Fart- Sounds---------------- --------
      • Set VariableSet WarioFartSounds[1] = Fart1 <gen>
      • Set VariableSet WarioFartSounds[2] = FartSound2 <gen>
      • Set VariableSet WarioFartSounds[3] = FartSound3 <gen>
      • Set VariableSet WarioFartSounds[4] = FartSound4 <gen>
      • Set VariableSet WarioFartSounds[5] = FartSound5 <gen>
      • Set VariableSet WarioFartSounds[6] = FartSound6 <gen>
      • -------- Gut Punch Sounds --------
      • Set VariableSet WarioGutPunchSound[1] = GutPunchSound1 <gen>
      • Set VariableSet WarioGutPunchSound[2] = GutPunchSound2 <gen>
      • -------- Shell Toss --------
      • Set VariableSet ShellTossSounds[1] = Shell_Toss <gen>
      • Set VariableSet ShellTossSounds[2] = Wario_FIRE <gen>
  • Wario Play Select Sounds Pissed Config
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
      • Player - Player 13 (Maroon) Selects a unit
      • Player - Player 14 (Navy) Selects a unit
      • Player - Player 15 (Turquoise) Selects a unit
      • Player - Player 16 (Violet) Selects a unit
      • Player - Player 17 (Wheat) Selects a unit
      • Player - Player 18 (Peach) Selects a unit
      • Player - Player 19 (Mint) Selects a unit
      • Player - Player 20 (Lavender) Selects a unit
      • Player - Player 21 (Coal) Selects a unit
      • Player - Player 22 (Snow) Selects a unit
      • Player - Player 23 (Emerald) Selects a unit
      • Player - Player 24 (Peanut) Selects a unit
    • Conditions
      • WarioPreventSounds[(Player number of (Triggering player))] Equal to False
      • (Unit-type of (Triggering unit)) Equal to Treasure Hunter
    • Actions
      • Set VariableSet PN = (Player number of (Triggering player))
      • -------- --------
      • Set VariableSet WarioPreventSounds[PN] = True
      • Set VariableSet WarioPissedCounter[PN] = (WarioPissedCounter[PN] + 1)
      • Set VariableSet WarioSelectCounterNew[PN] = (WarioSelectCounterNew[PN] + 1)
      • Set VariableSet TempPlayer = (Triggering player)
      • Set VariableSet TempSound = No sound
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WarioPissedCounter[PN] Less than 4
        • Then - Actions
          • -------- What --------
          • Set VariableSet TempInteger = (Random integer number between 1 and 4)
          • Set VariableSet SoundDuration = WarioSelectDuration[TempInteger]
          • Custom script: if GetLocalPlayer() == udg_TempPlayer then
          • Set VariableSet TempSound = WarioSelectSounds[TempInteger]
          • Custom script: endif
          • Sound - Play TempSound at 100.00% volume, attached to (Triggering unit)
          • Wait 1.00 seconds
        • Else - Actions
          • -------- Pissed --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WarioPissedStory[PN] Less than 2
            • Then - Actions
              • Set VariableSet WarioPissedStory[PN] = (WarioPissedStory[PN] + 1)
            • Else - Actions
              • Set VariableSet WarioPissedStory[PN] = 1
          • Set VariableSet SoundDuration = WarioPissedDuration[WarioPissedStory[PN]]
          • Custom script: if GetLocalPlayer() == udg_TempPlayer then
          • Set VariableSet TempSound = WarioPissedSounds[WarioPissedStory[PN]]
          • Custom script: endif
          • Sound - Play TempSound at 100.00% volume, attached to (Triggering unit)
      • -------- --------
      • Wait SoundDuration seconds
      • Set VariableSet PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet WarioPreventSounds[PN] = False
      • Wait 2.00 seconds
      • Set VariableSet PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet WarioSelectCounterOld[PN] = (WarioSelectCounterOld[PN] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WarioSelectCounterNew[PN] Equal to WarioSelectCounterOld[PN]
        • Then - Actions
          • Set VariableSet WarioPissedCounter[PN] = 0
          • Set VariableSet WarioPissedStory[PN] = 0
        • Else - Actions
  • Wario Play Move Sounds Pissed Config
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] Equal to False
      • (Unit-type of (Triggering unit)) Equal to Treasure Hunter
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(move))
          • (Issued order) Equal to (Order(smart))
          • (Issued order) Equal to (Order(patrol))
          • (Issued order) Equal to (Order(attack))
    • Actions
      • Set VariableSet TempPlayer = (Owner of (Triggering unit))
      • Set VariableSet TempSound = No sound
      • Custom script: if GetLocalPlayer() == udg_TempPlayer then
      • Set VariableSet TempSound = WarioMoveSounds[(Random integer number between 1 and 6)]
      • Custom script: endif
      • Sound - Play TempSound at 100.00% volume, attached to (Triggering unit)
      • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = True
      • Wait 2.00 seconds
      • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = False
  • Wario Play Attack Sounds Pissed Config
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Treasure Hunter
      • ((Target unit of issued order) belongs to an enemy of (Owner of (Triggering unit)).) Equal to True
    • Actions
      • Unit - Order (Triggering unit) to Attack (Targeted unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Set VariableSet TempPlayer = (Owner of (Triggering unit))
          • Set VariableSet TempSound = No sound
          • Custom script: if GetLocalPlayer() == udg_TempPlayer then
          • Set VariableSet TempSound = WarioAttackSounds[(Random integer number between 1 and 7)]
          • Custom script: endif
          • Sound - Play TempSound at 100.00% volume, attached to (Triggering unit)
          • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = True
          • Wait 2.00 seconds
          • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = False
        • Else - Actions
  • Wario Play Attack Sounds Pissed Config
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Treasure Hunter
      • ((Target unit of issued order) belongs to an enemy of (Owner of (Triggering unit)).) Equal to True
    • Actions
      • Unit - Order (Triggering unit) to Attack (Targeted unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Set VariableSet TempPlayer = (Owner of (Triggering unit))
          • Set VariableSet TempSound = No sound
          • Custom script: if GetLocalPlayer() == udg_TempPlayer then
          • Set VariableSet TempSound = WarioAttackSounds[(Random integer number between 1 and 7)]
          • Custom script: endif
          • Sound - Play TempSound at 100.00% volume, attached to (Triggering unit)
          • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = True
          • Wait 2.00 seconds
          • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = False
        • Else - Actions
  • Wario Play Summoned Sound
    • Events
      • Unit - A unit Finishes reviving
      • Unit - A unit Finishes training a unit
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Treasure Hunter
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Set VariableSet TempPlayer = (Owner of (Triggering unit))
          • Set VariableSet TempSound = No sound
          • Custom script: if GetLocalPlayer() == udg_TempPlayer then
          • Set VariableSet TempSound = WarioReady1 <gen>
          • Custom script: endif
          • Sound - Play TempSound at 100.00% volume, attached to (Triggering unit)
          • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = True
          • Wait 2.00 seconds
          • Set VariableSet WarioPreventSounds[(Player number of (Owner of (Triggering unit)))] = False
        • Else - Actions
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
I think what is happening is that these triggers are designed to run whenever the unit is ordered that order. the problem is that when using control groups - all of those units are technically ordered that order, so the trigger fires for all of them. you can't figure based on which one is selected - bc again, all the units in the control group are selected... you need a way to filter for the unit that is currently the one who's portrait you see on the bottom etc' (uber selected?). I'm not sure how to do that....

what uncle did in the original trigger to avoid that is the prevent sounds bool, so this trigger should only be able to fire for each player once every two seconds. I'm not sure why that isn't working for you...

@Uncle ?
 
Level 13
Joined
Jun 23, 2009
Messages
299
Units with custom sound sets in the same group all speak at the same time when an order is given.
I've seen the code a bunch, I don't know if anything changed in recent patches but, by themselves, sounds are something that's tricky to handle through map code and can have various issues when not handled properly.
So, the code plays the various unit sounds when orders are given and this is all stuff you can pretty much do by setting the right path for the unit sounds in "Sound - Unit Sount Set" in the unit's own object data, if that is your only intention is I suggest you do just that.

If you want to do something more than that, like:
Question:
Is there a way to prioritize the sound set of the highlighted unit within a group when giving orders, and a way to silence all others in the group?
I don't know what's their name in GUI but sounds have a number of functions that can modify them like native SetSoundVolume takes sound soundHandle, integer volume returns nothing so you can change some sound parameters yourself, to have something more than that I suggest you look through the resources on this site for a GUI system that can help you handle sounds, dunno if it exists.
 
Last edited:
Status
Not open for further replies.
Top