Scripts / Script problem with waterfall lua file

Author
Message
m2design
GameGuru TGC Backer
14
Years of Service
User Offline
Joined: 25th Mar 2010
Location:
Posted: 11th Aug 2017 00:53 Edited at: 11th Aug 2017 01:14
I been fighting a lua problem all day and have run out of ideas. My problem is, everything in the lua script seems to work as I want but I lose my background
sound that is placed over the start marker when the player has passed thru the area controlled by my waterfall sound script. I can't get it back.
The script's purpose is to vary the volume as the player enters the area and passes by the waterfall.





Windows 10 creator,64 bit| Intel i7-7700 @3.60GHZ Quad|CPU PASSMARK10,817|Memory 16GB |NVIDIA GEFORCE GTX 1070|GPU PASSMARK 11,026

Attachments

Login to view attachments
Gtox
3D Media Maker
10
Years of Service
User Offline
Joined: 5th Jun 2014
Location: South Africa
Posted: 11th Aug 2017 06:22
SetSoundVolume affects all sounds, not just one specific sound. If you want to change the volume of individual sounds, you need to use Global Sounds.
i5 2500k 3GB GTX1060 8GB RAM Windows 10
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Aug 2017 13:39
It shouldn't do, just had a quick look on my phone and it seems like you just need to define vol as a local variable, I would assume you are using the same variable to adjust the script on the start marker too?
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: 11th Aug 2017 21:17 Edited at: 13th Aug 2017 17:11
EDIT:
found it - the problem that is....
I had the following code line sequence (out of order !)

This is what had for the last two days...
SetSoundVolume(vol_dip)
PlaySoundIfSilent(sound_entity, 1)

This is what should of had...
PlaySoundIfSilent(sound_entity, 1)
SetSoundVolume(vol_dip)
That solved part of my problem (real rocket stuff, huh) !

I have made this mistake before, dumb, dumb, dumb.
Trust me there is a very large sign on my office wall now, a hard to ignore size in red.

The following was the other big problem
--When the player enters or exits the zone influnced by the waterfall_test.lua routine
--I lose the background sound wav (sound marker with the musicinzone lua file) overlaying the start marker which
--will play up until the player enters the area of the waterfall entity.
--The sound wav file that is part of the start marker is dimminished or turned
--off during the transition thru the zone.
--The background sound will not return at any noticeable volume if at all
--The wav files in the two routines are not the same file, but they both were using slot 0. Bad, Bad, Bad

The trigger zone has only 1 slot which is slot 0 for any background wav file.
The properties for entities have several slots for the placement of wave files 0 thru 5 so if you want to have a constant background wav file attached
to the player marker it must be in slot 0.
Then any entity that has a lua file assigned to it (that revises volumes must have the support wav file installed in slot 1 (any slot other than 0) the assigned lua files sound commands must refer to slot 1 for sound action if you are making any changes to the volume.

Any instance where there is a wav file attached to slot 0 in a sound trigger zone laid over the player marker as a background sound , any lua script that deals with sound volume manipulations, needs to have its support wav files placed in a slot other than 0

Attached is the working lua file
if a video of the operation of this script would illustrate how the fade works just let me know...

EDIT: update script

Windows 10 creator,64 bit| Intel i7-7700 @3.60GHZ Quad|CPU PASSMARK10,817|Memory 16GB |NVIDIA GEFORCE GTX 1070|GPU PASSMARK 11,026

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 13th Aug 2017 20:09
indeed, ordering of code is important but it's easily got wrong in cases like this, glad you got it working
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Login to post a reply

Server time is: 2024-12-23 00:25:21
Your offset time is: 2024-12-23 00:25:21