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

Somtimes play a sound when a unit dies.

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Untitled Trigger 019
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 30
        • Then - Actions
          • Sound - Play (Some sound)
          • Trigger - Turn off (This trigger)
          • Wait 2.00 seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
The chance here is 30%. That turn on/off and wait makes sure that the sound won't play during the next 2 seconds. You could move it out of the IF/THEN/ELSE loop.
 
  • Untitled Trigger 019
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 30
        • Then - Actions
          • Sound - Play (Some sound)
          • Trigger - Turn off (This trigger)
          • Wait 2.00 seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
The chance here is 30%. That turn on/off and wait makes sure that the sound won't play during the next 2 seconds. You could move it out of the IF/THEN/ELSE loop.
Thanks. I also forgot to mention that I have 4 different death sounds and also 5 different units. If I want all four then I would make different triggers for each one right? Having the same amount of chance?
Edit: Is there a way I can copy your triggers because I cannot find some of the actions.
 
Level 8
Joined
Jun 26, 2010
Messages
530
There's no way you can copy that. But i can tell you for sure that all those actions exist. Use the search engine on the actions menu.
Also, if you make on trigger for each sound you have chances of two/tree/all sounds being played when a unit dies. You should use chances on this same trigger.

like that:

  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set DeathSound[1] = human death
    • Set DeathSound[2] = orc death
    • Set DeathSound[3] = undead "death"
    • Set DeathSound[4] = night elf death
  • Events
    • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 30
        • Then - Actions
          • Sound - Play DeathSound[randon integer between 1 and 4]
          • Trigger - Turn off (This trigger)
          • Wait 2.00 seconds
          • Trigger - Turn on (This trigger)
        • Else - Actions
 
Status
Not open for further replies.
Top