• 0

    posted a message on How To Make Blocks Falling From Sky?

    Let's go into a bit more detail shall we?
    You could make a datapack with a few simple functions. all of the commands (except for the function ones) will still work without a datapack, but I'd recommend one since you want the anvils to drop every few seconds or so.

    One function that starts the game:

    #repeat the following command depending on how many anvils you want per player per drop.
    execute as @a at @s run summon armor_stand ~ ~ ~ {Invisible:1b,NoGravity:1b,CustomName:'{"text":"Anvil"}'}
    #then run the function that'll drop the anvils
    function anvil:drop

    The function "anvil:drop" should look like this:

    #we spread the armorstands around the players
    execute as @a at @s run spreadplayers ~ ~ <spreadDistance> <maxRange> false @e[type=armor_stand,name=Anvil,limit=<count you spawn per player>,sort=nearest]
    #we teleport the armorstands up 50 blocks (you can change the height if you want) so their hitboxes don't interfere with the players.
    execute as @e[type=armor_stand,name=Anvil] at @s run tp @s ~ ~50 ~
    #we place anvils at the location of all the armorstands we spawned.
    execute as @e[type=armor_stand,name=Anvil] at @s run setblock ~ ~ ~ anvil
    #and we repeat the function in 10 seconds (again, you can change the amount if you like.) IF the armorstands we spawned still exist (so you can actually stop the loop by removing all the armorstands.)
    execute if entity @e[type=armor_stand,name=Anvil] run schedule function anvil:drop 10s

    To end the game, you can simply run the command (or make another function for it):

    kill @e[type=armor_stand,name=Anvil]

    Have fun playing!

    Posted in: Mapping and Modding Tutorials
  • To post a comment, please or register a new account.