• 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.

Is it possible to...

Status
Not open for further replies.
Level 3
Joined
Nov 11, 2012
Messages
20
Make a sound that only plays for a specific player? No one else hears that sound.

if a player John is in the game, get player and then play sound for that player ?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Yes, it's certainly possible.
  • Local Sounds
    • Events
    • Conditions
    • Actions
      • Set TempPlayer = (some player)
      • Custom script: if GetLocalPlayer() == udg_TempPlayer then
      • Sound - Play (some sound)
      • Custom script: endif
The sound will only play for "TempPlayer".

The thing is: I don't know if this causes desyncs. I'm going to guess it won't, but I'm not sure :).
If it does, here's a way that might fix it:
  • Local Sounds
    • Events
    • Conditions
    • Actions
      • Set TempPlayer = (some player)
      • Set TempReal = 0.00
      • Custom script: if GetLocalPlayer() == udg_TempPlayer then
      • Set TempReal = 100.00
      • Custom script: endif
      • Sound - Play (some sound)
      • Sound - Set volume of (Last played sound) to TempReal%
In this case, the sound will play for all players, but the volume will be 0% for everyone but TempPlayer.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
What I would do is set the volume to 0 globally, and then set it to 127 (100%) for one of the players:

Code:
play sound
set volume of sound to 0%
if GetLocalPlayer() == somePlayer then
    set volume of sound to 100%
endif
I've been thinking of that as well.
Thing is that I haven't researched desyncs well enough to know what exactly causes them.
With your method, you're still handling sounds locally, while I wanted to play it safe and handle an integer locally.

For all I know, the first option (playing sounds locally) doesn't even desync (as it doesn't actually interfere with players), but as I said before: that's not my strong suit.
 
Status
Not open for further replies.
Top