Board index Roller Coaster Games NoLimits Coaster 2 NoLimits Coaster 2 Scripting Herman's scripted stuff

Herman's scripted stuff

Post your Nolimits 2 scripts here! Also any discussion regarding scription for NoLimits Coaster 2 should be placed in this forum

Post December 23rd, 2015, 11:05 am

Posts: 2092
Points on hand: 0.00 Points
Bank: 17,248.00 Points
Location: sheffield, UK

Post December 23rd, 2015, 11:07 am
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
^^ The wheel probably won't be complete by Christmas. The modelling of the boarding platform will probably take some time.

I'm also working a bit on a project for the roundup 100 contest. This project was already almost done a few weeks ago but now I really have to make the last changes on this project and make the video.

Post December 25th, 2015, 9:33 pm

Posts: 8144
Points on hand: 13,491.00 Points
^ That's sweet! BTW I gave you 100 points because you're trying to keep the Track Exchange alive! :D
-- I was happy to be with NL1 - [:')] --

Post December 26th, 2015, 1:31 am
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands

Post December 27th, 2015, 9:06 am

Posts: 8144
Points on hand: 13,491.00 Points
^ You're welcome! :D
-- I was happy to be with NL1 - [:')] --

Post January 3rd, 2016, 4:06 am
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
Yesterday I had some time again for working on the Ferris wheel.

Image
Here's the loading platform. It's currently possible to just walk in to a cabin.

Image
The entrance and exit stairs. I'm still not completely happy with them so maybe they will change.

Post January 3rd, 2016, 5:54 am

Posts: 2092
Points on hand: 0.00 Points
Bank: 17,248.00 Points
Location: sheffield, UK
^you might want to do that exit as a ramp, so that people in wheelchairs can get to and from the loading platform

Post January 3rd, 2016, 10:44 am

Posts: 8144
Points on hand: 13,491.00 Points
^ Excellent point. That is well... an essential idea. :)
-- I was happy to be with NL1 - [:')] --

Post January 3rd, 2016, 1:07 pm
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
I've searched for how the let people in wheelchairs ride the real Daikanransha and apparently they have an elevator. I think I'm going to remove the existing stairs and make a small building with an elevator and stairs in them so that it's also wheelchair accessible.

Post January 5th, 2016, 3:33 am

Posts: 8144
Points on hand: 13,491.00 Points
Fingers crossed so you can remodel the platform. :)
-- I was happy to be with NL1 - [:')] --

Post January 5th, 2016, 5:14 pm

Posts: 6183
Points on hand: 483.00 Points
Bank: 19,590.00 Points
Can you add textures to this wheel? Like make it have a very rusty texture theme or a shiny new theme?

Post January 6th, 2016, 11:49 am
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
I haven't got any experience with creating textures... so I will look into it and if it's easy enough for me, I will add the textures.

Post January 6th, 2016, 9:00 pm

Posts: 8144
Points on hand: 13,491.00 Points
^ I believe you can, judging from what you've done for us so far! :)
-- I was happy to be with NL1 - [:')] --

Post January 9th, 2016, 4:37 pm

Posts: 6183
Points on hand: 483.00 Points
Bank: 19,590.00 Points
You will update the uploaded wheel beta in the scrapyard?

Post January 9th, 2016, 5:09 pm
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
It's not possible to update a track in the scrapyard. However, I can give you the updated code with the working doors. Just replace everything in the file FerrisWheelScript.nlvm with the code below. Then the code should be updated.

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

public class FerrisWheelScript extends Script
{
   private static final byte OPEN = 0;
   private static final byte CLOSE = 1;
   private static final float[] ANGLE = {-1.5707963267948966192313216916398f, 0.0f};
   private static final byte CABINS = 64;
   private static final byte NO_DOOR = CABINS;
   private static final float MAX_ACCELERATION = 1.5f;
   private static final float MAX_VELOCITY = 2;
   private static final float DOOR_COMPARE = 0.001f;

   private SceneObject m_sco;
   private SceneObjectElement m_mainwheel;
   private SceneObjectElement[] m_cabin = new SceneObjectElement[CABINS];
   private SceneObjectElement[] m_door = new SceneObjectElement[CABINS];
   private bool[] doorPrevOpen = new bool[CABINS];
   private float[] cabinAngle = new float[CABINS];
   private float m_angle;
   private float[] doorAngle = new float[2];
   private float[] doorRandomOffset = new float[2];
   private byte[] doorMoving = new byte[2];
   private byte[] lastDoorMoving = {NO_DOOR, NO_DOOR};
   private float[] velocityDoor = new float[2];

   public bool onInit()
   {
      m_sco = sim.getSceneObjectForEntityId(getParentEntityId());
      m_mainwheel = m_sco.getElementForName("Wheel");
      Vector3f cabinTrans;
      
      for (byte i=CABINS-1; i>=0; --i)
      {
         m_cabin[i] = m_sco.getElementForName("Cabin" + i);
         m_door[i] = m_sco.getElementForName("Door" + i);
         m_sco.getElementForName("Windows" + i).setEntityColor(new Vector4f(10.0f, 10.0f, 10.0f, 0.2f));
         m_sco.getElementForName("WindowDoor" + i).setEntityColor(new Vector4f(10.0f, 10.0f, 10.0f, 0.2f));
         doorPrevOpen[i] = false;
         cabinTrans = m_cabin[i].getMatrix().getTrans();
         cabinAngle[i] = (float)Math.atan2(-cabinTrans.x, -cabinTrans.z);
      }
      return true;
   }

   public void onNextFrame(float tick)
   {
      m_angle += tick * 0.00654498469497873591346384038183f;
      turnWheel();
      
      for (byte i=1; i>=0; --i)
      {
         animateDoor(i, tick);
      }
      
      for (byte i=CABINS-1; i>=0; --i)
      {
         handleCabin(i);
      }
   }
   
   private void turnWheel()
   {
      if(m_angle > Math.PI)
      {
         m_angle -= (float)Math.PI * 2;
      }
      else if(m_angle < -Math.PI)
      {
         m_angle += (float)Math.PI * 2;
      }
      m_mainwheel.setRotation(0, 0, m_angle);
   }
   
   private void animateDoor(byte state, float tick)
   {
      if(doorMoving[state] != NO_DOOR)
      {
         if (velocityDoor[state] * velocityDoor[state] / MAX_ACCELERATION / 2 >= Math.abs(ANGLE[state] - doorAngle[state]))
         {
            velocityDoor[state] = (velocityDoor[state] + MAX_ACCELERATION * tick * ((velocityDoor[state] < 0) ? 1 : -1));
         }
         else
         {
            float pos = (ANGLE[state] > doorAngle[state]) ? 1 : -1;
            if (Math.abs(velocityDoor[state]) < MAX_VELOCITY)
            {
               velocityDoor[state] = velocityDoor[state] + MAX_ACCELERATION * tick * pos;
            }
            if (Math.abs(velocityDoor[state]) >= MAX_VELOCITY)
            {
               velocityDoor[state] = MAX_VELOCITY * pos;
            }
         }
         doorAngle[state] += velocityDoor[state] * tick;
         
         if(doorAngle[state] <= ANGLE[state] + DOOR_COMPARE && doorAngle[state] >= ANGLE[state] - DOOR_COMPARE)
         {
            doorAngle[state] = ANGLE[((state + 1) % 2)];
            m_door[doorMoving[state]].setRotation(0, ANGLE[state], 0);
            doorMoving[state] = NO_DOOR;
         }
         else
         {
            m_door[doorMoving[state]].setRotation(0, doorAngle[state], 0);
         }
      }
   }

   private void handleCabin(byte cabin)
   {
      m_cabin[cabin].setRotation(0, 0, -m_angle);
      float realAngle = cabinAngle[cabin] - m_angle;
      if(realAngle < 0.1f && realAngle > -0.1f)
      {
         checkDoor(OPEN, cabin, true);
      }
      else
      {
         checkDoor(CLOSE, cabin, false);
      }
   }

   private void checkDoor(byte state, byte i, bool open)
   {
      if(doorMoving[state] == NO_DOOR && lastDoorMoving[state] != i)
      {
         if(doorPrevOpen[i] == !open)
         {
            doorRandomOffset[state] = (float)((Math.random() - 0.5f) / 10);
            doorMoving[state] = i;
            lastDoorMoving[state] = i;
            doorPrevOpen[i] = open;
            velocityDoor[state] = 0;
         }
      }
   }
}

Post January 10th, 2016, 8:22 am

Posts: 8144
Points on hand: 13,491.00 Points
^ Applause! :)
-- I was happy to be with NL1 - [:')] --

Post January 11th, 2016, 3:01 am
mkingy User avatar
Moderator
Moderator

Posts: 5462
Points on hand: 28,111.00 Points
Bank: 0.00 Points
Location: United Kingdom
FYI Herman I honestly don't think any of us mods/admins will mind if you just upload a new ferris wheel to the scrapyard named v2 :)

Hows the texturing going?
Coaster Count - 198
France 2019 Mini Trip Report

Post January 11th, 2016, 12:46 pm
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
I still didn't start the texturing. I wasn't happy with the railing of the boarding platform so I edited it a bit:

Image

And I started working on the elevator:

Image

I think I want to finish the model before checking out the texturing stuff.

Post January 12th, 2016, 6:42 pm

Posts: 8144
Points on hand: 13,491.00 Points
^ Oh sweet! :D
-- I was happy to be with NL1 - [:')] --

Post January 14th, 2016, 12:19 pm
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
The Big Race

For the NoLimits Roundup contest I also made a coaster. I didn't won but to be honest, it's not a good coaster. However, it does have a pretty interesting script which is why I post this here in this topic.

Image

More than a year ago I got an idea for creating a dueling coaster with 8 tracks. This way you would get a huge coaster race and what type of trains should be used for racing? Motorcycles of course! :mrgreen: It took me a while to get the script right and it took me a really long while to get the layout pretty decent. Even now I'm not happy about some of the tracks but I'm to lazy to remove some tracks and replace it with something which will fit in all of the tracks and will have the same ride time.

I have just uploaded it to the exchange!

Link to the Exchange

Post January 14th, 2016, 4:27 pm
mkingy User avatar
Moderator
Moderator

Posts: 5462
Points on hand: 28,111.00 Points
Bank: 0.00 Points
Location: United Kingdom
I'll be sure to take a look later in the week - looks really interesting!
Coaster Count - 198
France 2019 Mini Trip Report

Post January 15th, 2016, 12:17 pm

Posts: 8144
Points on hand: 13,491.00 Points
^^ Great addition to our community! You're always full of curiosity! The Big Race sounds like speeders! I kinda feel Star Wars from those flying bikes! I knew your awesomeness after checking out your video!

:)
-- I was happy to be with NL1 - [:')] --

Post January 24th, 2016, 10:21 pm

Posts: 6183
Points on hand: 483.00 Points
Bank: 19,590.00 Points
How is the big Japanese wheel coming along?

I hope well.

Post January 25th, 2016, 3:43 am

Posts: 8144
Points on hand: 13,491.00 Points
^ That's exactly what I was gonna ask! :D
-- I was happy to be with NL1 - [:')] --

Post January 25th, 2016, 6:14 pm
herman116 User avatar
Premium Member
Premium Member

Posts: 636
Points on hand: 7,471.00 Points
Location: The Netherlands
I wasn't happy anymore with the lift I've created so I deleted that again. The stairs are almost done. I will post some pictures on Wednesday evening (I don't have the model file with me right now).

PreviousNext

Return to NoLimits Coaster 2 Scripting

 


  • Related topics
    Replies
    Views
    Last post
cron