• 🏆 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!

[General] Simple Sound Trigger

Status
Not open for further replies.
Level 25
Joined
Sep 26, 2009
Messages
2,380
In map ini trigger you make a list of sounds (going by what you wrote, I guess you have one already)
  • Map Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set AttSound[1] = AxeMissile1 <gen>
      • Set AttSound[2] = AxeMissile2 <gen>
      • Set AttSound[3] = HeroShadowhunterMissileHit1 <gen>
This plays random sound from your list:
  • Sound
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Sound - Play AttSound[(Random integer number between 1 and 3)] at 100.00% volume, attached to (Attacking unit)
The function used in the AttSound's index is Math - Random number.

The problem: WCIII allows you to play only 1 sound via trigger at a time. So when multiple units attack, only 1 sound will be played (for the first unit) - e.g. only the first unit's swing will play sound.
 
Level 4
Joined
May 1, 2013
Messages
68
Alternative

I have an alternative, to how this could be done, which may be easier plus you only need one trigger and you dont need to create many variables.

  • Sound
    • Events
      • Unit - A unit Is attacked
      • Conditions
      • Actions
        • Set RandInt = (Random integer number between 1 and 3)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandInt Equal to 1
          • Then - Actions
            • Sound - Play MySound1
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandInt Equal to 2
                • Then - Actions
                  • Sound - Play MySound2
                  • Else - Actions
                    • Sound - Play MySound3
 
Last edited:
Status
Not open for further replies.
Top