Not signed in (Sign In)

Discussion Tag Cloud

Categories

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

    •  
      CommentAuthorFüchschen
    • CommentTimeMay 14th 2016
     
    ^
    Maybe with "Scripted (Experimental) mode".
    This way, you can check, if "emergency stop" is active or not.

    but than, you'll need to script every condition by yourself. each block, each station and everything else.
    •  
      CommentAuthorbestdani
    • CommentTimeMay 14th 2016
     
    ^ As far as I know there isn't an API method to check if the emergency stop is enabled.
    •  
      CommentAuthorFüchschen
    • CommentTimeMay 14th 2016 edited
     
    not even with the block system controler?
    I was sure, there is some sort of feedback for the emergancy stop.

    Hmm... maybe im mistaken it right now with another scripting api.

    You could still check, if every train has stopped on a block. It woudln't immediately activate the alarm, but after a a while.
    •  
      CommentAuthormkj3322
    • CommentTimeMay 18th 2016
     
    Since i'm new to scripting, I've been using a scripting generator found on this forum. It's worked pretty well, but i'm not sure how to access sub-objects made within sketchup. I know you have to make components, but what are they called after exporting? For instance, my model name is sky screamer, and I made a component called chairs. I want the chairs/ swings to pivot along the already moving frame, however I have no idea how to access the parts within the model.

    Thanks Guys!
    •  
      CommentAuthorbestdani
    • CommentTimeMay 18th 2016 edited
     
    The subobjects / components are called scene object elements in the API, you can use SceneObject.getElementForName(String name) method which returns a SceneObjectElement (or null if nothing is found).

    In your case it could look about like this:

    /*
    **probably somewhere in public bool onInit():
    */

    //get the actual scene object
    SceneObject sco = ... ;

    //get the scene object element "chairs"
    SceneObjectElement elmChairs = sco.getElementForName("chairs");


    /*
    **somewhere in public void onNextFrame(float tick) for example:
    */

    //rotate the chairs around the z axis, do something that rot oscillates to make them swinging
    elmChairs.setRotation(rot, 0, 0, 1);
    •  
      CommentAuthormkj3322
    • CommentTimeMay 18th 2016 edited
     
    I only got a warning still. Axis should be good as it is set to rotate specifically.
  1.  
    Excuse me friends. Is there any way to change the gravity in no limits 2? For example, I would like to change it to mars gravity instead of earths. I want to see how the roller coaster would function in a different gravity.
    •  
      CommentAuthorKingRCT3
    • CommentTimeMay 19th 2016 edited
     
    You can't do that, unfortunately.

    (The discussion is now taking place in the Official Ask thread, if you guys want to add something. Thanks!)
    •  
      CommentAuthormkj3322
    • CommentTimeMay 20th 2016 edited
     
    Continuing on to the next portion of my issue. Does anybody know how to set up separate pivot points in sketchup? I have my object moving, and can operate the elements seperately now. However, the elements are rotating around the original axis rather than the one I defined for them.
    •  
      CommentAuthorSedjuuurd
    • CommentTimeJun 5th 2016
     

    Hello, i was wondering if anyone of the NL2 Community was able to group up with me. and work with a slow pace on a "europapark poseidon" like coaster.

    since that style is not inplemented in NL2. and i was hoping that one of the better coders not me, i cant code shit xDD could group up a bit and help me.

    i know 3D modeling and i visited europapark last week. so i have enough refrence pics.

    so hope someone thinks this is fun enough.

    greetings Sedjuuurd

    P.S. let me know by whispering, and if possible what way to communicate. skype. mobile number. excetra

    note again, slow pace so not every week, i have a busy schedule, collabs, many artworks and excetra

    •  
      CommentAuthorPearman
    • CommentTimeJun 9th 2016
     
    Hello
    I'm in progress to create a TopSpin, but I have some problems with writing the script, because I don't know what parts of the model I have to make as one group. Also I don't know how to move the gondola with the rotating arms but make itself rotate as well. Is there anyone who can explain how to make multiple animations in one animation? I would realy appreciate if there was anyone who can help :)
    •  
      CommentAuthorbestdani
    • CommentTimeJun 9th 2016 edited
     
    If you want to animate the object in your 3d software it's not an issue that has to do with scripting.

    If you want to use scripting for the movements it is also completely a matter of how to group it in the 3d software and usually make everything a group that should be moved later and ensure that the hiearchy is set correctly, then just using one of the SceneObjectElement.setRotation(...) method variants should work immediately as expected.

    There's also the option if for some reasons the export does not work as expected to calculate the matrices of the elements manually to control the hiearchy in the scripts.
    • CommentAuthoriHack97
    • CommentTimeJun 11th 2016
     
    Is this correct ?

    public class BlockScript extends Script implements BlockSystemController TrackTriggerListener

    because i want to add triggers to my script which controls my scripted coaster...

    Please anwer,

    Thanks
    •  
      CommentAuthormkj3322
    • CommentTimeJun 11th 2016
     
    Is adding an external camera to a 3d object/ ride difficult? (Those press E to enter prompts that allow you to sit down so you can view from on ride).
    •  
      CommentAuthorbestdani
    • CommentTimeJun 11th 2016 edited
     
    No, a very simple camera can be added to your SCO like this:

    //save as SimpleRideView.nlvm and use it for your SCO script
    import com.nolimitscoaster.*;

    public class SimpleRideView extends Script{

    public bool onInit(){

    //get the scene object that uses this script
    SceneObject sco = sim.getSceneObjectForEntityId(getParentEntityId());

    //create the ride view
    ExternalRideView rideView = sim.createExternalRideView();

    //the ride view will be positioned and orientated as the scene object that uses this script
    rideView.setCameraMatrix(sco.getMatrix());

    //the press E to enter ... message will be shown in a sphere of radius 5.0m around the scene object that uses this script
    rideView.setEnterWarpPoint(sco.getTranslation(), 5.0f);

    return false;
    }

    }


    Of course you might want extend it for example to switch camera positions or to update the position every frame. Have a look at the NL2 Scripting API for more infos and I recommend to study scripts that come with NL2 or some scripts of uploaded rides / objects to get more examples but this example should give you the basic idea.

    Edit: To add one to an object that moves (not tested - typos possible for example):

    //save as UpdatingRideView.nlvm and use it for your SCO script
    import com.nolimitscoaster.*;

    public class UpdatingRideView extends Script{
    SceneObject sco;
    ExternalRideView rideView;

    public bool onInit(){

    //get the scene object that uses this script
    sco = sim.getSceneObjectForEntityId(getParentEntityId());

    //create the ride view
    rideView = sim.createExternalRideView();

    return true;
    }

    //update positions every frame
    public void onNextFrame(float tick){
    //the ride view will be positioned and orientated as the scene object that uses this script
    rideView.setCameraMatrix(sco.getMatrix());

    //the press E to enter ... message will be shown in a sphere of radius 5.0m around the scene object that uses this script
    rideView.setEnterWarpPoint(sco.getTranslation(), 5.0f);
    }

    }
    •  
      CommentAuthorrcth
    • CommentTimeJun 17th 2016
     
    I'm wondering: has anyone tried creating an RCT3 kind-of Drifting Coaster (Video) in NoLimits 2 already? And if not, would such be possible? It would be quite awesome, especially if there can be locked and unlocked parts.
    •  
      CommentAuthorYedrimas
    • CommentTimeJun 17th 2016 edited
     
    Never saw in NL2 that and I've never tried. I'm probably going to try to do that in a near future, this can be fun.
    I think it's possible
    •  
      CommentAuthorrcth
    • CommentTimeJun 17th 2016
     
    That would be great. I think it's a great challenge for those who know how it works.
  2.  
    I've just got Blender. And I'm terrified xD I'm going to look up some tutorials, but does anyone have any advice for beginners?
    • CommentAuthorDelay
    • CommentTimeJun 19th 2016
     
    The Blender family is growing!
  3.  
    ^and theres me on the other end alone using sketchup
    • CommentAuthorDelay
    • CommentTimeJun 19th 2016
     
    *slowly walks away*
    •  
      CommentAuthorbestdani
    • CommentTimeJun 20th 2016 edited
     
    @NemesisRider
    Actually the wrong Ask Thread, but I recommend a short tutorial about the user interface in general and its usage first, for creating NL2 content you should look for tutorials that cover the topics: basic modelling (demonstration of the tools and ideas what can be done with them and when they can be used), UV mapping, organization (not very important for static models, but for rides: grouping, parenting, linking of object properties or meshes), animation (note that not every kind of animation can be exported to nl2 currently), later on you might also watch tutorials about baking (normal maps, ambient occlusion or even full global illumination).
    • CommentAuthorDelay
    • CommentTimeJun 20th 2016 edited
     
    Posted By: NemesisRiderI've just got Blender. And I'm terrified xD I'm going to look up some tutorials, but does anyone have any advice for beginners?

    I guess the best way to start (I assume) with Blender is to create something very simple. Or something completely insane. The first object I imported to NL2 was a fence.

    Ok, question: How do I make a custom camera? I don't know anything about scripting, yet explanations would be good. At least I want to know what's going on.
    •  
      CommentAuthorbestdani
    • CommentTimeJun 21st 2016 edited
     
    ^ look 8 posts above yours.
  4.  
    On my railway I have two trains (hopefully getting 4) I have all the dispatches synced and all the stations with the unload only disabled but the trains don't leave the station, what am I doing wrong?
    • CommentAuthorInkyz
    • CommentTimeJun 21st 2016
     
    On your railway? What?
    •  
      CommentAuthorRobotnik
    • CommentTimeJun 21st 2016 edited
     
    ^^ This is a railway:

    This is NOT a railway:

    Where are your signals? Where are your platforms? Where is the driver?

    Sorry if I'm coming off rude, but as a train nerd, this sort of thing really annoys me.
    • CommentAuthorDelay
    • CommentTimeJun 21st 2016
     
    ^ Well Britain is rather slow. We in Germany got some fast ice. Even in the summer.
  5.  
    Sorry this is in the wrong thread and also what I meant by railway is like Disneyland Paris (So a train) But its a powered coaster as trains have not yet been implemented in the game.
    •  
      CommentAuthorRobotnik
    • CommentTimeJun 21st 2016 edited
     
    ^ You're going to need to be more specific. Is your train on the correct track? Are you routing your train over a gap? Are you trying to run an electric train into an unelectrified platform?

    ^^ It's a picture of my local railway line. This class of train makes up about half of what comes down my line every day.
  6.  
    Posted By: DiamondBayonet But its a powered coaster as trains have not yet been implemented in the game.


    Its effectively a train but not a train if it makes sense
    •  
      CommentAuthorRobotnik
    • CommentTimeJun 21st 2016
     
    ^Can't help you. I thought you'd made a route in Train Simulator and wanted help creating a scenario. However, you could take a look at this park (http://nolimits-exchange.com/coaster/collegiant-efforts/9834) as that seems to operate a railway fairly well.
  7.  
    Thanks anyway, I was trying to do this https://gyazo.com/d08fc7f26d2d586e7c34f83a9ae3e544
    •  
      CommentAuthornolimiters
    • CommentTimeJun 21st 2016
     
    Please, it's a topic about scripting questions...
  8.  
    ^Sorry
    Also I want to learn how to script so transfer tracks and other manually controlled things can be scripted to work automatically
    •  
      CommentAuthorrcth
    • CommentTimeJun 24th 2016
     
    Does anyone have an example script for the Matrix4x4f? I don't really understand how it works, but it seems important if you're doing stuff with train attachments.
    •  
      CommentAuthorbestdani
    • CommentTimeJun 24th 2016 edited
     
    ^ Examples can be found in various existing scripts. Basically the workflow with the matrix is, that you use a getMatrix(...) method to get the matrix of an object (for example a coaster car), optionally do some transformations by yourself (move it a little bit, rotate it) and you set the matrix afterwards using a setMatrix(...) method to an new object (scene object for example).

    The matrix stores all information needed to place the object in the NL2 world. More detailed information how these matrices are used for computer graphics can be found for example here.

    For some cases you have to create a new matrix in the script first, the matrix is then passed to the getMatrix(...) method where the matrix is filled.

    // ...

    // new matrix
    Matrix4x4f myMatrix = new Matrix4x4f();

    // fill the matrix with the information that represents the position, (scale) and rotation of the train's car no 2 for example
    myTrain.getCarMatrix(2, myMatrix);

    // you can optionally manipulate the matrix here now, for example multiply an translation matrix to add an offset (***):
    Matrix4x4f myTranslationMatrix = new Matrix4x4f();
    myTranslationMatrix.initTrans(0, 1.0f, 0); //1m offset in y direction
    myMatrix.multLeft(myTranslationMatrix);

    // set the matrix of a sco to the same values (= same position, (scale) and rotation as the car + the optionally done transformations done before).
    mySco.setMatrix(myMatrix);

    // ...


    (***) Note that there's a difference using multLeft(...) and multRight(...), a random picture I found to get an idea in a nutshell:

    (from http://viz.aset.psu.edu).
    Right hand and left hand multiplication basically controls if the "translate, then rotate" or the "rotate, then translate" case will be done (the same holds for scaling).
    • CommentAuthorTOGO Fan
    • CommentTimeJun 24th 2016
     
    What does all this matrix stuff that is way over my head, actually do in NL2? Make scripted flat rides or custom trains act better.
    •  
      CommentAuthorbestdani
    • CommentTimeJun 24th 2016 edited
     
    They are actually used mainly inside of NL2 (like in every other real time 3D graphic application) and used to tell your graphics card on the long end where to draw triangles by filling pixels on your 2d screen surface to get a three dimensional impression of a coaster train for example

    Luckily you have access to them by using the scripting API and this cool scripting language to make flatrides or "attach" objects to a train (tell the graphics card by using NL2 that it has to draw the object in such a way that it looks like it is where the coaster car is) and other funny stuff. ;-)
    •  
      CommentAuthorrcth
    • CommentTimeJun 24th 2016
     
    Thank you Daniel :)
    • CommentAuthorTOGO Fan
    • CommentTimeJun 26th 2016
     
    I cannot get this custom train to attach to the hidden coaster train. I set the default coaster train's heartline to -0.7 and named the hidden track kiddietrack. I can manage to get only 2 cars moving at once or a car and the very front bogy. But not the whole train. I sure with there was a easier way to put custom trains on the track. Easier than the CCC creator even.

    <a href="http://imgur.com/Nz3cDYR"><img src="http://i.imgur.com/Nz3cDYR.png" title="source: imgur.com" width=1000/></a>
    •  
      CommentAuthorrcth
    • CommentTimeJun 27th 2016 edited
     
    Yup, this is gonna be interesting:







    This does work. However, if I change the 'false' in the Master script to 'true' while running the simulator, nothing does change.

    My question is: the function processAfterLaunchEmergencyBlock() is getting called every tick. However, it does not update the Master.isFailure() value if I change it in the script. Is there any way to update this?
    •  
      CommentAuthorbestdani
    • CommentTimeJun 27th 2016 edited
     
    Are you sure private VM is turned off for both scripts or the error isn't caused somewhere else? This works at least:


    import com.nolimitscoaster.*;

    public class Client extends Script{

    private void process() {
    if (Master.isFailure()){
    System.out.println("Client true");
    } else {
    System.out.println("Client false");
    }
    }

    public bool onInit() {
    return true;
    }

    public void onNextFrame(float tick) {
    process();
    }
    }



    import com.nolimitscoaster.*;

    public class Master extends Script{

    public static bool failure = false; //why public? ;-)

    public static bool isFailure() {
    return failure;
    }

    public bool onInit() {
    return true;
    }

    public void onNextFrame(float tick){
    failure = Button.isPressed(Button.ACTION);
    System.out.println("Master: " + failure);
    }
    }


    result:
    http://i.imgur.com/gi9gjrR.png

    Download
    •  
      CommentAuthorrcth
    • CommentTimeJun 28th 2016
     
    Just a quick guess with what is wrong: If I edit the failure bool directly in the script, this won't be noticed by the No Limits scripting engine. Only if No Limits changes the value, like with your button press, it works.

    Am I right on that one?
    •  
      CommentAuthorrcth
    • CommentTimeJul 3rd 2016
     
    Pastebin file

    StaticSound.loadFromFile: invalid flags parameter

    Exception: IllegalArgumentException
    at public static native com.nolimitscoaster.StaticSound com.nolimitscoaster.StaticSound.loadFromFile(nlvm.lang.String,int)
    at public bool Speaker11.onInit()
    at public final void com.nolimitscoaster.Script.run()


    What's wrong with this?
    •  
      CommentAuthorYedrimas
    • CommentTimeJul 3rd 2016 edited
     
    Line 73 :


    Replace this :
    StaticSound.loadFromFile(nameDispatchAudio, StaticSound.E_ENVMODE_LOCAL);

    with :
    StaticSound.loadFromFile(nameDispatchAudio, 1);
    •  
      CommentAuthorrcth
    • CommentTimeJul 3rd 2016
     
    Thanks, that worked. :)
    •  
      CommentAuthorbestdani
    • CommentTimeJul 3rd 2016 edited
     
    ^ and ^^ - Important note I think:
    API Reference - StaticSound.loadFromFileflags - bitwise or combination of options. Use 0 for default. Valid options are FLAG_SHARED and FLAG_MUSIC.

    therfore use:

    StaticSound.loadFromFile(nameDispatchAudio, 0);

    Since the 1 means StaticSound.FLAG_SHARED and may result in unwanted behaviour:
    API Reference - StaticSound.FLAG_SHAREDThe sound will be played synchronized among all instances. This can be used to simulate ambient sounds or sounds from multiple speakers. The doppler effect is not available in shared mode.

    As far as I understood the warning Exception: IllegalArgumentException was introduced to avoid wrong usage of flag parameters (like when StaticSound.E_ENVMODE_LOCAL is used, it's more or less just luck that the value 1 also does not cause this error. Not sticking to this could cause the same error in future updates for example I guess.
    •  
      CommentAuthorrcth
    • CommentTimeJul 4th 2016
     
    Okay, thanks for the help all! I got that part to work, now... I can't STOP a sound:
    http://pastebin.com/7ABsMgKB

    The void playTrackSound() is fired at the correct moment, trackSound.play(); works but idleSound.stop() (and stopFaded(2.0f)) both don't work. No errors and I don't see anything wrong with my script either.