Hi,
Is there a script to get Triggered Onride sound?
NolimitsProjects
import com.nolimitscoaster.*;
public class sound extends Script {
private static final String sCoastername = "MyCoaster";
Coaster cMyCoaster;
public bool onInit() {
cMyCoaster = sim.getCoaster(sCoastername);
TrackTrigger tTrainLeaveStationTrigger = cMyCoaster.getTrackTrigger("PlayMusic");
if(tTrainLeaveStationTrigger == null) {
System.err.println("Trigger not found");
return false;
}
TrackTriggerListener tTriggerListener = new soundTrigger();
tTrainLeaveStationTrigger.addTrackTriggerListener(tTriggerListener);
return true;
}
}
import com.nolimitscoaster.*;
import nlvm.math3d.*;
public class soundTrigger extends Script implements TrackTriggerListener {
private static final String sSoundFile = "sound.ogg";
StaticSound sSound;
public soundTrigger() {
sSound = StaticSound.loadFromFile(sSoundFile, 0);
if(sSound == null) {
System.err.println("Sound file not found");
return;
}
sSound.setEnvironmentMode(StaticSound.E_ENVMODE_LOCAL);
sSound.setPosition(new Vector3f(0.0f, 15.0f, -10.0f));
sSound.setGain(10.0f);
}
public void onTrainEntering(TrackTrigger trigger, Train train) {
sSound.play();
}
public void onTrainLeaving(TrackTrigger trigger, Train train) {
}
}