Play Sound for ONE player only

Silencer

New Member
Reaction score
0
Hi, i dont know much about writing JASS, i have 18 sounds.

I want to play a random sound from 1-18...

In GUI it should be:

Play -Sound[random number between 1-18] for (owner of casting unit)

But in GUI the sound is play for all players.

Can someone write the custom code for me please?
 

Silencer

New Member
Reaction score
0
No one? I have tried this, but it wont work:

Code:
Custom script:    call StartSoundForPlayerBJ( GetEnumPlayer(), udg_Testsound[GetRandomInt(1,18)] )
 

Silencer

New Member
Reaction score
0
It but your trigger is also only for ONE file. But i will play a random soundvariable between 1-18
 

Jesus4Lyf

Good Idea™
Reaction score
397
Komaqtion:
JASS:
function StartSoundForPlayerBJ takes player whichPlayer, sound soundHandle returns nothing
    if (whichPlayer == GetLocalPlayer()) then
        call StartSound(soundHandle)
    endif
endfunction

He already has the local player stuff nailed. And you're using the wrong function.

>[LJASS]call StartSoundForPlayerBJ( GetEnumPlayer(), udg_Testsound[GetRandomInt(1,18)] )[/LJASS]
Make sure udg_Testsound actually holds sound objects, and GetEnumplayer() exists... (as in, that you are doing this in a For Player Group thing).
 

Silencer

New Member
Reaction score
0
udg_testsound has sound objects in it, but what is "GetEnumplayer()" exactly and what i have to do with it?

I use normaly GUI, so i dont know much about jass, i am sorry for that =/
 

Silencer

New Member
Reaction score
0
I want to play the sound for "casting unit", so for the unit who starting an ability (NOT finishing)
 

saw792

Is known to say things. That is all.
Reaction score
280
[ljass]GetOwningPlayer(GetTriggerUnit())[/ljass] instead of [ljass]GetEnumPlayer()[/ljass]
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top