• 🏆 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] How do i create Sound

Status
Not open for further replies.
Level 18
Joined
Oct 18, 2007
Messages
930
How do i create Sound??

Ok im trying to make a PP-MUI spell that uses a 3D sound, but dunno how to make it :p

Ok lets say that i have a sound file that is called "anysound.wav".
and i got theese calls/functions/commands to make a 3D sound. How should i do it??
JASS:
local sound snd = CreateSound(string filename,false, true, true, integer fadeInRate, integer fadeOutRate, string eaxSetting) //what should i put in the "fadeInRate", "fadeOutRate" and the "string eaxSetting"
call SetSoundChannel( snd, integer channel) //Dunno the "Channel Codes"
call SetSoundDistances( snd, 600.00, 10000.00 ) //What are the best values here?
call SetSoundDistanceCutoff( snd, 3000.00) //What is the best value to put here?
call SetSoundDuration( snd, GetSoundFileDuration(string musicFileName) ) //fileName here again :)
call SetSoundVolume( snd, 100 )
// "SetSoundConeAngles(sound soundHandle, real inside, real outside, integer outsideVolume)" What does this??
//is there something more that i need just say it :) thx!
call TriggerSleepAction( 2.00 )
PlaySoundOnUnitBJ( snd, 100.00, GetTriggerUnit() )
set snd = null
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
CreateSoundFromLabel(<sound label>,false,<is 3d>,false,0,0)

This one is nice
Example
CreateSoundFromLabel("MetalHeavySliceMetal",false,true,false,0,0)
 
Level 18
Joined
Oct 18, 2007
Messages
930
Fixed it :p
JASS:
    local sound snd = CreateSound("Abilities\\Spells\\Orc\\LightningBolt\\LightningBolt.wav",false, true, true, 0, 0, "DefaultEAXON")
    call SetSoundChannel( snd, 0)
    call SetSoundDistances( snd, 600.00, 10000.00 )
    call SetSoundDistanceCutoff( snd, 3000.00)
    call SetSoundDuration( snd, GetSoundFileDuration("Abilities\\Spells\\Orc\\LightningBolt\\LightningBolt.wav") )
    call SetSoundVolume( snd, 127 )
    call SetSoundConeAngles( snd, 0.0, 0.0, 127 )
    call SetSoundConeOrientation( snd, 0.0, 0.0, 0.0 )
    call SetSoundPitch( snd, 1.0 )
    call PlaySoundAtPointBJ(snd, 100, point, 0.00)
    set snd = null
 
Level 6
Joined
Sep 5, 2007
Messages
264
You forgot:
JASS:
call KillSoundWhenDone(snd)

Without this, the sound will leak... You should also kill off the PlaySoundAtPointBJ(). All you have to do instead is:
JASS:
call SetSoundPosition(snd, x,y,z)
call PlaySound(snd)
// <--- Chuck the KillSoundWhenDone in here

If you don't know how to get the x,y,z:
JASS:
local real x = GetUnitX(<unit>)
local real y = GetUnitY(<unit>)
local real z = GetUnitFlyHeight(<unit>)

Hope this helped... :thumbs_up:
 
Status
Not open for further replies.
Top