Creating a Rollercoaster system with armorstands?

Discussion in 'Plugin Development' started by 360_, May 6, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    360_

    I've been attempting to create a Rollercoaster system using armor stand.
    Bacily I'm trying to make an armor stand follow a path but I can't manage to make this work.
    Example: For example, getting the armor stand to move from Point 1 (the green wool) to Point 2 (Red wool) by staying on the Brown Hardened Clay (aka the path)
    Example Image (open)
    [​IMG]


    I know that there are servers that have managed to create something like this by using one of the methods listed under or some other method.
    - Vectors (I've tried it but don't it doesn't work the way i would like it to work).
    - Pathfinders (No idea on how to use this).
    - Using a program called Blender to generate a vector path (No idea on how to use this).
    I'm really clueless about trying to make this work, and I'm willing to learn new things to get this working if it's needed.
    Ps: if you do try and help me with this please try not to spoonfeed me the code as i really want to learn how to do this
     
  2. Offline

    MightyOne

    I'm not sure what you actually want to achieve. imagining that you want to teleport an armor stand along a path you can just manually check blocks around the armorstand's location and look if there is brown clay and tp it to there. I dont even know of armor stands can move with a velocity.
    Anyway, if you posted your code people could probably help you better at every single step.
     
  3. Offline

    360_

    @MightyOne What I'm attempting to achieve is something like this . And the code I have for this System so far is just summing the armorstand with a block on its head
     
  4. Offline

    MightyOne

    Well that looks like some sick caclulations xD I mean the train is even tilting in the curves! But yeah, you can start with little things like followingan amorstand a line of blocks.

    (Start a BukkitRunnable where the detecting shall happen.)
    Get the Location under the armorstand with:
    Code:
    Location loc = armorstand.getLocation().add(0, -1, 0);
    Get all neighbor blocks of there e.g:
    Code:
     Location loc2 = loc.clone().add(1, 0, 1);
    
    Test if the block at that location is brown clay and if so then tp the armostand to there:
    Code:
    Block b = loc2.getBlock ()
    if(b.getType() == Material.IdontKnow && b.getData () == 5orSo)
        armorstand.teleport(loc2.add(0, 1, 0);

    not as beatiful as a roller coaster but the beginning if something?
     
    Last edited: May 7, 2018
  5. Offline

    360_

    @MightyOne are you sure "Block b = loc2.getLocation();" will work after doing "loc.clone().add(1, 0, 1);"?

    Edit: Ok I have the Locations ready and the Runnable ready but "Block b = loc2.getLocation();" isn't working (Cannot resolve method getLocation())
     
  6. Offline

    timtower Administrator Administrator Moderator

    @360_ Use loc2.getBlock()
     
  7. Offline

    MightyOne

    My bad it was 3 o clock in the morning

    I just wanted to point out that these mcAmusement guys surely didn't make a plugin that finds a track for a train. The roller coaster they use is static and they somehow generated a very smooth graph the train will just always follow.

    But of course your idea isn't that bad as well and if you modify the (spoonfed) code a bit you can also get a very nice roller coaster as well.
    But if you are at this point I would suggest you to try out what you can do yourself.
     
    Last edited: May 7, 2018
Thread Status:
Not open for further replies.

Share This Page