• 🏆 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!

[SOLVED] (+4 rep reward) Quick question about local sounds!

Status
Not open for further replies.

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
Hello there!
In my map I am using a GetLocalPlayer block to play a sound locally. The sound I'm playing is a music piece for one of the towns in my upcoming map Bosses of Warcraft.

I'm creating an on/off command for the city music so that players can decide if they want to listen to it or have it muted and I would appreciate some help on the subject.

My questions are:
- Can I stop a globally played sound locally without any desyncs?
- Can I stop a locally played sound locally without any desyncs?

Thanks for reading my thread! Have a nice day :)
+4 rep to all helpers :D

Kitten picture attatched for extra request powwwahhh!

exciting-kitten-phone-wallpaper-dump-album-on-imgur-along-with-kitten-wallpaper-dump-1-300x300.jpg
 
Level 16
Joined
May 2, 2011
Messages
1,345
What killed me is the + rep reward in the title.

Its not like ppl here are only going to help u cuz u said that.

They're going to help anyway.

Also giving + rep is only natural when somebody help you. Its kind of a hidden rule that we all follow but not need to say.

Putting it in title feels as if im watching advertisement. I've seen such before but putting it in title i think is the too far.

Sry for the lecture but it drove nuts xD

tl;dr

No need to say +4rep in title; hive is gunna help eitherway Thx
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Creating a sound object locally will cause the client to out of sync due to messing up handle ID allocations. Locally playing, manipulating or stopping a sound object that was globally created will not cause anyone to out of sync.

That said I strongly recommend trying to play your music through Warcraft III's music channel. Not only is this less prone to interfering with other sound effects, but it also allows people to mute it with Ctrl + M instead of having to mute the default game music with Ctrl + M in order to not hear a raucous.
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
@Dr Super Good That's the best answer I could have hoped for. You know what surprices me? I've been reading about sound here on Hive in preparation for this, I believe I've read pretty much every thread on the subject :D I had a problem once in my development where I wanted to change a unit's combat sound depending on what weapon he had equipped. I looked into using some sort of delayed "Unit is Attacked" event to play the right attack sound at the right time - the main problem I had with this solution was that sounds wont overlap - atleast not easily.

But yesterday when I tested my dialog system I found something interesting out (or atleast it was interesting to me); When you play a sound locally it will always play. Sounds played locally will always overlap without any problems. (it seems.)

That's a bit offtopic, but my reasoning for not playing my music as "music" but as "sound" is that 9/10 WC3 players that I know of have their music disabled (including myself haha.)
Adding this command would enable players to simply type "-mo" to turn the music off ;)

Thanks again :)
 
Level 11
Joined
Nov 23, 2013
Messages
665
I had a problem once in my development where I wanted to change a unit's combat sound depending on what weapon he had equipped.
To achieve this, wouldn't it be possible to use two identical units except for the attack sound? You should be able to switch from one to another by using an ability based on bear form or metamorphosis.

That's a bit offtopic, but my reasoning for not playing my music as "music" but as "sound" is that 9/10 WC3 players that I know of have their music disabled (including myself haha.)
Adding this command would enable players to simply type "-mo" to turn the music off ;)
I get your point, however if players disable music, it must be for a good reason! :D
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
I looked into using some sort of delayed "Unit is Attacked" event to play the right attack sound at the right time - the main problem I had with this solution was that sounds wont overlap - atleast not easily.
Something to do with a single sound file can only be played once at any time as it gets allocated a single channel.
But yesterday when I tested my dialog system I found something interesting out (or atleast it was interesting to me); When you play a sound locally it will always play. Sounds played locally will always overlap without any problems. (it seems.)
Makes no sense. As far as the sound system is concerned "locally" is not a thing. It either plays a sound or does not. Locally is purely for flow controlling JASS code.
I get your point, however if players disable music, it must be for a good reason!
Exactly. If they do not want music chances are they do not want your music as well.
 

Sverkerman

Hosted Project: BoW
Level 17
Joined
Feb 28, 2010
Messages
1,325
To achieve this, wouldn't it be possible to use two identical units except for the attack sound? You should be able to switch from one to another by using an ability based on bear form or metamorphosis.
@Sieben I tried this, actually. The problem I was faced with was the fact that you could abuse this to reset cooldowns. I managed to create a workaround abusing Bear Form haha :D
Makes no sense. As far as the sound system is concerned "locally" is not a thing. It either plays a sound or does not. Locally is purely for flow controlling JASS code.
I found it wierd too, but you should try spamming "Play Sound" within a GetLocalPlayer block, it was running every sound on top of eachother without any problems. I believe that most of my sounds belonged to the same sound channels as well :D
Exactly. If they do not want music chances are they do not want your music as well.
Personally I disabled my music because I dislike the ambient music in the main menu of WC3. If players dislike the music inside the map they can use the "-so" command. I could save their preferences inside the load/save as well if it's annoying to type -so every game :D

Again, thanks for your involvement and your comments guys :) I really appreciate your effort and I believe that I've +rep'ed everyone. I'm going to put this as "Solved" now :) Have a great day!
 
Status
Not open for further replies.
Top