• 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.

[Trigger] Questions about "Unit in Range" Leaks and Problem when Playing Sound

Status
Not open for further replies.
Level 1
Joined
Feb 1, 2013
Messages
5
Hi, I have some questions about triggering.

1.) Does this leaks? Then what is it? I confused with "unit in range" function that maybe can cause leaks to my map.

  • Test
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempPoint = (Position of (Dying unit))
      • Set TempUnitGroup = (Units within 512.00 of TempPoint)
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Dying unit))) Equal to True
            • Then - Actions
              • Unit - Cause (Dying unit) to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Universal
            • Else - Actions
      • Custom script: call RemoveLocation( udg_TempPoint)
      • Custom script: call DestroyGroup( udg_TempUnitGroup)
2.) I managed to play custom sound when a unit casts a spell. Then I have 3 instance of that unit and I use the spell together, and the problem comes! The sound just plays once and not 3 times. How to fix it?

  • Playing CustomSound
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mighty Roar
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Set Sound_Roar = Mighty_Roar <gen>
      • Sound - Play Sound_Roar at 100.00% volume, located at TempPoint with Z offset 0.00
      • Custom script: call RemoveLocation( udg_TempPoint)
Here are my questions, and thanks for your help :thumbs_up:
 
You can run multiple instances of the same sound like this:

Create an array of 4 sounds (all of the same soundfile) and have an integer that loops through them every time the sound needs to run by increasing the integer.
When it reaches 3, set it back to 0.

You can run up to 4 of the same sound that way. You can not run them exactly at the same time, but at least with a delay of 0.1 seconds inbetween them.
If you want to run more than 4 of the same sound at the same time, you need to export/import the sound file multiple times so that the file path changes.
You can run up to 16 sounds total at the same time.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
You can't play the same sound twice with a delay. That sound will only be replayed when that sound has finished.
you need to export/import the sound file multiple times so that the file path changes.
You can't import the same sound file multiple times, the file path is constant when imported, not if you change it.
Doesn't seem good to import the same sound several times, maybe it might bug when playing at least 2 of those "sounds"(didn't test it).
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
You can't import the same sound file multiple times, the file path is constant when imported, not if you change it.
Doesn't seem good to import the same sound several times, maybe it might bug when playing at least 2 of those "sounds"(didn't test it).

Logically, no. If you imported the same sound, it will cause no problems. This is given the sound has a different file name (different file path in the Import Manager). This means the same sound will be treated like seperate sounds. However I don't like this method because it increases the file size of the map.
 
Level 1
Joined
Feb 1, 2013
Messages
5
I just wondering to replace imported sound with HydraliskDeath1.wav, for example. Then just create a hydralisk and kill it instantly right after a unit casts a spell, so it will play imported sound instead of the original HydraliskDeath1.wav. Does it effective? :|
 
Status
Not open for further replies.
Top