Scripts / Can anyone give me a clue why this lua code will not control the volume of my wav file

Author
Message
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 18th Nov 2016 01:05 Edited at: 18th Nov 2016 03:43
I am using this attached code but no matter where I put the volume code line it has no effect, I need to have the ability to change the volume.
I thought I knew what I was doing but it turns out not to be case. Should be simple, right? I could sure use a little guidance.

Thanks for any help.

Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Nov 2016 09:45
You have the sound playing twice, SetSoundVolume only controls the last instance of sound when it is called, therefore you're only reducing the volume of one instance of the sound.

Try this
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 18th Nov 2016 16:53
@smallg
Thanks for the advise. Sadly it still does not work. Are we sure the volume command really works at all. I have run the code you listed with several different values for the volume variable with no volume change. (What are acceptable value range limits for set volume anyway)

I am using a 30 second wav file. What I am trying to do is create a simple lua file that allows the sound of the river to play when ever the player enters certain areas along a trail that some times is adjacent to a river, thus the requirement for the river sound. With out the loop command, if the player enters the trigger area and stays longer then 30 seconds the sound stops, just as though he had left the trigger area. I need the sound to continue as long as the player is standing in that trigger area. When this happens after the 30 seconds, the player can no longer activate the sound by entering or leaving the trigger area.

My original code, with the loop command, does this with out fail but I have no control over the volume. It appears that the code, without the loop also does not allow me to control the volume. I'm confused. I need the sound to continue for the duration of the players time in the trigger zone and be able to be activated at different spots along the river.
Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 18th Nov 2016 17:05 Edited at: 18th Nov 2016 17:06
These might help you out..




i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 18th Nov 2016 17:44
make the sound you are using a mono wav, this will pan and fade as you move, a stereo ogg file is just that, stereo.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth.
PCS
7
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 18th Nov 2016 18:01
@m2design. hold on , i think roandoom has the sulution for you.
Windows 7 Professional 64-bit
Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz (4 CPUs), ~2.7GHz RAM 4GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
roandoom
8
Years of Service
User Offline
Joined: 24th Mar 2016
Location:
Posted: 18th Nov 2016 18:01
I dont know if this is what you are looking for. This was my first script i ever created for my father, didnt think it was so good, but it works well. And you can change the distance it's starts playing the sound.
Just add the script to an object and add a sound in the sound0 property of the object and you are good to go.

Attachments

Login to view attachments
PM
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 18th Nov 2016 18:51 Edited at: 19th Nov 2016 00:32
Thanks to everyone.
I have what I want now and it works fine. (see the attachment) I still have a problem with the volume though.
I will take a look at the code from roandoom and see if his volume code works for me.

Again thanks to all, you have all been very helpful.

Edit: I have the sound volume now working. The problem is that the volume range is about 85 to 100. Anything below 85 is almost silent. 100 appears to be the higher limit. Not a great command but will suffice. One more time "Thanks to everyone"

Windows 10,64 bit|AMD FX-6200 Six-core-3.80 Ghz |CPU PASSMARK 6,142 |Memory 10GB |NVIDIA GEFORCE GTX 660 SC |GPU PASSMARK 4,114

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-30 19:18:22
Your offset time is: 2024-04-30 19:18:22