• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Sound for 1 player in multiplayer

Status
Not open for further replies.
Level 3
Joined
May 18, 2009
Messages
33
Now, I'm a full blown retard when it comes to JASS, but it seems to be the only way I can do it without adding a range and sound cutoff...

How do I play a sound so only 1 out of 4 players hear it?

If possible, something I can copy & paste... Please?

Make a word in RED if I'm suppose to change it to a specific player and a word in GREEN if I'm suppose to change it to a sound, its the last part of the map I'm working on, but its bugging the crap out of me and just doesn't work well if I use a sound cutoff...
 
JASS:
        if (GetLocalPlayer() == ForPlayer) then
            call StartSound( gg_snd_YourSound )
        endif

or for gui if you like
  • Custom script: if (GetLocalPlayer() == ForPlayer) then
    • Sound - Play YourSound
  • Custom script: endif
where ForPlayer is your player and YourSound is the variable name of your sound

Or you may use https://www.hiveworkshop.com/forums/jass-resources-412/system-soundtools-207308/ to give you a much pretty good result
 
ahh lol you couldn't nest it
sorry
i just put a spaced before Sound so the parser thinks it is nested lol

yeah ForPlayer should be the player.. but in jass.. player numbers should start with 0.. which is Player 1 red is Player(0) in jass and so on and so forth

or you may use other things like GetOwningPlayer or GetTriggerPlayer whatsoever
 
If you want to refer for a player, let's say it cast spell and you want only the player of the caster to hear your sound, use (Triggering Player)

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: if (GetLocalPlayer() == GetTriggerPlayer()) then
      • Sound - Play (Last played sound) at 100.00% volume, attached to (Triggering unit)
      • Custom script: endif
This way, ONLY the owner of the caster will hear the sound.

The concept is same for unit, we use (Triggering unit) = GetTriggerUnit()
For player, we use (Triggering player) = GetTriggerPlayer()
 
Status
Not open for further replies.
Back
Top