Board index Roller Coaster Games NoLimits Coaster 2 Triggered Offride Sound? Or Triggered Onride Sound?

Triggered Offride Sound? Or Triggered Onride Sound?

All discussion relation to NoLimits Coaster 2 should be posted here. Purchase NoLimits Coaster from this page: nolimits-coaster-2-purchase-and-upgrade-links-t32524.html


Posts: 102
Points on hand: 1,124.00 Points
Location: the netherlands

Hi,

Is there a script to get Triggered Onride sound?

NolimitsProjects


Posts: 138
Points on hand: 2,126.00 Points
Bank: 1,000.00 Points
Location: Texas
There's a post here: http://forum.nolimits-exchange.com/comments.php?DiscussionID=3147

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) {
   }
}


Return to NoLimits Coaster 2

 


  • Related topics
    Replies
    Views
    Last post
cron