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

[JASS] Looping Flying Machine Noise

Status
Not open for further replies.
Level 6
Joined
Jul 2, 2008
Messages
156
[Solved] Looping Flying Machine Noise

EDIT: Nevermind, I seem to have found the solution. Apparently "stop when out of range" doesn't also mean "start when back in range". I just changed stopwhenoutofrange to false and it works much better now.

In my map I have a flying unit that can take off and land.
Each player can have one of these flying units.
The custom model I use does not come with any looping sounds of its own.
So I made a global sound array for each player.

My ideal situation:
When my flying unit flies away from the character's screen, the looping sound will fade out and stop.
When my flying unit flies into the character's screen, the looping sound will fade in and continue to loop.

What happens:
When my flying unit flies away from the character's screen, the sound can still be heard, though quieter.
When my flying unit flies into the character's screen, the looping sound will then stop completely and not start again.

My Code
Init Function
JASS:
set flyLoop[0]= CreateSound("Units\\Human\\Gyrocopter\\GyrocopterLoop2.wav", true, true, true, 512, 512, "")
    set flyLoop[1]= CreateSound("Units\\Human\\Gyrocopter\\GyrocopterLoop2.wav", true, true, true, 512, 512, "")

NOTE: here I have tried multiple values for the fadein/fadeout, including 1, 3, 10, 50, 100, 300, and 512, with similar results.

When Lifting Off
JASS:
call AttachSoundToUnit(flyLoop, gunship)
        call StartSound(flyLoop)

When Landing
JASS:
call StopSound(flyLoop, false, true)
 
Status
Not open for further replies.
Top