sound_source clarification
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- Spannerbag
- Posts: 551
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
sound_source clarification
Hi,
I've never used this and thought I'd ask here before totally messing it up experimenting myself.
Am I right in believing that [sound_source] sounds come and go depending on which area of the map the player is viewing?
So if the player scrolls/clicks further away from a sound source the volume will fall accordingly?
If so, what I want to do is have the sound determined by the nearest player unit(s) by using (one of those) unit(s) x,y as a location filter?
Something like this:
The effect I want (if possible) is for the sound to wax and wane depending upon the proximity of the nearest player unit.
I suspect this won't work because the wiki states: For now, only sound sources tied to locations are supported so I presume the location filter, once set, doesn't change?
Any clarification or suggestions gratefully received.
Thanks in advance,
cheers!
-- Spannerbag
I've never used this and thought I'd ask here before totally messing it up experimenting myself.
Am I right in believing that [sound_source] sounds come and go depending on which area of the map the player is viewing?
So if the player scrolls/clicks further away from a sound source the volume will fall accordingly?
If so, what I want to do is have the sound determined by the nearest player unit(s) by using (one of those) unit(s) x,y as a location filter?
Something like this:
Code: Select all
[sound_source]
id=as_heard_by_nearest_player_unit
x,y=$nearest_unit.x,$nearest_unit.y
sounds=some_sound.ogg
delay=0
chance=100
full_range=4
fade_range=4
loop=-1 # Not sure if this is needed yet
[/sound_source]
I suspect this won't work because the wiki states: For now, only sound sources tied to locations are supported so I presume the location filter, once set, doesn't change?
Any clarification or suggestions gratefully received.
Thanks in advance,
cheers!
-- Spannerbag
- Celtic_Minstrel
- Developer
- Posts: 2263
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: sound_source clarification
I think that's correct. You could try resetting the sound source whenever a unit moves. I would expect that to restart the sound from the beginning, but maybe if you're lucky it won't.
- Spannerbag
- Posts: 551
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: sound_source clarification
Thanks for the reply, I think when I get to a point where I can actually test this, I'll do some experimenting (now I know there's a chance).Celtic_Minstrel wrote: ↑April 25th, 2024, 1:38 pm ...You could try resetting the sound source whenever a unit moves. I would expect that to restart the sound from the beginning...
Be awhile tho', have to get plenty of other stuff working first...
As an aside I've also learned from what little testing I have done that
[remove_sound_source]
with a non-existent id
doesn't produce any errors on-screen or in the log. This helps simplify the code in my case. As ever, many thanks for taking the trouble to reply, much appreciated.
Cheers!
-- Spannerbag