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

[JASS] Sound Not Playing

Status
Not open for further replies.
Level 6
Joined
Nov 10, 2006
Messages
181
JASS:
 set SLEEP =CreateSoundFromLabel("UndeadSleepBirth1",false,false,false,10,10)

Is in my Init function

JASS:
 call StartSound(SLEEP)

Is played at the actions

JASS:
 private sound SLEEP

At globals block.

Now why does this not work? I need to create sounds for my spells else they look really dull.

If you do not know what Sound I am using, I am using Internal/Abilities/Spells/Undead/SleepBirth1
 
Level 6
Joined
Nov 10, 2006
Messages
181
I do not know how to do it with CreateSound(..parametres).

I do not understand what is this string eaxSetting which is in that native's parametres.
 
Level 6
Joined
Nov 10, 2006
Messages
181
Still no sound.

JASS:
set SLEEP = CreateSound("Internal//Abilities//Spells//Undead//SleepBirth1",false,true,true,10,10,"")
    call StartSound(SLEEP)
    call SetSoundVolume(SLEEP,2000)

In my Init function

Played it in the actions function of my trigger and still no sound came out.
 
Level 6
Joined
Nov 10, 2006
Messages
181
Alright, I'll post the devilish code.

JASS:
scope deathpact initializer Init

globals
    private constant integer SPELL = 'A00P'
    private constant string EFFECT = "MDX\\NewDarkPillar.mdx"
    private group caster = CreateGroup()
    private sound SLEEP
endglobals

private struct data
//! runtextmacro PUI()
    unit caster
    unit target
    unit dummy
    timer t
    
static method create takes nothing returns data
    local data d = data.allocate()
    set d.caster = GetTriggerUnit()
    set d.target = GetSpellTargetUnit()
    set d.t = NewTimer()
    set d.dummy = CreateUnit(GetOwningPlayer(d.caster),DUMMY,GetUnitX(d.target),GetUnitY(d.target),GetUnitFacing(d.target))
    call UnitApplyTimedLife(d.dummy,'BTLF',3)
    call PauseUnit(d.target,true)
    call AddTimedEffectTarget(EFFECT,d.dummy,"origin",1)
    call GroupAddUnit(caster,d.caster)
    return d
endmethod

endstruct

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELL
endfunction

private function Loop takes nothing returns nothing
    local data d = data(GetTimerData(GetExpiredTimer()))
    local unit u
    local real TLife
    local real TMana
    local real x
    local real y
    loop
        set u = FirstOfGroup(caster)
        exitwhen u == null
        set TLife = GetWidgetLife(d.target) * 0.20
        set TMana = GetUnitState(d.target,UNIT_STATE_MANA) *0.20
        set x = GetUnitX(d.target)
        set y = GetUnitY(d.target)
        call SetWidgetLife(u,GetWidgetLife(u)+ TLife)
        call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA) + TMana)
        call GroupRemoveUnit(caster,u)
    endloop
    call ReleaseTimer(d.t)
    call PauseUnit(d.target,false)
    call d.destroy()
    set u = null
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit t = GetSpellTargetUnit()
    local data d
    if GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_EFFECT then
        call StartSound(SLEEP)
        set d = data.create()
        set data[u] = d
        call SetTimerData(d.t,d)
        call TimerStart(d.t,3,false,function Loop)
        set u = null
        set t = null
    elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_ENDCAST then
        call GroupRemoveUnit(caster,u)
        set d = data[u]
        call ShowUnit(d.dummy,false)
        call StopEffect(1)
        call RemoveUnit(d.dummy)
        call d.destroy()
        set u = null
    endif
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_ENDCAST)
    call TriggerAddAction( t, function Actions )
    call TriggerAddCondition(t,Condition(function Conditions))
    //set SLEEP = CreateSoundFromLabel("SleepBirth1",false,true,true,10,10)
    set SLEEP = CreateSound("Internal\\Abilities\\Spells\\Undead\\SleepBirth1",false,true,true,10,10,"")
    call StartSound(SLEEP)
    call Preload("Internal\\Abilities\\Spells\\Undead\\SleepBirth1")
    call SetSoundVolume(SLEEP,2000)
endfunction
endscope

Still no sound heard.
 
Status
Not open for further replies.
Top