Scripts / LoopSound Issue

Author
Message
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 29th Jan 2018 18:18 Edited at: 29th Jan 2018 18:19
Hi everyone, I've encountered a problem that I haven't been able to find a way around yet. I have basically a helicopter that takes off from the ground and leaves the area -- of which emits sounds (a looped wav). The sounds work great and all and if the player moves further enough back it fades away as expected. However the sounds don't seem to follow the helicopter at all. Just the initial point of where it took off from.

I'm using the command LoopSound. Could this be because I'm turning off the collisions of the helicopter and its causing this to happen?

(hoping this isnt a bug)
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Jan 2018 21:27
how is the sound volume being faded? can you post the script and i'm going to ask the obvious but it (the sound) is attached to the helicopter right?
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Solar
7
Years of Service
User Offline
Joined: 11th Apr 2017
Location: South Africa
Posted: 29th Jan 2018 21:43
I have experienced the exact same problem.

When you attach a script using LoopSound to a moving entity, the sound just plays continuously from the point where the moving entity started. It does not move with the moving entity.

@ Smallg - I think what Teabone means is that if you move away from the initial position of the helicopter, the sound fades as you walk away. But the sound is passive, in that it doesn't travel with the helicopter.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2018 22:13
Ooh, something for me to investigate ... powering up VS 2015 .. seat belt on ... weeee. (damn I need to get a life)
Been there, done that, got all the T-Shirts!
PM
OldFlak
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 27th Jan 2015
Location: Tasmania Australia
Posted: 29th Jan 2018 22:45
Yeah something I noticed with the Sci-Fi drones too, is that if you destroy them while they are running the audio attached to them, the sound just keeps playing.


Reliquia....
aka OldFlak
Intel(R) Core(TM) i3-4160 @ 3,60GHz. 8GB Ram. NVidia GeForce GTX 750. Acer 24" Monitors x 2 @ 1920 x 1080. Windows 10 Pro 64-bit.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Jan 2018 22:57
Not sure if it's related but there is a comment in the code, from 2005!, from Lee commenting out a call to 3D sound positioning for the Loop_Sound. The comment mentions that it conflicts with "DBPro regular functionality".

Been there, done that, got all the T-Shirts!
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 30th Jan 2018 00:32 Edited at: 30th Jan 2018 00:33
Quote: "@ Smallg - I think what Teabone means is that if you move away from the initial position of the helicopter, the sound fades as you walk away. But the sound is passive, in that it doesn't travel with the helicopter."


yep!

Quote: "Yeah something I noticed with the Sci-Fi drones too, is that if you destroy them while they are running the audio attached to them, the sound just keeps playing."


With my scripts this isn't so much an issue as I have a StopSound command near the deaths section of code.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Jan 2018 10:35
OK so the sound is being faded automatically by the engine? That's the issue then, you can fade sound yourself based on player distance to make it work properly.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Solar
7
Years of Service
User Offline
Joined: 11th Apr 2017
Location: South Africa
Posted: 30th Jan 2018 18:36
@ Smallg - But the problem is when you stand still, and the helicopter moves away from you, the sound does not fade away as the helicopter moves away from you. The sound does not travel with the helicopter, but just keeps on looping at the initial position.
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 30th Jan 2018 18:43
as far as i know i also have a part off sound script in the original helli script from AmenMoses with one of bods helli's and i do not have that problem last time i have tested my map.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 4GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
Solar
7
Years of Service
User Offline
Joined: 11th Apr 2017
Location: South Africa
Posted: 30th Jan 2018 19:02 Edited at: 30th Jan 2018 19:02
@ PCSKILLER - Hi! If I remember correctly, the script that you are referring to uses a formula to determine how far the helicopter is away from you, and then adjusts the volume accordingly.

I have tried it and it sounds good, but the problem I have with that script is that when you use it in a standalone game and you load a saved game, the helicopter just stands still at the position where you saved the game at.
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 30th Jan 2018 19:14 Edited at: 31st Jan 2018 08:43
Quote: "OK so the sound is being faded automatically by the engine? That's the issue then, you can fade sound yourself based on player distance to make it work properly."


LoopSound(e,1)

It works great for things like fire that burns and its volume increases as you approach and decreases as you go further away. However it is not supported with moving objects it seems. I can add a whole new routine for distance with the player and add modifiers to the volume and etc... i just.. I'm tired.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 4th Feb 2018 01:55
Okay so I attempted a workaround for the fading not working properly for moving objects. Problem is... the sound completely stops when you use the setvolume command to any variable.... I just can't win with this engine lol
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3 | TGC Assets - Store Link | Patreon - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Feb 2018 08:29 Edited at: 4th Feb 2018 08:33
@Solar: In order to save/load Lua variables they have to be global and I believe even then there are restrictions so none of my scripts really cater for it as I can't predict ahead of time what sort of load/save mechanism the author of the game will use.

For example if you have twenty helicopters flying around attacking the enemy and you save the game what are you expecting to happen on a load? Some games would load you back at the last checkpoint, some would put you back to the begining of the current mission, and some will literally act like pausing a video, you may want to do something completely new! There is no way GG can cater for all the possible load/save mechanisms so you would have to do that yourself.

What I am doing for the pickuppables script, which I am treating as a 'game ready' script, is to save certain information to a global list which 'should' get saved and reloaded, for example the 'last object dropped' info may be used by the game author to trigger some state so that is something I save to the global list, the script then checks if that is set on initialisation and if it is will set the 'real' dynamic variable used in the script. What this means is that if you save the game and the reload, when the pickuppable scripts start up they will set up certain state values to what they were on the save. Of course that may not be what you want it to do if you instead want to restart from the last mission briefing or whatever! (Hmm, on reflection I can add a 'snapshot' function which could be called from a checkpoint script to support that.)

@Teabone: have you tried simply taking the function from my helicopter script? Seems to work ok for me but I haven't tested it in stereo, I had assumed that GG didn't do stereo positioning of sounds but maybe it does.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-22 19:57:41
Your offset time is: 2024-12-22 19:57:41