• 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] Disabling volume channels for certain players?

Status
Not open for further replies.
Level 1
Joined
Dec 24, 2014
Messages
3
[FIXED] Disabling volume channels for certain players?

Hi, I was wondering if you could mute one or more volume channels for a specific player (ex: mute music for player 1), kind of like Notrom's global silence from DotA but for the enemy team only.
 
Last edited:
Level 1
Joined
Dec 24, 2014
Messages
3
Never mind, I managed to get it to work. In case this could help anyone, here's the custom function I used.

JASS:
function MutePlayer takes player p returns nothing
    if GetLocalPlayer() == p then
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_AMBIENTSOUNDS, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_SPELLS, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_COMBAT, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_FIRE, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_MUSIC, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITMOVEMENT, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITSOUNDS, 0.00 )
    call TriggerSleepAction( ( 15.00 + ( 5.00 * I2R(GetUnitAbilityLevelSwapped('A0AF', udg_DSUnit)) ) ) )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_AMBIENTSOUNDS, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_SPELLS, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_COMBAT, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_FIRE, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_MUSIC, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITMOVEMENT, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITSOUNDS, 100.00 )
    endif
endfunction
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
You need to split your function into two parts, because TriggerSleepAction inside a GetLocalPlayer block causes desync.

JASS:
function MutePlayer takes player p returns nothing
    local real time =  ( 15.00 + ( 5.00 * I2R(GetUnitAbilityLevelSwapped('A0AF', udg_DSUnit)) ) ) 
    if GetLocalPlayer() == p then
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_AMBIENTSOUNDS, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_SPELLS, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_COMBAT, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_FIRE, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_MUSIC, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITMOVEMENT, 0.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITSOUNDS, 0.00 )
    endif

    call TriggerSleepAction(time)

    if GetLocalPlayer() == p then
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_AMBIENTSOUNDS, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_SPELLS, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_COMBAT, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_FIRE, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_MUSIC, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITMOVEMENT, 100.00 )
    call VolumeGroupSetVolumeBJ( SOUND_VOLUMEGROUP_UNITSOUNDS, 100.00 )
    endif
endfunction
 
Status
Not open for further replies.
Top