Not signed in (Sign In)

Discussion Tag Cloud

Categories

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

    •  
      CommentAuthornolimiters
    • CommentTimeFeb 4th 2017
     
    ^Would be nice if it had a backwards spire too.
  1.  
    How do I add in triggered sounds?
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 11th 2017 edited
     
    i think i leave this here for now.

    nlvm uses radians anyway (could be converted, but its also nice to know):

    What is a radian?



    source: http://9gag.com/gag/a1bed7P

    not everyone learned this in school... sadly :(
    • CommentAuthorDelay
    • CommentTimeFeb 11th 2017 edited
     
    well, its 1/(pi/180), isn't it?
  2.  
    i.e. 180/pi
    • CommentAuthorKyle Sloane
    • CommentTimeFeb 13th 2017 edited
     
    Its weird that degrees is so standard in society, radians seem a lot more.. "normal" to me. I guess it makes sense because 1 radian is kind of arbitrary..
    • CommentAuthorDelay
    • CommentTimeFeb 13th 2017
     
    Radians are the radius of a circle measured on the circumference. It is different for every circle. Degrees, however, are constant and apply to all geometric forms. It simply is easier.

    Although I think that 90° instead of 100° as the right angle seems a bit weird, but 360 is a highly composite number (number of devisors is greater than every number before it), 400 isn't.
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 13th 2017 edited
     
    Posted By: DelayIt is different for every circle
    But also the length between a 1 degree arc is different for every circle - 1 rad is always ca. 57 degrees.

    For me the most intuitive measure for an angle is the full angle (or turn), where 1.0 simply means one full circle, 0.5 a half circle and so on - interestingly a very uncommon unit.
    • CommentAuthorole
    • CommentTimeFeb 13th 2017
     
    NL2 uses radians because all the native math functions (sin, cos, tan, ...) inside a CPU use radians.

    Radians make most sense because this measurement has a mathematical background. 2 Pi is the circumference of a full circle at radius=1. So using the circumference analogy for angles is straightfoward. All other units for angles are completey made up by humans and could be any numbers.

    For me, I use multiples and fractions of pi. So half circle is Pi and 90 degrees is Pi/2 and so on. It is only a question of getting used to it.

    My math teacher always told me that one should imagine that when someday we will meet aliens from other planets and ask them what kind of measurement for angles they use, it is very unlikely they will use degrees or anything other than radians.
  3.  
    Another thing with rad is that converting from angular velocity to tangential velocity is as simple as multiplying by radius , if the angular velocity is radians/sec. In physics you dont have to ever convert.
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 13th 2017 edited
     
    Some really nerdy and a bit humoristic stuff related to that: Wolfram Blog - 2 Pi or not 2 Pi. ;-)
  4.  
    Does anyone have a script that can make a splash effect appear to shoot up and touch the riders instead of just the splash behind the train? I'm trying to make a ride similar to Poseidon at Europa Park.
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 13th 2017
     
    I have made a custom water splash effect some time ago that can be rather easily teweked to fit your personal needs with the parameters at the beginning of the script file.
    • CommentAuthorA113
    • CommentTimeFeb 14th 2017
     
    Question for Scripts and especially Maya users -

    If I have a camera in a maya file (especially with keyframed geometry, with the camera constrained to the geometry), will I have to write a script in order to view the camera in the simulator?
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 15th 2017
     
    Yes, also the keyframed movements can currently not be used to attach the camera to them, you would have to move the camera with the script.
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 15th 2017 edited
     
    ^
    or simply copy the position of camera to the position of the keyframed element for each frame.
    Would be easier than calculating a path :>
    • CommentAuthorA113
    • CommentTimeFeb 15th 2017
     
    Yeah, the cameras translation is keyframed... great to hear though. Any suggestion as to how to write that script? Will the camera have to be named specifically in Maya and then called out in the script? (coming from someone with no scripting experience)
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 15th 2017 edited
     
    ^
    Ah wait.

    You have a camera file from Maya/3ds Max exported.
    Something like this:


    I dont think, you can export the camera file itself.
    It ether gets rejected by DAE or by NL2. (for me, it always gets replaced by a Null-object)
    It needs to be an actual element (like a 3D model of a camera).

    And than a function in NL2 (called: External Ride View) is the actual ingame camera.


    What you first need to do:
    Replace your camera with an 3d object (single element -> all welded together). A simple box would do the trick.
    If you can, rename it in something you remember. That name is important for later.

    As i said: in NL2 you need to copy the movement of your model element (3d model camera) to the external ride view in Nolimits.
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 15th 2017 edited
     
    This post is meaningless since it seems to work now! Answer a few post later!



    Original post:

    Posted By: Füchschenor simply copy the position of camera to the position of the keyframed element for each frame.
    Would be of course a better solution, but
    Scripting API - SceneObjectElement - getMatrix()Behaviour is undefined when using key frame animation playback.
    (also for getAbsoluteMatrix()) and I've tested it already, it really is "undefined" - so there's no way (that comes into my mind at least) to get the position of a keyframed element in a script for attatching a camera to it.

    ^^ You would have to do the same thing that Maya internally does with a script and copy the information to it. Geforcefan's framework looks as if there are functions to do this and I have also some kind of small framework to do similar things for myself, but I'm afraid both are nothing that can be used without scripting experience.

    I had some ideas to create something userfriendly, like reading the keyframes from the COLLADA file with a script, but this would require more work on components (like a working XML parser for the NLVM which is luckely already in development by "someone" (^) else) which requires some time to be developed first and who knows what's on the roadmap for NL2 internal stuff already.
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 15th 2017 edited
     
    ^
    Ah right. forgot about that nasty undefined keyframe thing >.<

    Ok. Lets hope that person you mentiond, finishes this strange parser thing.

    btw:
    the keyframing is just a bunch of numbers in the DAE.
    Basicly telling, you only need to search for <keyframe> and copy everything from this point on. :>

    the problem might be: if the animation is exported in 10 frames per secound, the result woudn't be very smooth.


    EDIT:
    Yeah, just looked into the DAE structure.
    It is something like this:


    <float_array id="Box001-POSITION-array" count="360">
    -1.500000 -1.500000 0.000000
    1.500000 -1.500000 0.000000
    -1.500000 -1.071429 0.250000
    1.500000 -1.071429 0.250000
    ....
    </float_array>



    an XML parser would be unnecessary for this. Just a substring seperating the empty space.
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 15th 2017 edited
     
    I'm afraid you confused the vertex positions of your mesh with the animation, which is a "bit" longer and probably hardly managable without a stable XML parser ;-)
    pastebin (because of the xml length)
  5.  
    How do I add in triggered off ride sounds? (Posted twice because of a lack of answer for the first post)
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 16th 2017 edited
     
    Posted By: bestdaniI've tested it already, it really is "undefined" - so there's no way (that comes into my mind at least) to get the position of a keyframed element in a script for attatching a camera to it.
    And I've luckely tested it again (thanks to Füchschens whipser), it works now in my case*: Here's the script. Have fun! - sorry for any confusion I might have caused. ;-).

    Save it as Camera.nlvm and attach it to your keyframed object! Name the camera element "cam" in your model or change the CAMERA_NAME constant in the script to match your camera element's name! Note that the local z-axis of the camera element is the axis that will point "out" of your screen and the local y-axis the axis that will point up on your screen when you have entered the camera.

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

    public class Camera extends Script{
    private static final String CAMERA_NAME = "cam";
    private static final float CAMERA_ENTERING_RANGE = 5.0f; //meters

    private SceneObjectElement cam;
    private ExternalRideView erv;

    public bool onInit(){
    SceneObject sco = sim.getSceneObjectForEntityId(getParentEntityId());
    cam = sco.getElementForName(CAMERA_NAME);
    erv = sim.createExternalRideView();
    erv.setEnterWarpPoint(sco.getTranslation(), CAMERA_ENTERING_RANGE);
    erv.setLabel(sco.getName());
    return true;
    }

    public void onNextFrame(float tick){
    if(erv.isActive()){
    Matrix4x4f mCam = cam.getAbsoluteMatrix();
    erv.setCameraMatrix(mCam);
    }
    }
    }


    *since I'm still pretty sure I've tested it in the past and it didn't worked, it would be interesting to know if this really works flawlessly in every case (more testing from my side probably later ;-))

    Posted By: TheFlyerMan1How do I add in triggered off ride sounds? (Posted twice because of a lack of answer for the first post)
    There are many scripts and examples that do this already and they should be able to be found using the forum search function.
    •  
      CommentAuthorFüchschen
    • CommentTimeFeb 16th 2017
     
    ^
    i have only tested it with baked-animation. Maybe this is why it works. :>
    (keyframe for every single frame).
    •  
      CommentAuthorTheDarkStar
    • CommentTimeFeb 20th 2017 edited
     
    Does anyone have a script for a ZDT Switchback style coaster that I could use?

    EDIT: Don't worry, I've got one now
    • CommentAuthorI305
    • CommentTimeFeb 21st 2017
     
    Would anyone be interested in modelling/scripting for me? I've been wanting to have a working cable lift on my Intamin giga, or maybe a working cable launch coaster. If you're up for it, please DM me. :)
  6.  
    Does anyone know how to script a panning camera?
  7.  
    ^You can adjust the target point switch time of the external track camera to a very long interval for a good panning effect. It takes a bit of tinkering to get it right though.
  8.  
    been a long time since iv posted here but meh worth a short, if i dont get an answer im no worse off than where i started.... scripting, is there a way to save the whole log of the console that a script generates to a separate dump file upon ending a script?
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 26th 2017 edited
     
    The console output is automatically written to %appdata%\com.nolimitscoaster.nolimits2\nolimits2_log.txt
  9.  
    ah, right, thanks, hopefully that will help debug a few things.
  10.  
    You can also avoid this by minimising the print commands in the script, as it erases it after a certain number of .print or .println commands.
    •  
      CommentAuthorrcth
    • CommentTimeFeb 28th 2017
     
    I have some questions about using packages, because I want to split up my scripts in different folders. With so many scripts, you need some overview.

    My script Master is used to instantiate all other scripts, such as the block controller, onboard audios, etc. This script is found in /scripts/Master.nlvm



    As an example, I use my BlockController class, which is found in /scripts/blocks/BlockController.nlvm.

    I changed the onInit() bool method to a normal constructor for the BlockController class to get this working. In the Master class's onInit method:
    blockController = new BlockController(this);

    Because this BlockController is now in a dfferent package, I have to import this. In the BlockController class, I specified 'package blocks;' In the Master class, I did an 'import blocks.*;'

    However, because the BlockController class also has a reference to the Master class, I need to import that class as well, but I have no idea how I would need to do that.

    'import Master;' ofcourse doesn't work. Because if you do that, you get this:
    Error in File 'scripts\blocks\BlockController.nlvm' in Line 4: Syntax error: '.' expected
    Error in File 'scripts\music\MusicList.nlvm' in Line 4: Syntax error: '.' expected
    Error in File 'scripts\music\MusicManager.nlvm' in Line 4: Syntax error: '.' expected
    Error in File 'scripts\music\Speaker.nlvm' in Line 4: Syntax error: '.' expected
    Error in File 'scripts\music\onboard\OnboardMusicMaster.nlvm' in Line 4: Syntax error: '.' expected
    Error in File 'scripts\pushcar\PushCar.nlvm' in Line 5: Syntax error: '.' expected

    Does anyone have an idea here?
    •  
      CommentAuthorbestdani
    • CommentTimeFeb 28th 2017
     
    ^ Hehe interesting question, this seems to be a possible solution:
    http://i.imgur.com/BRO6UYp.png
    •  
      CommentAuthorrcth
    • CommentTimeFeb 28th 2017 edited
     
    So if in class A I would do an import Master.Script, I could use
    public A(Master s) {

    Or not?

    EDIT: Yes it does. Thanks for the help!
    • CommentAuthoriCoaster44
    • CommentTimeMar 12th 2017
     
    I'm in search of scripts that can play sounds in a zone when pushing manual, full manual or automatic buttons.
  11.  
    what kind of script would I need to have lights stick to my coaster cars as they go?
  12.  
    Hi, I have been beginned with Texture mapping, now one thing i need to know is: is it possible to create a Displacement Shader/Function? Tnx!
  13.  
    Hey guys! Forgive me please, Im kinda new to this page, but how do you create signs like on pathways, walk view, etc? Is there a script or download for that?
    • CommentAuthorMrRC
    • CommentTimeMar 25th 2017
     
    U can make them in Google Sketchup export them as *.3ds or *de and make in NL2 a new *.SCO with the model.
    •  
      CommentAuthornolimiters
    • CommentTimeMar 26th 2017
     


    How is that Sun shafts effect created?
    i'm trying to figure it out all day, noting has worked so far.. :(
  14.  
    I'm looking to be able to play a short piece of music/sound effect (like 20 seconds) when a train goes over a trigger, does anybody have a simple music script for this?
  15.  
    I'm wondering if it would be possible to use a script to export (live during the simulator) a train's velocity, g force, etc ... hoping this is easier rather than harder. Any help would be much appreciated!
    • CommentAuthoriHack97
    • CommentTimeMar 30th 2017
     
    Hey guys,

    Is it possible to make a 'lookAt' function ? Because i'm trying to make a first person shooter...
    • CommentAuthorJetPulse
    • CommentTimeMar 31st 2017
     
    ^^A couple clarifications: What do you mean by "live". You can print text to the log file that updates "live" which is rather easy (given you're at least somewhat familiar with coding). There are functions to obtain some variables about a train (they can be found in the scripting API under the Train class). G force is one of those more difficult ones. You can get all 6 DoF's of position and then calculate G forces based on those values from the last 3 frames. It's delayed and prone noise due to it's integrative nature. The result is also FPS dependent. There's also the option of the telemetry server, but don't look to me for assistance on that. I know it's there, never even tried to use it.

    ^Possible...yes. Easy...no. I've made a basic code that does this for a circular target (done by comparing view angle and object direction angle). Although I haven't shared it yet, it's for a working elevator. When you get close to the door, a translucent cross-hair appears in the center of the screen. Point at button and click to activate the elevator's motion. I've jokingly toyed around with the idea of making a crude version of "No Limits 2: Ride for your Life Edition" from the old April Fool's Day prank back when NL2 was being developed. It's possible, but lots of difficult scripting. The primary difficulty is recognizing the shape of the target. I did circles for my elevator script because it's easy. NL2 is basically unaware of the shape of any object. Rather, it just tracks the object's origin through space. You could technically tell a script the shape of an object and go from there, but creating that definition and then running the 3D transformation between the camera and it isn't easy. There's a reason basic languages that have visual packs have this function included and people don't do it themselves.
  16.  
    Is there a script existing that would allow for example a spinning coaster to stay locked and turn 180 degrees at a certain point like Cobra's Curse does?
  17.  
    You should ask that Harry Potter ride guy. You know who I'm talking about lol.

    (I believe he used a script made for a doombuggy type ride)
    •  
      CommentAuthorZergei
    • CommentTimeApr 4th 2017
     
    Zingo is making Project Potter, but Yedrimas made the script.
    •  
      CommentAuthorNemesisRider
    • CommentTimeApr 19th 2017 edited
     
    I'm trying to make a certain kind of onboard audio for a coaster that:
    1. Has a random chance of getting one of five hidden tracks each ride
    2. Scrolls through 5 pre-selected tracks if one of the five hidden tracks is not selected

    This will be added on to the onboard audio by Phyter (which I have working).

    My main issue is I've never scripted anything in NL2 before. So there's loads of things I don't know like how to import the random module in NL2. How do I import the random module? How do I create integer variables? That kinda thing.
    •  
      CommentAuthorbestdani
    • CommentTimeApr 20th 2017 edited
     
    Look into the Scripting API, class Math:

    static double random() - Returns a pseudo-random number within the range [0,1[


    Therefore to have an simple random switch you could use the following recipe:

    double randomValue = Math.random() * 5; //random value between 0.0 and 4.999...
    int randomDecision = (int) randomValue; //casts double to integer values 0, 1, 2, 3, 4
    switch(randomDecision){
    case 0:
    //add code to play sound 1 here
    break;
    case 1:
    //add code to play sound 2 here
    break;
    case 2:
    //add code to play sound 3 here
    break;
    case 3:
    //add code to play sound 4 here
    break;
    case 4:
    //add code to play sound 5 here
    break;
    }


    What I would find more elegant in your sound case is using an array of sound objects if you know how to initialize that (otherwise forget this and use the above one):

    //randomSound is an array of StaticSound instances
    double randomValue = Math.random() * randomSound.length;
    int randomDecision = (int) randomValue;
    randomSound[randomDecision].play();


    I didn't fully get that part with the track scrolling, the code here is for the random selection.