Hey MrRC,
thanks for the script.
I modified the .nlvm script with my own .ogg-file names and created a NL2Script with the NL2 Editor.
*public class Onboard_Multi_Music extends Script implements TrackTriggerListener
{
private static final String soundFile1 = "Sound 1.ogg";
private static final String soundFile2 = "Sound 2.ogg";
private static final String soundFile3 = "Sound 3.ogg";
private static final String sound1TriggerName = "Sound 1";
private static final String sound2TriggerName = "Sound 2";
private static final String sound3TriggerName = "Sound 3";
private TrackTrigger sound1Trig;
private TrackTrigger sound2Trig;
private TrackTrigger sound3Trig;
public bool onInit()
{
Coaster coaster = sim.getCoasterForEntityId(getParentEntityId());
sound1Trig = coaster.getTrackTrigger(sound1TriggerName);
sound1Trig.addTrackTriggerListener(this);
sound2Trig = coaster.getTrackTrigger(sound2TriggerName);
sound2Trig.addTrackTriggerListener(this);
sound3Trig = coaster.getTrackTrigger(sound3TriggerName);
sound3Trig.addTrackTriggerListener(this);
return true;
}
public void onTrainEntering(TrackTrigger trigger, Train train)
{
StreamedSound sound1 = StreamedSound.loadFromFile(soundFile1);
StreamedSound sound2 = StreamedSound.loadFromFile(soundFile2);
StreamedSound sound3 = StreamedSound.loadFromFile(soundFile3);
if (trigger == sound1Trig)
{
train.setOnboardStreamedSound(sound1);
sound1.play();
}
else if (trigger == sound2Trig)
{
train.setOnboardStreamedSound(sound2);
sound2.play();
}
else if (trigger == sound3Trig)
{
train.setOnboardStreamedSound(sound3);
sound3.play();
}
}
public void onTrainLeaving(TrackTrigger trigger, Train train)
{
}
}*
But there is always an error:
"Execution time: 3ms
Execute Plugin..
Error in File '....\Users\marku\OneDrive\Dokumente\com.nolimitscoaster.nolimits2\TestPark\Onboard_Multi_Music.nlvm' in Line 1: Unknown type: Script
Error in File '....\Users\marku\OneDrive\Dokumente\com.nolimitscoaster.nolimits2\TestPark\Onboard_Multi_Music.nlvm' in Line 1: Unknown type: TrackTriggerListener
...2 error(s), 0 warning(s)"
Then I added
import com.nolimitscoaster.;*
at the beginning of the script and got another error:
*"Execute Plugin..
Executing Plugin...
Exception: NoSuchMethodError: public static void Onboard_Multi_Music.main()
Execution time: 2ms"*
Is that maybe because of a wrong file system structure?
Windows(C:)
users
me
documents
com.nolimitscoaster.nolimits2
That file includes:
- Onboard_Multi_Music.nl2script
- Onboard_Multi_Music.nlvm
- preview-speakr.png
- sound1.ogg
- sound2.ogg
- sound3.ogg
- TestPark.nl2park
- TestPark.nl2park_backup
Sorry for my "stupd" questions. But I´m a absolute beginner in scripting.
They will lead to three different coasters.
They go to the new shuttle jet coaster.