Teleporting block displays around boat

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

firephrog

New Member
Apr 1, 2024
5
0
1
So im trying to make a script that teleports block displays around a boat so that they move with and rotate around the boat.

Here is my code:
Code:
command /boattest:
    trigger:
        spawn oak boat at player:
            set {_boat} to event-boat
           
        set {_displaylocs::*} to vector(1, 0, 0), vector(1, 0, 1), vector(-1, 0, 0), vector(-1, 0, -1)
        set {_blocks::*} to "blue wool", "blue wool", "blue wool", "blue wool"
           
        #summon block displays
        loop {_blocks::*}:
            set {_i} to loop-index
            set {_v} to {_displaylocs::%{_i}%}
            set {_loc} to location of {_boat}
            add {_v} to {_loc}
            spawn block display of white wool at {_loc}:
                set display block data of event-display to {_blocks::%{_i}%}
                add event-display to {_blockdisplay::*}
           
        set {boatdata::%uuid of player%::boat} to {_boat}
        set {boatdata::%uuid of player%::displays::*} to {_blockdisplay::*}
       
every tick:
    loop all players:
        if {boatdata::%uuid of loop-player%::boat} is set:
            set {_boat} to {boatdata::%uuid of loop-player%::boat}
            set {_blockdisplay::*} to {boatdata::%uuid of loop-player%::displays::*}
            set {_angle} to yaw of {_boat}
           
            set {_vector::1} to vector(1, 0, 0)
            set {_vector::2} to vector(1, 0, 1)
            set {_vector::3} to vector(1, 0, 0)
            set {_vector::4} to vector(-1, 0, -1)
           
            loop 4 times:
                rotate {_vector::%loop-number%} around x-axis by {_angle}
           
            loop 4 times:
                set {_loc} to location of {_boat}
                add {_vector::%loop-number%} to {_loc}
                teleport {_blockdisplay::%loop-number%} to {_loc}
               
command /removeboats:
    trigger:
        kill {boatdata::%uuid of player%::displays::*}
        kill {boatdata::%uuid of player%::boat}
        clear {boatdata::%uuid of player%::boat}
        clear {boatdata::%uuid of player%::displays::*}

The block displays do not change block types and the displays are all ontop of eachother instead of spawning in their own spots.
I am using Skript 2.12, skRayFall v1.9.28, and SkBee 3.11.3