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

Sounds not playing the first time?

Status
Not open for further replies.
Do the triggers REALLY matter?

oh, hell

JASS:
function Trig_SoundOrder_Actions takes nothing returns nothing
    local integer random = GetRandomInt(0, 2)
    local sound Sound
    if GetUnitTypeId(GetTriggerUnit()) == 'heng' then
        if random == 0 then
            set Sound = gg_snd_EngineerYes1
        elseif random == 1 then
            set Sound = gg_snd_EngineerYes2
        else
            set Sound = gg_snd_EngineerYes3
        endif
    endif
    if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
    call StartSound(Sound)
    endif
    call SetSoundPosition(Sound, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), GetUnitFlyHeight(GetTriggerUnit()))
    set Sound = null
endfunction

//===========================================================================
function InitTrig_SoundOrder takes nothing returns nothing
    set gg_trg_SoundOrder = CreateTrigger(  )
    call TriggerAddAction( gg_trg_SoundOrder, function Trig_SoundOrder_Actions )
    call TriggerRegisterPlayerUnitEvent(gg_trg_SoundOrder, GetLocalPlayer(), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, NullBoolexpr())
endfunction
 
I used this and it works for me (even for the first time):
  • Snd
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Set Integer = (Random integer number between 0 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer Equal to 0
        • Then - Actions
          • Sound - Play BloodElfEngineerYes1 <gen> at 100.00% volume, attached to (Triggering unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer Equal to 1
            • Then - Actions
              • Sound - Play BloodElfEngineerYes2 <gen> at 100.00% volume, attached to (Triggering unit)
            • Else - Actions
              • Sound - Play BloodElfEngineerYes3 <gen> at 100.00% volume, attached to (Triggering unit)
 
Status
Not open for further replies.
Top