Not signed in (Sign In)

Discussion Tag Cloud

Categories

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

  1.  
    It works! Thanks!
    •  
      CommentAuthorFüchschen
    • CommentTimeSep 26th 2016 edited
     
    need a short hint for "3d view on 2d plane".
    The position-marker is a bit offset. And by a bit i mean: 1-2 meters ^.^


    red marker is highlighted (because it is so small, that you couldnt see it on this picture).


    public void ErvIsActive(){
    SceneObject testSco = (SceneObject)scoIndex.elementAt(0);
    ScoMatrix.initTrans(testSco.getMatrix().getTrans());
    NoLimits.getSimulator().getViewMatrix(ViewMatrix);
    ViewMatrix.multRight(ScoMatrix);
    cursor.setTranslation(ViewMatrix.getTrans());
    }


    When i use -1 on the translation, the marker disappiers completely. :/
    Is it because i need to add the angle of the plane in the matrix, too?
    • CommentAuthorMrRC
    • CommentTimeSep 28th 2016
     
    I wud like to activate some moving object at the same time the gates do open and close, is that possbile. Or is that intern in the program code ?
    • CommentAuthorJetPulse
    • CommentTimeSep 28th 2016
     
    Gate controls are inside the station handler. Unless it's changed recently, this information can't be accessed
    •  
      CommentAuthorSedjuuurd
    • CommentTimeOct 6th 2016
     
    hey everyone i suck at scripting. there might possibly be a really easy solution to this but:

    i want a side ways moving transfer table as lift. and just when the train enters the transfer it gets moved to the other end and then released.

    here is my little setup:

    http://imgur.com/a/V0lvm

    i wanted this to work since the day i was born. so i would really love it if someone helped.

    thanks in advance Sjoerd van Bladel
  2.  
    I can already feel my shoulder digging into the OSTRs, or my hip digging into the lapbars :(

    The laterals would really hurt, is my point
    • CommentAuthorMr. E
    • CommentTimeOct 7th 2016
     
    CrazyCoaster did something like this in Terra Phase 2 in the indoor section.
    •  
      CommentAuthorSedjuuurd
    • CommentTimeOct 7th 2016
     
    Yup thats why i got back to it. but the problem is i looked into his script but it was a 3900 line script...
    •  
      CommentAuthorYedrimas
    • CommentTimeOct 7th 2016
     
    Use this and use the transfer table as a switch.

    German tutorial (even if you dont understand german it's pretty easy to follow)
    • CommentAuthorMrRC
    • CommentTimeOct 8th 2016 edited
     
    Is there an delayed timer script, when a train hits an trigger (placed on the track) it startes the timer, when the timer has reached the end and then let an object rotate ?
    • CommentAuthorMrRC
    • CommentTimeOct 12th 2016 edited
     
    Is it possible to let a TransferTable with a script, it will behave like this :

    Train enters from right side of the track, transfer slides to the left,(waiting for several seconds) and slides to the right and then train leaves the TransferTable.

    I did search from scripts or tutorials but didn't find any.

    plz HELP.

    It should behave like this :

    https://www.youtube.com/watch?v=2_btktxuR4o
  3.  
    OK i have these red beacon lights on my coaster which are just cylinders that use an nl2 mat with constant lighting enabled:
    https://gyazo.com/407a17e583a49df596b40834d8a4a35e
    Is there some sort of script i could use in the nl2 mat itself to cause the constant lighting to flash on and off, if not can it be done with a regular light instead?
    •  
      CommentAuthorbestdani
    • CommentTimeOct 16th 2016 edited
     
    ^ Could be controlled by scripting but there's also a setting in the NL2MAT for this:
    http://i.imgur.com/K32DA0H.png
    Maybe change the Function from Sine to Rectangle or try other settings.

    Control the color in that way:
    http://i.imgur.com/bjIezsW.png
  4.  
    AHA i always wondered what that was for, thank you!
    https://gyazo.com/d3487fb3c9daddc756f24f96c4f62b9d
    • CommentAuthorTOGO Fan
    • CommentTimeOct 16th 2016
     
    I do not think the lift is slow enough. It should 0.6 MPH.
    •  
      CommentAuthordapalm
    • CommentTimeOct 18th 2016
     
    Need help with something... I want to make a screen displaying a movie... I know someone made a script for this, but I haven't been able to find it.
    •  
      CommentAuthorKingRCT3
    • CommentTimeOct 18th 2016
     
    •  
      CommentAuthordapalm
    • CommentTimeOct 18th 2016
     
    That's perfect, thanks a lot!
  5.  
    I'm entitled to a prize for managing this, right?

    • CommentAuthorJetPulse
    • CommentTimeNov 2nd 2016
     
    Haha. I did that a while ago doing (what appears) to be something similar. I have a process by which I can get terrain data from Google Earth into NL2. It, obviously, requires the terrain height to be set at every node. Well, 768x768 nodes is just under 600k nodes. NL2 didn't like running a 600k line script. I ended up breaking it into 768 subroutines that each handle a row of 768 nodes. Then a master that simply calls all the subroutines. Takes about 1.5 hours to run the script in NL2. Ultimately the whole terrain transfer process from Sketchup to NL2 takes about 6 hours of computation time.
    •  
      CommentAuthorNemesisRider
    • CommentTimeNov 2nd 2016 edited
     
    Is there a way to make an NL2mat glow?

    EDIT: Or make the parent object glow?

    EDIT EDIT: Found bestdani's post from a while ago covering my question, problem is now solved :)
    •  
      CommentAuthorbestdani
    • CommentTimeNov 2nd 2016 edited
     
    Posted By: secretimbecileI'm entitled to a prize for managing this, right?

    Nice one! :D

    My version saves the image as a simple binary file that nl2 reads using the rather new binary file reading functions:
    http://i.imgur.com/XEJqfRE.jpg

    Python3 script:

    from PIL import Image

    try:
    image = Image.open("heightmap.png")
    except FileNotFoundError:
    print("file heightmap.png is not present!")
    except:
    print("unknown error")
    else:
    image = image.rotate(270)
    width, height = image.size
    data = []
    data += (height).to_bytes(2, byteorder='big')
    data += (width).to_bytes(2, byteorder='big')
    data += image.getdata(0)
    try:
    with open("heightmap.bin", "wb", buffering=0) as file:
    file.write(bytes(data))
    except:
    print("could not create heightmap.bin file! Do you have the rights to write files here?")


    NL2 script:

    import com.nolimitscoaster.*;

    public class Heightmap{
    public static void main(){
    float base = 1.f;
    float amplitude = 50.f;
    int dataOffset = 4;

    Park park = NoLimits.getEditor().getPark();
    if(park == null){
    System.err.println("no park opened");
    return;
    }
    byte[] data = Tools.loadBinaryFile("heightmap.bin");
    int length = data.length;
    if(length < dataOffset + 1){
    System.err.println("file format error!");
    System.out.println(" the file size must be at least 5 bytes");
    return;
    }

    int height = data[0] << 8 | data[1];
    int width = data[2] << 8 | data[3];
    System.out.println("image dimensions: "+height+" * "+width);
    if(length - dataOffset != height * width){
    System.err.println("file format error!");
    System.out.println(" the file size does not match the specified image dimensions");
    return;
    }
    bool dimensionsOk = true;
    if(height > park.getTerrainVertexDimY()){
    System.err.println("data dimension error!");
    System.out.println(" height > "+park.getTerrainVertexDimY());
    dimensionsOk = false;
    }
    if(width > park.getTerrainVertexDimX()){
    System.err.println("data dimension error!");
    System.out.println(" width > "+park.getTerrainVertexDimX());
    dimensionsOk = false;
    }
    if(!dimensionsOk){
    return;
    }
    float[][] terrheight = new float[height][width];
    for(int i = length - 1; i >= dataOffset; --i){
    int pos = i - dataOffset;
    terrheight[pos / height][pos % height] = (data[i] & 0xFF) / 255.f * amplitude + base;
    }
    park.setTerrainHeightsAtVertices(terrheight, 0, 0, width, height, 0, 0);
    }
    }
  6.  
    Nice one, works great. Thanks
    •  
      CommentAuthorbestdani
    • CommentTimeNov 3rd 2016 edited
     
    While trying to reverse this process as suggested by COASTERGUY246 in my scripts thread I got the following as I tried to print a loooooong String with all the data to the console (since this is the only way to get such data out of NL2 as far as I know). :D
  7.  
    I know there's an attach object script available so you can attach an object to a train, but is there one available so you can attach an object to a moving piece of track? For example if I wanted to attach a custom track piece to a transfer table?
  8.  
    I wish such a thing did exist, because its always annoyed me how two tube track switches are always floating and impossible to support without clipping through the track. But as far as i know it does not, i know it is possible, but i think you need a custom block script and various other stuff for it to work.
    • CommentAuthorMrRC
    • CommentTimeNov 4th 2016
     
    @ Crazy coaster, thats possible

    U can use the moving object script but use the "slide" option to move with the transfertable. Needs a lil fiddeling with a timer and some triggers.
    But that might work.

    Good luck
    •  
      CommentAuthorbestdani
    • CommentTimeNov 4th 2016 edited
     
    It's possible by attaching the object to the rail of the transfer table:


    //Save as AttachRail.nlvm and use this on your scenery object, move the object close to the transfer table rail in the Editor
    import com.nolimitscoaster.*;
    import nlvm.math3d.*;

    public class AttachRail extends Script{
    private static final float SCAN_RADIUS = 1.0f;
    private static final String SCRIPT_NAME = "AttachRail.nlvm: ";

    private SceneObject sco;
    private TrackPos tp;

    public bool onInit(){
    sco = sim.getSceneObjectForEntityId(getParentEntityId());
    if(sco == null){
    System.out.println(SCRIPT_NAME+"This script has to be attached to a Scene Object!");
    return false;
    }
    tp = sim.findNearestCoasterTrack(sco.getTranslation(),SCAN_RADIUS);
    if(tp == null){
    System.out.println(SCRIPT_NAME+"Could not find a coaster track within a " + SCAN_RADIUS + "m range!");
    return false;
    }
    sco.setMatrix(tp.getCenterRailsMatrix());
    return true;
    }

    public void onNextFrame(float tick){
    sco.setMatrix(tp.getCenterRailsMatrix());
    }
    }
  9.  
    Brilliant, Bestdani you legend, it worked. It did come up with a warning however, saying;

    "Warning in File 'Objects\AttachRail.nlvm' in Line 3: Imported package not used: nlvm.math3d
    ...0 error(s), 1 warning(s)"

    But I deleted Line 3 and it seems to still work. Thanks for your help!
    •  
      CommentAuthorNemesisRider
    • CommentTimeNov 4th 2016 edited
     
    I mentioned this in my own thread but I need some help on the execution.

    I have an idea in my project which involves making colour changing cubes that would change in sync with the lighting set by bestdani. Now, I feel almost certain this would involve scripting, and I think I could probably get the time measurements off of bestdani's light's script for the default setting. Also, I'm not sure if the script for this would spoil bestdani's glowing effect.
    Anyone able to help me with this or at least point me in the right direction? I'm a bit of a noob in regards to NL2mats, NL2sco settings and all that stuff.

    And for context, these are the type of cube I'd want to colour change:

    •  
      CommentAuthorbestdani
    • CommentTimeNov 5th 2016 edited
     
    The new (3creativeD) effect set or the old one?

    For the new one no scripting is required if you want to include own objects since it uses more modern NL2 functions. It just requires to attach the script with a configuration file that tells the script how the object should be colored (which would be most likely the same configuration used by the LED PAR just without the real light source). ;-)
    Since there's no manual / tutorial how to do it yet (you are the first one who asks how to include own objects) I suggest that you respond in the the thread to get a more detailed instruction. This is also the case if you use the old set since I've created some additional scripts that allow to do excactly this for myself with the old one, but it's not included in the public download since it uses some "quick and dirty" quirks.
  10.  
    ^ Yeah, the new 3creativeD one.
    • CommentAuthortlansdell
    • CommentTimeNov 6th 2016
     
    I'm currently working on an Intamin Semi-Shuttle. I don't really have too much experience with scripting (which makes me kinda regret going this route but oh well), but I do have a script currently in place using Musickid43's script generator. It works for the most part; the only problem that I have with it is that the train launches backwards first instead of forward. Is there a way I could modify the script so that it launches forward first?

    It's still a work in progress
    •  
      CommentAuthorCrazycoaster
    • CommentTimeNov 8th 2016 edited
     
    So I have a question about the static sound script if anyone can help me?

    Basically, I'm using this script here to add music to an area:


    import com.nolimitscoaster.*;
    import nlvm.math3d.*;

    public class staticsound2 extends Script
    {
    private SceneObject sco;

    private StaticSound sound;
    private static final float Distance = 5.0f;
    private static final float FallOff = 6.0f;

    public bool onInit()
    {
    sco = sim.getSceneObjectForEntityId(getParentEntityId());

    sound = StaticSound.loadFromFile("Silverado.ogg", 0);
    if (sound == null)
    {
    System.err.println("Sound file not found");
    return false;
    }

    Vector3f pos = new Vector3f();
    sco.getTranslation(pos);

    sound.setEnvironmentMode(StaticSound.E_ENVMODE_GLOBAL);
    sound.setPosition(pos);
    sound.setDistanceParameters(5.0f, 6.0f);
    sound.setDopplerMode(false);

    sound.playLoop();
    return true;
    }
    }


    Aaaand normally it works well. But for some reason, the falloff with the particular piece of music I've chosen seems mega amplified? So if I've figured it out correctly, using the above script, the sound should be heard clearly in a 5m sphere, and then it should get quieter as you move away, until you're another 6m from the sound and you should not be able to hear it. But the piece of music I've used can be heard from well over that, at least 100m away. Have I done something wrong?
    • CommentAuthorMrRC
    • CommentTimeNov 8th 2016 edited
     
    I use these variables and it works good for me.

    private static final float Distance = 3.0f;
    private static final float FallOff = 7.0f;
    •  
      CommentAuthorbaadrix
    • CommentTimeNov 9th 2016 edited
     
    ^^As far as I know the falloff factor isn't a distance, rather just that: a factor. So the higher you set it the more sudden the transition between the original sound and silence is. For a small area like yours a factor of 10-20 should work well enough.
    (For more details about the calculation take a look at the help file.)
  11.  
    ^ Ahh, well that would make much more sense then! I've been going about it all wrong haha.

    ^ Those figures worked, thankyou.
    •  
      CommentAuthorbestdani
    • CommentTimeNov 9th 2016 edited
     
    If it works as expeted for now(?) then everything is fine and you can maybe ignore this:

    But I noticed that in the example that you posted, the parameters were "hardcoded" (did you just changed it for testing?)
    sound.setDistanceParameters(5.0f, 6.0f);andprivate static final float Distance = 3.0f;
    private static final float FallOff = 7.0f;
    would not been used at all.

    I'm also confused since actually there shouldn't be such an extreme difference between both parameters for example in 20m distance (compare here where x is in meters!) using to the formula of the NL2 manual:
    NL2 Manualgain: distance = max(distance, referenceDistance); FinalGain = gain * referenceDistance / (referenceDistance + rolloffFactor * (distance - referenceDistance));
    •  
      CommentAuthorTyrush
    • CommentTimeNov 16th 2016
     
    Does anyone have a chaser light script for wooden coasters? Or is there one out there?
    •  
      CommentAuthorjpaufsc
    • CommentTimeNov 16th 2016 edited
     
    The light pattern creator is the best thing to use. Code also has a tutorial available if you need it.
    •  
      CommentAuthorTyrush
    • CommentTimeNov 16th 2016
     
    Awesome thank you!
    • CommentAuthortlansdell
    • CommentTimeNov 17th 2016
     
    Can anyone help me with an Intamin Semi-Shuttle Script? I have one in place right now that kinda works but it launches backward when the switch moves instead of forwards. Is there any way I can modify the script I have or would I have to start from scratch?
    • CommentAuthortlansdell
    • CommentTimeNov 17th 2016
     
    Thank you very much! Just sent you an email.
    •  
      CommentAuthorProjektion
    • CommentTimeNov 18th 2016
     
    If I use ".getTranslation();" on an element of a scenery object gives me the xyz of the element in relation to the parent element. Is there an easier way to get the xyz of where the element appears in relation to the whole map?
    •  
      CommentAuthorRK
    • CommentTimeNov 18th 2016
     
    '.getAbsolutMatrix().getTrans();' works for that purpose.
    • CommentAuthorAirbossYT
    • CommentTimeDec 2nd 2016
     
    Hey everyone,

    I made a comment on the official suggestion thread for NL2 on steam a while back, asking if rolling blocks could be added. I was told by one of the developers that this could be added with scripting, and they said to look around here.. I'm pretty new to scripting, and was wondering if any of you could point me to where I could find more about this. Essentially I am looking for how to move trains in tandem, like on Millennium Force at Cedar Point. The train coming into the station can essentially start to move into the station while the first train is still in it. This means that two trains are in one block but in a safe manner. Having been to Cedar Point, I absolutely LOVE how this works, and would love to see this ingame. Could anyone help me find more about this? Thanks!
    • CommentAuthorMrRC
    • CommentTimeDec 4th 2016
     
    Is it possbile to make an object (like a spotlight) invisible so that only the beam of light is visible ?

    Kind regards,

    MrRC.
    •  
      CommentAuthorzampano
    • CommentTimeDec 11th 2016
     
    Does anyone know if or how it is possible to have a script "ignore" pausing the game? I've got some button actions that I'd very much like to use in pause mode..
    •  
      CommentAuthorFüchschen
    • CommentTimeDec 11th 2016 edited
     
    I think i'll put it here...

    NL2 - Formular Development Environment

    Can i somehow concat multiple elements together?
    length = 5
    radius = 5
    radiusB = 0.1

    angleX = 90
    angleY = 90
    angleZ = 90
    angleB = 0

    StartposX = 0
    StartposY = 90
    StartposZ = 90
    StartposB = 0

    radX = t*angleX/180*pi+ (StartposX/180*pi)
    radY = t*angleY/180*pi+ (StartposY/180*pi)
    radZ = t*angleZ/180*pi+ (StartposZ/180*pi)
    tilt = t*angleB/180*pi+ (StartposB/180*pi)

    Xsection1 = radius * sin(radX)
    Ysection1 = radius * sin(-radY)
    Zsection1 = radius * cos(radZ)

    Bsection1 = radiusB * cos(tilt)


    B = Bsection1
    x = Xsection1
    y = Ysection1
    z = Zsection1



    Im looking for a way to add multiple sections together in one code.

    (I know, this wont work that way, but just as an example):
    x=0
    y=Ysection1 + Ysection2 + ...
    z=Zsection1 + Zsection2 + ...

    Do i have to use it with the switch-statement?
    something like:
    switch(t){
    ....
    }
    ?
    •  
      CommentAuthorbestdani
    • CommentTimeDec 11th 2016
     
    ^I also guess that it is supposed to be done using that switch.