The code reloads with no errors but it doesnt work properly

  • 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 comminuty!

    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!

Poinapples

Member
Feb 4, 2024
21
0
1
13
This code is supposed to have a particle move in a circle when the boots are put on but it the particle stays in place, but if you take off the boots it moves in a circle again.
code_language.skript:
function speed(p:player):
    set {particles::rgbcircle::%{_p}%} to true if ({particles::rgbcircle::%{_p}%} ? false) is false else false
    set {_yaw} to 0
    set {_angle} to 0
    while {particles::rgbcircle::%{_p}%} is true:
        add 10 to {_angle}
        # ↓ CIRCLE + PARTICLES
            
        set {_v} to spherical vector radius 2, yaw {_yaw}, pitch 0
        draw 1 of dust using dustOption(purple, 2) at location of {_p} ~ vector(0, 0.2, 0) ~ {_v}
        set {_yaw} to 0 if {_yaw} > 360
        add 8 to {_yaw}
        wait 1 tick



every 1 tick:
    loop all players:
        if loop-player is wearing netherite boots of protection 4 and unbreaking 3 and mending and feather falling 4 named "&3&lSpeed Boots":   
            apply swiftness 3 to loop-player for 2 seconds replacing the existing effect
            apply dolphins grace 3 to loop-player for 2 seconds replacing the existing effect
            speed(loop-player)
 
You're calling the function again every tick so it's constantly setting {_yaw} and {_angle} to 0. Once you take off the boots, it stops being called, so it can finally finish the rotation. To fix this, add a delay to when the function is called, make the periodical event fire less, or use a different event and a while loop for easier and more reliable delay (and not looping players every tick). You can use on armor change to detect equipping and removing of armor.
 
You're calling the function again every tick so it's constantly setting {_yaw} and {_angle} to 0. Once you take off the boots, it stops being called, so it can finally finish the rotation. To fix this, add a delay to when the function is called, make the periodical event fire less, or use a different event and a while loop for easier and more reliable delay (and not looping players every tick). You can use on armor change to detect equipping and removing of armor.
Thank you but i tried to add 1 more dust and its giving me an indentation error. the error says it expected 2 tabs but got 8 spaces on the second dust line.
code_language.skript:
function speed(p:player):
    set {_yaw} to 0
    set {_angle} to 0
    while {speedcircle.%{_p}%} is true:

        add 10 to {_angle}

        # ↓ CIRCLE + PARTICLES
           
        set {_v} to spherical vector radius 2, yaw {_yaw}, pitch 0
        draw 1 of dust using dustOption(blue, 2) at location of {_p} ~ vector(0, 0.2, 0) ~ {_v}
        draw 1 of dust using dustOption(blue, 2) at location of {_p} ~ vector(1, 0.2, 0) ~ {_v}
        set {_yaw} to 0 if {_yaw} > 360
        add 8 to {_yaw}

        wait 1 tick

every 1 tick:
    loop all players:
        if loop-player is wearing netherite boots of protection 4 and unbreaking 3 and mending and feather falling 4 named "&3&lSpeed Boots":  
            apply swiftness 3 to loop-player for 2 seconds replacing the existing effect
            apply dolphins grace 3 to loop-player for 2 seconds replacing the existing effect
            speed(loop-player)
            loop 1 time:
                set {speedcircle.%loop-player's uuid%} to true