Raining Snowballs

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

bumpyJake

Member
Jan 11, 2022
1
0
1
19
Category: Weather, magic

Suggested name: SnowballRain

Spigot/Skript Version: 1.18.1 / 2.6

What I want:
I want to be able to rain snowballs down around a certain radius, but in random locations each time. E.g., when the command is executed, 50 snowballs will appear within the 100 block radius, and the next time, 50 snowballs will appear in different locations within the 100 block radius.

Ideas for commands:
/sbcenter - set the center of the radius of snowballs
/sbradius - set the radius of the snowballs
/sblaunch - launch the snowballs


Ideas for permissions:
snowball.admin

When I'd like it by: Within a few days :emoji_slight_smile:
 
NOT TESTED (probs need addons idk)

also is gonna be laggy with a high radius

Code:
variables:
    sbradius = 10

command /sbcenter:
    permission: snowball.admin
    trigger:
        set {sbcenter} to player's location
        send "&aSuccesfully set the Snowball Rain center to your location!"

command /sbradius [<int>]:
    permission: snowball.admin
    trigger:
        if arg-1 is set:
            if arg-1 is higher than 0:
                set {sbradius} to arg-1
                send "&aSuccesfully set the radius to %arg-1%&a!"
            else:
                send "&cPlease provide a positive number as a radius!"
        else:
            send "&aReset the Snowball Rain radius back to the default (10)!"

command /sblaunch [<int>]:
    permission: snowball.admin
    trigger:
        if arg-1 is set:
            if arg-1 is higher than 0:
                if {sbcenter} is set:
                    send "&aSuccesfully launched %arg-1%&a snowballs in a %{sbradius}%&a radius!"
                    set {_snowballs} to 0
                    loop blocks in radius {sbradius} around {sbcenter}:
                        if loop-block is not air:
                            if block above loop-block is air:
                                add loop-block to {_blocks::*}
                    loop {_blocks::*}:
                        if {_snowballs} is less than arg-1:
                            add 1 to {_snowballs}
                            set {_loc} to random element out of {_blocks::*}
                            remove {_loc} from {_blocks::*}
                            snowballfall({_loc})
                else:
                    send "&cThe Snowball Rain center is not set!"
            else:
                send "&cPlease provide a positive number as an amount!"
        else:
            send "&cWrong usage! /sblaunch <amount of snowballs>"

function snowballfall(loc: location):
    shoot snowball from location 100 above {_loc} at speed 3 downwards