• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Sound when on low health

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,870
Is there a way to add a sound when my character in wc3 is on low health externally?
There's two kinds of sounds, 3D sounds which play from a point/unit and can only be heard when your camera is near them, and non-3D which play universally. I assumed you wanted a universal sound which can be heard by everyone since that's the default behavior (you need to use some tricks to play a sound for a single player):
  • Set Low Life Unit
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Variable LowLifeUnit = Paladin 0000 <gen>
  • Play Low Life Sound
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (LowLifeUnit is alive) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Percentage life of LowLifeUnit) Less than or equal to 25.00
              • LowLifeSoundIsOn Equal to False
            • Then - Actions
              • Set Variable LowLifeSoundIsOn = True
              • Sound - Play LowLifeLoop <gen>
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LowLifeSoundIsOn Equal to True
                  • (Percentage life of LowLifeUnit) Greater than 25.00
                • Then - Actions
                  • Set Variable LowLifeSoundIsOn = False
                  • Sound - Stop LowLifeLoop <gen> After fading
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LowLifeSoundIsOn Equal to True
            • Then - Actions
              • Set Variable LowLifeSoundIsOn = False
              • Sound - Stop LowLifeLoop <gen> After fading
            • Else - Actions
This value is the percentage of life that is considered "low life":
  • (Percentage life of LowLifeUnit) Less than or equal to 25.00
I'm using 25.00 which is equal to 25%. You can see it being referenced twice so make sure you update both of those values if you decide to change it.
 

Attachments

  • Low Life Sound 1.w3m
    111.2 KB · Views: 3
Last edited:
Level 1
Joined
Sep 30, 2023
Messages
2
There's two kinds of sounds, 3D sounds which play from a point/unit and can only be heard when your camera is near them, and non-3D which play universally. I assumed you wanted a universal sound which can be heard by everyone since that's the default behavior (you need to use some tricks to play a sound for a single player):
  • Set Low Life Unit
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Variable LowLifeUnit = Paladin 0000 <gen>
  • Play Low Life Sound
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (LowLifeUnit is alive) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Percentage life of LowLifeUnit) Less than or equal to 25.00
              • LowLifeSoundIsOn Equal to False
            • Then - Actions
              • Set Variable LowLifeSoundIsOn = True
              • Sound - Play LowLifeLoop <gen>
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LowLifeSoundIsOn Equal to True
                  • (Percentage life of LowLifeUnit) Greater than 25.00
                • Then - Actions
                  • Set Variable LowLifeSoundIsOn = False
                  • Sound - Stop LowLifeLoop <gen> After fading
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LowLifeSoundIsOn Equal to True
            • Then - Actions
              • Set Variable LowLifeSoundIsOn = False
              • Sound - Stop LowLifeLoop <gen> After fading
            • Else - Actions
This value is the percentage of life that is considered "low life":
  • (Percentage life of LowLifeUnit) Less than or equal to 25.00
I'm using 25.00 which is equal to 25%. You can see it being referenced twice so make sure you update both of those values if you decide to change it.
Thank you for your input. I realize that I didn't provide enough details initially. I'm currently playing a mod, and I'm interested in knowing if there's a method to trigger a sound notification when I'm alt-tabbed and my character's health is low.
 
Status
Not open for further replies.
Top