Not signed in (Sign In)

Discussion Tag Cloud

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorgreggr1
    • CommentTimeOct 2nd 2016
     
    I am trying to script Lights on No limits 2 non steam version, I want to place a light and name it section 1.1 then have one trigger on the track to switch on that light then another trigger to then switch off the light, every script I try doesn't seem to want to work so I'm out of ideas.

    Any one able to help at all, would really appreciate it thanks :)
    •  
      CommentAuthorbestdani
    • CommentTimeOct 2nd 2016
     
    Can you post some code from your scripts and elaborate what does not work exactly (error messages, no reaction at all, ...)?

    (Instead of writing your own from scratch you can also use some existing scripts / packages like this)
    • CommentAuthorgreggr1
    • CommentTimeOct 2nd 2016 edited
     
    This is the script I've found online and currently are trying to use but it's not working:

    section1.1.nlvm:
    import com.nolimitscoaster.*;

    public class Lights extends Script {
    private static final String sCoastername = "Dark Ride";
    Coaster cMyCoaster;

    public class Dark Ride 1 extends Script implements TrackTriggerListener
    {
    private static final String c_aLightSourceName = "section1.1";
    private static final String sCoastername = "Dark Ride";
    private SceneObjectLight light;
    private SceneObject sceneObject;
    private Coaster coaster;

    private TrackTrigger trackTriggerStart;
    private TrackTrigger trackTriggerStop;

    public bool onInit()
    {
    sceneObject = sim.getSceneObjectForEntityId(getParentEntityId());
    light = sceneObject.getLightForName(c_aLightSourceName);
    coaster = sim.getCoaster(sCoastername);
    trackTriggerStart = coaster.getTrackTrigger("section1.1On");
    trackTriggerStop = coaster.getTrackTrigger("section1.1Off");
    if (light == null)
    {
    System.err.println("Scene object has no light with name '" + c_aLightSourceName + "'");
    return false;
    }
    light.setEnabled(false);
    trackTriggerStart.addTrackTriggerListener(this);
    trackTriggerStop.addTrackTriggerListener(this);
    return true;
    }

    public void onTrainEntering(TrackTrigger trigger, Train train) {
    if (trigger == trackTriggerStart){
    light.setEnabled(true);}
    else{
    light.setEnabled(false);
    }
    }

    public void onTrainLeaving(TrackTrigger trigger, Train train) {
    }
    }


    Staff edit: You can use the < code > < / code > tags when you post a script, so it's easier to tell it apart from a text - be sure to have the html bullet ticked where it says "Format your comment as". I did it for you there. ;)