Board index Roller Coaster Games NoLimits Coaster 2 NoLimits Coaster 2 Scripting Scripting help- making different sounds play

Scripting help- making different sounds play

Post your Nolimits 2 scripts here! Also any discussion regarding scription for NoLimits Coaster 2 should be placed in this forum

Post January 26th, 2014, 5:03 am

Posts: 59
Points on hand: 1,468.00 Points
(soundtwo.nlmv)http://pastebin.com/FPcyZA1x
(soundTriggertwo.nlvm) http://pastebin.com/gAAP4KpK
(sound.nlvm) http://pastebin.com/hEwckutF
(soundTrigger.nlvm) http://pastebin.com/PjnN3fJN

I'm trying to recreate the Flight of Fear, and scripting is really giving me a headache, but at least I've gotten the soundtrack to begin to play! The soundtwo/soundTriggertwo are supposed to be for a launch sound. sound/soundTrigger are supposed to be for music that plays throughout the ride in speakers, so I didn't use onboard audio as the whole area can hear the music. I can get just the music to work, but when I add the launch sound, nothing happens. If I remove the scripts for the music just to hear the launch, the music still plays in play mode. I also tried moving around the triggers to see if that helped, but it didn't. Is this a bug? And despite whatever I'm doing wrong, can two sounds play at once like this? I don't get any errors or anything, but I cannot get the launch sound to play for my life. Maybe it has to do with two scripts using code involving the train leaving the station? Does it have to use "tTrainLeaveStationTrigger"? Also I'm wondering if the order that I load the scripts under the "Coaster properties" tab matters...

I'm also trying to figure out how to make the sound automatically restart when another train enters the trigger. Like if the soundtrack hasn't completed currently with the code I have, it finishes and doesn't repeat for the next train. I want the soundtrack to always be playing on repeat because for a complete circuit, it repeats a little bit (like the coaster I'm recreating does in real life). But when the next train launches the soundtrack should focus to that train and play the music from the beginning again.

I'm really trying my best to figure this out, I've already gotten so far in at least making the soundtrack partially work! I'd really appreciate the help, I really wish there were a tutorial or something on basic scripting like this stuff :/
Last edited by austinjb555 on January 26th, 2014, 5:07 am, edited 1 time in total.

Post January 26th, 2014, 10:37 am

Posts: 151
Points on hand: 374.00 Points
Location: Virginia, USA
In soundtwo.nlvm you create a new instance of the soundTrigger class. It's a perfectly legal thing to do and won't cause an error, but it won't work the way you want with the way you have it set up. What is happening is when your coaster tries to play the launch sound, it creates another instance of the music trigger causing music to play.

You need to instantiate soundTriggertwo so that the launch sound plays. In soundtwo.nlvm change line 16 so it reads
TrackTriggerListener tTriggerListener = new soundTriggertwo();

Post January 26th, 2014, 11:44 pm

Posts: 59
Points on hand: 1,468.00 Points
Thank you! I now have multiple sound files playing at once. Now onto learning more with the lights and scripting!

Post January 31st, 2014, 2:43 am

Posts: 1275
Points on hand: 3,816.00 Points
Location: Bay Area, CA

Not to try and hijack this thread but I was curious about where these scripts go...I'm going to try using the scripts you had done to see if I can pull off something similar with a track I'm working on.
Thrills by the Bay - Your #1 News Source for Bay Area Parks!
http://thrillsbythebay.blogspot.com

Post January 31st, 2014, 8:08 am

Posts: 151
Points on hand: 374.00 Points
Location: Virginia, USA

Post January 31st, 2014, 10:20 pm

Posts: 1275
Points on hand: 3,816.00 Points
Location: Bay Area, CA

^ So does this apply to if I want a certain sound to fire off when the train passes by? Here's what I have so far: I have an onboard sound track playing as soon as the ride dispatches. It gets to a brake where it pauses for 5 seconds before it launches. During this pause/when the train hits the brakes, I have an alarm sound effect I'd like to have fire off before the train launches. If push comes to shove, I can edit the audio and include the alarm in the already-made soundtrack.

Using the sound trigger scripts posted in this thread, is it still applied to the coaster or is it applied to an object placed near the brake?
Thrills by the Bay - Your #1 News Source for Bay Area Parks!
http://thrillsbythebay.blogspot.com

Post January 31st, 2014, 11:03 pm

Posts: 151
Points on hand: 374.00 Points
Location: Virginia, USA
The script is part of the coaster. It fires when the train passes a trigger.


Return to NoLimits Coaster 2 Scripting

 


  • Related topics
    Replies
    Views
    Last post