Scripts / Sound Emitter

Author
Message
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 11th Apr 2017 06:10
So here's my first ever script, a basic sound emitter script for objects in the environment. It works fine but only because I set the sound range as a fixed integer. However, what I think might be more helpful is if the value of 'soundrange' could be tied to an attribute editable within Game Guru, like strength, speed, or physics weight; that way you could set the range for each object if you wish, giving the user a lot more control.

What commands do I need to return the value of, say, strength (and use that for soundrange)?



AE
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 11th Apr 2017 09:31
g_Entity[e].health
Been there, done that, got all the T-Shirts!
PM
Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 11th Apr 2017 18:07
Thanks AmenMoses, I had tried that already but got the syntax wrong. It works nicely now! For anyone else who is interested, the script is attached.



I've been having a think about another hypothetical script, but my ambitions far outstrip my scripting and maths knowledge

Imagine a cave. From the depths, you hear an echoy sound. As you get closer, the sound gets clearer, you start to discern a tune. You finally come across a gramophone playing music and as you approach it, you can finally hear it clearly.

One method of doing this would be to have three separate audio files; one echoy, one mid, one near, and fade them in and out based on the distance of the player. Here's a graph of how the script would work (you can tell I'm better at visuals than scripting!)



I've got as far as thinking a triangle wave equation might be the solution (or possible sin if you wanted something smoother), but I have no idea where to go from here. I need to know if individual volume control on specific sound effects is possible.

Anyone got any idea on how to achieve this?

AE

Login to post a reply

Server time is: 2024-04-19 21:38:16
Your offset time is: 2024-04-19 21:38:16