Scripts / Sound zones

Author
Message
tommy8
GameGuru TGC Backer
16
Years of Service
User Offline
Joined: 24th Dec 2007
Location: Northern Ireland
Posted: 4th Sep 2014 05:43
How do you get a sound to be active and repeat in a loop when the player enters a sound zone?

Thanks.
PM
tommy8
GameGuru TGC Backer
16
Years of Service
User Offline
Joined: 24th Dec 2007
Location: Northern Ireland
Posted: 4th Sep 2014 19:15
okay, i stupidly used the wrong file extension but the sound only plays once. How do i make it loop indefinitely?


Anyone?
PM
Northern
13
Years of Service
User Offline
Joined: 5th Nov 2010
Location: Brazil
Posted: 4th Sep 2014 20:16
Hi tommy8,

After you put a Sound Zone into your game level, right click on that to access the inspector panel or property's panel. Search for the title 'AI System'.

Below of it, there is a row named 'Main' with the Lua script 'soundinzone.lua.'

Now, click inside the row 'Main', and you will may see a little square, on the right with three dots. Following, click on that to access the 'scriptbank' folder and scroll down until find out the Lua script titled 'musicinzone.lua'. Next, select it and click on button 'Open'.

After that, on the inspector panel, search the row 'Sound'. Below it, you will find a row with the word 'Sound0'. Click on that. Once again, the little square with three dots shows up, on the right. Click on that again and you will be taken to the folder 'audiobank.' It's time to choose your music to loop endless. Next, click open.

After to return to inspector panel, click on 'Apply Changes' button to save your changes. That's it!

Now, in test mode, after you enter the sound zone, the music you have chosen will play continuously.

Have fun!

Northern
PM
tommy8
GameGuru TGC Backer
16
Years of Service
User Offline
Joined: 24th Dec 2007
Location: Northern Ireland
Posted: 5th Sep 2014 01:51
that worked great, thanks for the helpful advice.

One of the resident developers ought to post a glossary stating what the stock scripts actually do. Would save a lot of time.
PM
Northern
13
Years of Service
User Offline
Joined: 5th Nov 2010
Location: Brazil
Posted: 5th Sep 2014 22:22
@tommy8,

You're welcome. I am glad you have solved the sound zone loop issue.

Regarding to Lua glossary, stating what the stock scripts actually do, you might read the thread named '
LUA Scripting commands and structure' [col
PM
Volga
9
Years of Service
User Offline
Joined: 31st May 2014
Location: Turkey
Posted: 18th Nov 2014 19:48
@Northern,

Thanks for the information. When I'm inside the soundzone, music is looping. However, when I'm outside the soundzone, music is still looping. Is there any way to loop the music only in the soundzone? I want to end the music if player exits t
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Nov 2014 13:30
i believe music in zone is what you're after



life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Volga
9
Years of Service
User Offline
Joined: 31st May 2014
Location: Turkey
Posted: 19th Nov 2014 17:39
It worked, thank you so much.

Vertigo
Northern
13
Years of Service
User Offline
Joined: 5th Nov 2010
Location: Brazil
Posted: 19th Nov 2014 18:43
Hi Volga,

Below you may find the link to another option to stop the sound after the player leaves the sound zone trigger, but introducing a generic faded out sound effect. For large sound zone area, you might find some issues (greater than 1000 units in diameter from the eye ball thing, inside the sound zone), but works fine with little to medium-sized areas (less than 1000 units in diameter). For example, it might be great if you have a machine, such as a generator, crusher or a vehicle with its engine running, where you need some kind of faded out sound effect after moving away from the object.

https://dl.dropboxusercontent.com/u/64612150/scriptbank.zip

I hope this might help as well.
Have fun!
Northern
PM
Volga
9
Years of Service
User Offline
Joined: 31st May 2014
Location: Turkey
Posted: 19th Nov 2014 19:36
Thanks a lot, it worked!

Vertigo
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 30th Nov 2014 11:06
How to do to play a piece of music in a level. Is it possible to play music at the start of a level without soundzones?
Can you test this or will it only be working in the standalone?

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-05-02 09:08:55
Your offset time is: 2024-05-02 09:08:55