• 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 Play Sound For Player

Status
Not open for further replies.
Level 10
Joined
Aug 25, 2004
Messages
473
Hi, i have found an old code on wc3sear.ch that allows you to play sound only for one player

--------------
function PlaySoundForPlayer takes player whichPlayer, sound whichSound returns nothing
if ( whichPlayer == GetLocalPlayer() ) then
call PlaySoundBJ( whichSound )
endif
endfunction
---------------

I would like to use it, but realy have no knowledge of JASS what so ever
Correct me if i am wrong, but this code should be added to the 'Trigger Comment'
And to run it i can select GUI function: Trigger - Run Trigger

anyway, the code should be changed. What it should do is:

Time every ... sec of the gametime
Take Integer A from 1 to 10 (:):there are 10 players::))
If udg_PlayerForce [array = integer A ] - equels to 1
Play udg_RandomSound [array = random integer from 1 to .... ] for player (integer A)

Plz help

PlayerForce is just an integer variable with 10 arrays
RandomSound is a sound variable with XX arrays
 
Last edited:
Level 10
Joined
Aug 25, 2004
Messages
473
I ment that "where to write a code" is the least of my problems.
I just want to know how to write this in jass
  • Time every ... sec of the gametime
  • Take Integer A from 1 to 10 ((::there are 10 players::))
  • If udg_PlayerForce [array = integer A ] - equels to 1
  • Play udg_RandomSound [array = random integer from 1 to .... ] for player (integer A)
And Giffen, you are not helping at all, i only now found out that i can EDIT--> Convert To Custom Text. But i guess it was so hard to help me out with it
---------------------------------------------------------
--- edited later that day---
Ok, ive went through some tutorials and created this trigger, the problem is that every time integer PlayerSide becomes 1, the game crushes....

Ive Made 2 triggers

1st
  • Setting Randome Sound
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayersSide[(Integer A)] Equal to 1
            • Then - Actions
              • Set SoundVariable = (Integer A)
              • Trigger - Run Setting Randome Sound <gen> (checking conditions)
            • Else - Actions

The Second Trigger IS

Code:
function Trig_PlaySoundForPlayerCopy_Actions takes player whichPlayer, sound whichSound returns nothing
    if ( whichPlayer == ConvertedPlayer(udg_SoundVariable) ) then
        call PlaySoundBJ( udg_RandomSound[GetRandomInt(1, 3)] )
    endif
endfunction

//===========================================================================
function InitTrig_PlaySoundForPlayerCopy takes nothing returns nothing
    set gg_trg_PlaySoundForPlayerCopy = CreateTrigger(  )
    call TriggerAddAction( gg_trg_PlaySoundForPlayerCopy, function Trig_PlaySoundForPlayerCopy_Actions )
endfunction

anyone see the problem?
 
Last edited:
Level 14
Joined
Nov 20, 2005
Messages
1,156
I said the custom script SECTION. Really, kids these days don't play around with the editor enough...that's the way you really learn, by doing...

It's found by going to the trigger editor and clicking on the bit from which the tree of triggers comes (think it has the map name there).
 
Status
Not open for further replies.
Top