• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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...
 
Level 10
Joined
May 27, 2009
Messages
494
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 http://www.hiveworkshop.com/forums/jass-resources-412/system-soundtools-207308/ to give you a much pretty good result
 
Level 10
Joined
May 27, 2009
Messages
494
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
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
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.
Top