Not signed in (Sign In)

Discussion Tag Cloud

Categories

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

    •  
      CommentAuthorHafizBazzi
    • CommentTimeJul 26th 2016
     
    I have absolutly no experience with programming what so ever (I just created a codecademy account 5 minutes ago) But I'm currently making a Mack launch for my upcoming project, and I wanna give it a launch like Manta at SeaWorld San Diego (where the train rocks back and fourth in the preshow before launching)
    If my explaination wasnt enough, heres what im trying to explain. https://www.youtube.com/watch?v=YAgqTPKwrWM
    If anyone could help me it would be greatly appreciated :)
    • CommentAuthorCantakor
    • CommentTimeAug 2nd 2016
     
    Hi,

    I want to reverse a train like the Mount Everest Expedition coaster.

    There must exist a script park with an example. Does anybody got a download link for it?
    •  
      CommentAuthorrcth
    • CommentTimeAug 2nd 2016
     
    It's in the NL2 installation folder, along with other demo parks.
  1.  
    Is there any scripts out there that will do ride safety messages for a ride?
  2.  
    I used the script from the script park for a reverse track but it didn't work and im not sure why.
    • CommentAuthorMrRC
    • CommentTimeAug 7th 2016
     
    @UtahCoasterRider

    What do u mean with Safety Messages for the ride ?
  3.  
    ^i belive he is refering to"keep your arms and legs in the ride vehicle at all times. And i think he wants it playing through speakers, I may be wrong though.
  4.  
    Diamond is correct.
    •  
      CommentAuthorZergei
    • CommentTimeAug 8th 2016
     
    Posted By: UtahCoasterRiderIs there any scripts out there that will do ride safety messages for a ride?

    I think you use a script for attaching a sound file to an object, and use a trigger for when it winters the station, using what you know about the dispatch timing to make the other parts
    •  
      CommentAuthorZingo
    • CommentTimeAug 14th 2016
     
    Does anyone know a way to use timed videoscreen in NL2? Or better even, track triggered :)
    •  
      CommentAuthorbestdani
    • CommentTimeAug 14th 2016 edited
     
    This park demonstrates how to trigger texture animations with a script. Just use it with a screen instead of the light effect.
    •  
      CommentAuthorRCF
    • CommentTimeAug 14th 2016
     
    How would one make an animated object, like an animatronic?
    •  
      CommentAuthorRickPlays
    • CommentTimeAug 17th 2016 edited
     
    Hay guys,
    Some time ago I asked how I can make a Onboard cam. I edited now the script from @bestdani. Its an RideView script for my new Watercoaster. The problem now is that the Cam do not tilt with the Customcar.
    Her a example how it looks now:
    Bild

    Her a example how it should look like:
    Bild

    Her is the script

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

    public class SimpleRideView extends Script{
    SceneObject sco;
    ExternalRideView rideView;
    Coaster coaster;
    //Train t;

    public bool onInit()
    {
    coaster = sim.getCoaster("Contest");
    //t = coaster.getTrainAt(0);


    sco = sim.getSceneObjectForEntityId(getParentEntityId());


    rideView = sim.createExternalRideView();

    return true;
    }


    public void onNextFrame(float tick)
    {
    Matrix4x4f myMatrix = sco.getMatrix();


    Matrix4x4f myTranslationMatrix = new Matrix4x4f();
    myTranslationMatrix.initTrans(0.0f, 1.5f, 0); //1m offset in y direction
    myMatrix.multLeft(myTranslationMatrix);

    rideView.setCameraMatrix(myMatrix);

    rideView.setEnterWarpPoint(sco.getTranslation(), 5.0f);
    }

    }


    Can someone help me with the script?
    •  
      CommentAuthorrcth
    • CommentTimeAug 17th 2016
     
    This is what I use for an attached object to a train: http://pastebin.com/xr5SdNbY

    Maybe some parts of that would help you out there.
    • CommentAuthorMr. E
    • CommentTimeAug 18th 2016
     
    Quick question, probably asked before but one I cannot find an answer to, what is the closest coding language to NL2?
    •  
      CommentAuthorrcth
    • CommentTimeAug 18th 2016
     
    Java
    •  
      CommentAuthorbestdani
    • CommentTimeAug 18th 2016
     
    @RickPlays
    replace multLeft by multRight in the Script.
    •  
      CommentAuthorRickPlays
    • CommentTimeAug 20th 2016
     
    @bestdani
    Thanks, works fine. One other question. Sometimes the SCO that has the Cam to it attacht, is lagging when you are in the Camview. Is this normal or not and is it fixable?

    Thanks :D
    •  
      CommentAuthorbestdani
    • CommentTimeAug 21st 2016 edited
     
    I did not experienced any "object lagging" for now. Do you have any examples?
  5.  
    Hi, Quick question. I know there is a tutorial on the shading and specular mapping of textures but this is what wound in me. can anyone tell me in a few steps how to give a stone wall shading and specular mapping so it just seems really? thank you in advance
    •  
      CommentAuthorbestdani
    • CommentTimeAug 29th 2016 edited
     
    I don't know what you mean exactly with giving a stone "shading", I've could guess (ambient occlusion?) but can you elaborate?

    Only adding a specular mask works by changing the shading mode to custom and using the Shader code I've posted here and use your specular map as texture1 (there are also some more "advanced" examples that follow in this thread) or if you use bump lighing I can cite the manual (introduced in NL 2.2.3.5): "For bump maps, the alpha component will be used as specular masks" (if you don't need color information).

    Creating a specular mask / extracting one from a photo to get a realistic result is more an artistical question than a pure technical and in the end it's also a question which software you use. The thread that I linked to answers this side quite well.
  6.  
    Is there an way/script to make video objects or textures in Nolimits 2?

    I have a very difficult question, I'm working on a very large project named: Flying Dutchman Efteling in nolimits 2 and one who ever been here knows that hang in the queue just before the station runs two screens on the wall. Well, I have the videos for the screens available only does anyone know how I "Video" as texture and / or object gets into nolimits 2? can anyone help me or is there a script? thank you in advance!

    •  
      CommentAuthorbestdani
    • CommentTimeSep 5th 2016 edited
     
    You don't need a script for that unless you want the video to be triggered or also have a sound played synchronized. But in any case you have to convert your video into an image sequence (choose a reasonable size and as for any texture it's recommended to choose a width and height values that are a power of 2) then you can simply setup a texture animation for your screen material in the NL2MAT editor which can optionally be controlled by a script:
    http://i.imgur.com/6cLy9bu.png
  7.  
    ^ Tnx! It works. Its a very easy way to make animated video textures.
  8.  
    Can someone tell me what are the shaders codes of: Normal map, Specular map, Occlusion map, Displacement map, and diffuse map?
    • CommentAuthorDelay
    • CommentTimeSep 10th 2016
     
    Normal/Bump maps are already included and don't require you to write code. The setting can be found in the textures menu.
  9.  
    ^so when i use normal map what are the settings for it?
    • CommentAuthorDelay
    • CommentTimeSep 10th 2016
     
    What exactly do you mean by that?
  10.  
    ^ when i want to make normal map how can i do it, specular i know so normal mapping not
    • CommentAuthorDelay
    • CommentTimeSep 10th 2016 edited
     
    A normal map is more difficult to do than a bump map. In a bump map, the height is specified by a back-white image, while a normal map consists of mutliple colors for the game to read. You can look at a better explanation in the wikipedia article, I'm bad at explaining things :D
    •  
      CommentAuthorbestdani
    • CommentTimeSep 11th 2016 edited
     
    Posted By: NolimitsProjectsCan someone tell me what are the shaders codes of: Normal map, Specular map, Occlusion map, Displacement map, and diffuse map?





    NL2 Manual - NL2MAT Programmable Shader Core LanguageThere are 4 output registers (Result, Specular, Ambient, Emission) that can be used to specify the pixel attributes for furter processing.

    When lighting modes for RGB generation are used, the final pixel will be computed using the following pseudo code formula:
    Red   = Result[0] * (DiffuseLighting[0] + Ambient[0] * AmbientLighting[0]) + Specular[0] * SpecularLighting[0] + Emission[0]
    Green = Result[1] * (DiffuseLighting[1] + Ambient[1] * AmbientLighting[1]) + Specular[1] * SpecularLighting[1] + Emission[1]
    Blue = Result[2] * (DiffuseLighting[2] + Ambient[2] * AmbientLighting[2]) + Specular[2] * SpecularLighting[2] + Emission[2]
    Alpha = Result[3]



    NL2 Manual - NL2MAT EditorRGB Color Tab
    You can select the lighting type or type of RGB color generation here. Lighting mode will use the basic material settings to generate brightness and colors. Others color modes will generate color values to be used inside the shader core unit to further process and create the final pixels.

    Const - This mode simply produces the specified color. This mode works great if you want to create an object with a fixed color or brightness that should not be influenced by lighting.
    Simple Lighting - This mode is a simple lighting mode that will not use any specular lighting or directional shading. It is ideal for sprites and imposters.
    Lighting - This is the standard lighting mode.
    Bump Lighting - This is an advanced lighting mode using a bump map. To use you need to specify a bump map in one of the texture units and configure the texture unit as a bump map texture unit (see texture units).
    Vertex - This mode simply takes the colors from the 3D model file (only supported by LWO files right now, the 3DS format does not support vertex color maps)
    Wave - Generate color using a dynamic wave function. The type of wave function and it is parameters can be configured using the Setup button. This can be used to create pulsating brightness effects.
    Entity - Use the color from the entity property as part of any scene object. The entity property can be changed from within scripts attached to scene objects.


    NL2 Manual - NL2MAT Texture Unit SetupMode Tab
    Here you need to set how the texture image is being used.

    Standard - This is the default mode that is used for most cases.
    Bump Mode (using Normal Map) - The texture is used to specify the bump map for the Bump Lighting RGBGen mode and the texture is a normal map.
    Bump Mode (using Height Map) - The texture is used to specify the bump map for the Bump Lighting RGBGen mode and the texture is a height map. You can control the intensity of the bump effect using the Height Scale parameter.





    I think all questions are answered now in combination with the answeres given by Delay. These quotes should point out that all these basic questions can be answered just by having a glimpse at the NL2 manual, most options should be even rather obvious when you open the NL2MAT editor.

    Another sidenote: This has not very much to do with scripting.
  11.  
    ^tnx! For help i will try it tonight
    •  
      CommentAuthorzampano
    • CommentTimeSep 14th 2016
     
    I'm highly confused by the SceneObjectElement.SetRotation function. It requires float numbers in all forms, but I want to put like 0.01 in. I can't imagine you can only put whole numbers for the radian values since 1 rad is already like 57 degrees... can anyone help me?

    I get "Error in File 'Camera Script\rideCameraSequencer.nlvm' in Line 166: Possible loss of precision: required: float, found: double" when trying to put smaller numbers in...
    • CommentAuthorJetPulse
    • CommentTimeSep 14th 2016
     
    "float" and "double" are formats for storing numbers in memory. If you just type in "0.01", the script automatically stores it in the "double" format. This function (and pretty much all functions that have inputs of any real number) require inputs to be in the "float" format. The easiest way to fix this is to add and "f" after any number inputs or a "(float)" conversion before any variables. So, to rotate something around an axis given by a Vector3f would be:
    myObject.setRotation(0.01f,myAxisVector);
    or
    myObject.setRotation((float)myDoubleVariable,myAxisVector);
    In general, you should specify constants that aren't integers to be stored as "float" variables. So, just add the "f" at the end of the number (i.e. x=5.5f or x=0.264f etc...)
    •  
      CommentAuthorzampano
    • CommentTimeSep 14th 2016
     
    Ahhh, okay, thank you very very much!

    Now that you say it, I remember I had the same problem (and solution) last time I worked with scripts... which was quite a while ago x)
    •  
      CommentAuthorzampano
    • CommentTimeSep 15th 2016
     
    Okay, so now I want to have one trigger at the beginning of my ride that starts a timecode. I want to do a series of things depending on that timecode over the course of the coaster. How can I make sure that it's always identical, regardless of framerate or when I'm recording?
    • CommentAuthorJetPulse
    • CommentTimeSep 15th 2016
     
    sim.getCurAbsSimulationTimeSec();
    (I think this is the function, but I could be slightly wrong. Check the API to verify)

    If you use that function for you timing, it should be frame rate independent. So, in your trigger code, use something like
    startTime = (float)sim.getCurAbsSimulationTimeSec()
    And then use it to calculate a time after that to trigger whatever you want
    localTime = (float)sim.getCurAbsSimulationTimeSec()-startTime
    <some logic statement about timing and subsequent actions>
  12.  
    does anyone have a triggered lighting script? i tried getting the one in steam but being that my NL2 is not from steam i cant get it.
    • CommentAuthorlouiemacdj
    • CommentTimeSep 16th 2016
     
    Brand new to this coding malarky like the most on here..

    Pretty simple and im sure theres a tutorial somewhere that im overlooking, but basically iv made a cave with lights in it and I want these lights to only come on when a train leaves the station and then back off once it leaves..

    So my questions are, 1. How do i script this and 2. What do i do with the script once it is made?

    Many Thanks in advance
    • CommentAuthorMr. E
    • CommentTimeSep 20th 2016 edited
     
    I've been trying to get Secretimbicile's Attatch object to zero car script to work, and it does but I'm wondering how to move the light up a little bit onto the train.



    Here is the script


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

    public class AttachToZero extends Script
    {
    private SceneObject sco;
    private Train attachTrain;
    private Matrix4x4f t;

    public bool onInit()
    {
    //load the attachment object
    sco = sim.getSceneObjectForEntityId(getParentEntityId());
    if (sco == null)
    {
    System.err.println("Not a scene object");
    return false;
    }

    //find and save the train
    Coaster attachCoaster = sim.findNearestCoasterTrack(sco.getTranslation(),20).getCoaster();
    if (attachCoaster == null)
    {
    System.err.println("No nearby coaster");
    return false;
    }

    attachTrain = attachCoaster.findNearestTrain(sco.getTranslation(), 20);
    if (attachTrain == null)
    {
    System.err.println("No nearby train");
    return false;
    }

    t = new Matrix4x4f();

    return true;
    }

    public void onNextFrame(float tick){
    attachTrain.getCarMatrix(0,t);
    sco.setMatrix(t);
    }

    }


    Sorry, I have very little knowledge of coding.
    • CommentAuthorMrRC
    • CommentTimeSep 20th 2016 edited
     
    u can set the object furter away in the right direction from the X, Y or Z axe. Needs a little fiddling.

    Or u can use another script.

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

    /* **************************************************************************
    This is a generic object attachment script.

    Directions to use this script.
    1) Copy and paste attach_object.nlvm to the same directory as your .nl2sco file.
    2) Open the NL2SCO Editor and go to the Scripts tab.
    3) Select attach_object.nlvm from the Script Class dialog.
    4) Save the file and Refresh the scene object.

    View the in-game Help for creating .nl2sco files for your 3D models.

    It is unlikely that your object will be positioned exactly where you want it at first.
    You can modify the positional offset off the 3D model by adding or subtracting
    from xOffset, yOffset, zOffset below.
    *************************************************************************** */


    public class attach_object_car0 extends Script
    {
    // ====== CUSTOMIZABLE VARIABLES =======
    // Note: Decimal point "float" values must be followed by an 'f' (e.g. 0.5f, -9.205f). Whole values do not need the 'f'.
    private static final float xOffset = -0.5f; // left/right
    private static final float yOffset = 0.4f; //up/down
    private static final float zOffset = 2.26f; //back/forth
    private static final float range = 5; // The first train within this range of the scene object will receive the attachment. (range is in meters)
    private static final int carToAttach = 0 ; // Defines the car on the train that will receive the attachment. (0 = lead car or zero car)
    // ======================================

    private SceneObject sco; // Scenery object handle.
    private Train train; // Train handle.
    private Vector3f posOut = new Vector3f(0,0,0); // Will store the scenery object's position based on the car's position.
    private Vector3f pitchHeadBankOut = new Vector3f(0,0,0); // Will store the scenery object's orientation based on the car's orientation.
    private Matrix4x4f carMatrix = new Matrix4x4f(); // Will store the car's orientation.

    //**************************************************************************************
    // onInit is called when the scene object is loaded. Use this for initialization.
    // onInit should return true if initialization succeeds, else false.
    // If onInit returns false then the script will be disabled automatically and onNextFrame will never be called.
    //**************************************************************************************
    public bool onInit()
    {
    // ********************************************
    // Get the scene object handle.
    // ********************************************
    sco = sim.getSceneObjectForEntityId(getParentEntityId());
    if (sco == null)
    {
    System.err.println("attach_object.nlvm: This script must be assigned to a scene object.");
    return false;
    }

    // ********************************************
    // Determine if there is a track within range of the scenery object.
    // ********************************************
    TrackPos trackPos = sim.findNearestCoasterTrack(sco.getTranslation(), range);
    if (trackPos == null)
    {
    System.err.println("attach_object.nlvm: No track found within range of " + range + " meters.");
    return false;
    }

    // ********************************************
    // Determine if there is a train within range of the scenery object.
    // ********************************************
    Coaster coaster = trackPos.getCoaster();
    train = coaster.findNearestTrain(sco.getTranslation(), range);
    if (train == null)
    {
    System.err.println("attach_object.nlvm: No train found within range of " + range + " meters.");
    return false;
    }

    return true;
    }

    public void onNextFrame(float tick)
    {
    // ********************************************
    // Obtain the orientation matrix of the last car
    // ********************************************
    train.getCarMatrix(carToAttach, carMatrix);

    // ********************************************
    // Convert the matrix obtained from getCarMatrix()
    // to the Euler angle vector used in setRotation()
    // ********************************************
    Tools.matrixToPitchHeadBankPos(carMatrix, pitchHeadBankOut, posOut);

    // ********************************************
    // Calculate XYZ offset
    // ********************************************
    Matrix4x4f matrix = new Matrix4x4f();
    matrix.initTrans(xOffset, yOffset, zOffset);
    carMatrix.multRight(matrix);

    // ********************************************
    // Update the scene object's rotation and
    // position for this frame.
    // ********************************************
    Tools.matrixToPitchHeadBankPos(carMatrix, pitchHeadBankOut, posOut);
    sco.setRotation(pitchHeadBankOut);
    sco.setTranslation(posOut);
    }
    }
    • CommentAuthorMr. E
    • CommentTimeSep 20th 2016
     
    ^Thanks
    • CommentAuthorMrRC
    • CommentTimeSep 20th 2016
     
    No problem, if u have any problem, please ask.
    •  
      CommentAuthorRCF
    • CommentTimeSep 23rd 2016
     
    Is there a way to automatically open the restraints on a trigger, even if the train is not at a station?
  13.  
    That would be great for doing a transfer track station combo
    •  
      CommentAuthorYedrimas
    • CommentTimeSep 23rd 2016
     
    ^^ no, only with custom trains.
    •  
      CommentAuthorRCF
    • CommentTimeSep 25th 2016
     
    ^ So how would I do it with custom trains?
    •  
      CommentAuthorYedrimas
    • CommentTimeSep 25th 2016
     
    ^This is probably what you're looking for.
  14.  
    Sorry for asking but I really need help.
    I use the Sound Sphere and was wondering, can somebody help me make it play the sound when a train hit a trigger "Launch" and then it plays the whole audio file and then waits until the trigger hits again?

    Or at least something similar.
    Thanks
    •  
      CommentAuthorbestdani
    • CommentTimeSep 26th 2016 edited
     
    Make a copy of the original sound sphere directory and then replace the SoundSphere.nlvm script in the new directory:

    Note: I've not tested it yet, so there might by typos and there's no error handling giving you meaningful errors if something is wrong. Enter your coaster name and your trigger name where marked in the script by arrows.


    import com.nolimitscoaster.SceneObject;
    import com.nolimitscoaster.StaticSound;
    import com.nolimitscoaster.TrackTrigger;
    import com.nolimitscoaster.TrackTriggerListener;
    import com.nolimitscoaster.Coaster;
    import com.nolimitscoaster.Train;
    import nlvm.math3d.Vector3f;

    public class SoundSphere extends com.nolimitscoaster.Script implements TrackTriggerListener{

    private final String COASTER_NAME = "enter a coaster name here"; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    private final String TRIGGER_NAME = "enter a trigger name"; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    protected String ERROR_PREFIX = "Sound Sphere script: ";
    protected int FLAGS = 0;

    private StaticSound sound;

    public bool onInit(){
    Coaster coaster = sim.getCoaster(COASTER_NAME);
    TrackTrigger trigger = coaster.getTrackTrigger(TRIGGER_NAME);
    trigger.addTrackTriggerListener(this);

    SceneObject sco = sim.getSceneObjectForEntityId(getParentEntityId());
    if(sco==null){
    System.err.println(ERROR_PREFIX + "No scene object found!");
    System.out.println("This script has to be attached to a scene object.");
    return false;
    }
    sco.getElementAt(0).setVisible(false);

    Vector3f scale = new Vector3f(0, 0, 0);
    sco.getScale(scale);
    float range = scale.x;

    Vector3f rotation = new Vector3f(0, 0, 0);
    sco.getRotation(rotation);
    float falloff = 10*rotation.y + 1.f;
    float gain = rotation.z / (float) Math.PI + 1.f;

    String name = sco.getName();

    sound = StaticSound.loadFromResourceId(name, FLAGS);
    if(sound == null){
    System.err.println(ERROR_PREFIX + "Could not load sound!");
    System.out.println("No resource id with the name '" + name + "' is defined or sound file could not be loaded.");
    return false;
    }
    sound.setPosition(sco.getTranslation());
    sound.setDistanceParameters(range, falloff);
    sound.setEnvironmentMode(StaticSound.E_ENVMODE_LOCAL);
    sound.setGain(gain);

    return false;
    }

    public void onTrainEntering(TrackTrigger trigger, Train train){
    sound.play();
    }

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