3

This is just a follow-up question from my previous one, Specific lightning arrow task, after the arrow strikes, and only using a specific bow. So in that one, I asked how would one summon lightning an x amount of times, at an arrow, after it hits the ground. Thanks to mindoverflow, I now know how to do it.
I'm going to write all the code here, because we will need this in a moment.
Stating all the variables needed:

/scoreboard objectives add UseBow minecraft.used:bow
/scoreboard objectives add Strike dummy
/scoreboard objectives add Timer dummy

Command block that gives the special bow:

give @p bow{CustomModelData:103,display:{Name:"[{\"text\":\"Asraelax’s\",\"color\":\"yellow\"},{\"text\":\" Chaos\",\"color\":\"yellow\"}]",Lore:["{\"text\":\"Curse of Zeus\",\"color\":\"gray\",\"italic\":false}"]},Unbreakable:1,HideFlags:7}

First separate chain:

[Repeat] execute at @a[scores={UseBow=1..},nbt={SelectedItem:{id:"minecraft:bow",Count:1b,tag:{CustomModelData:103,display:{Name:"[{\"text\":\"Asraelax’s\",\"color\":\"yellow\"},{\"text\":\" Chaos\",\"color\":\"yellow\"}]"}}}}] run data merge entity @e[type=arrow,limit=1,sort=nearest,distance=..2] {Tags:["lightningarrow"]}
[Chain] execute as @a[scores={UseBow=1..}] at @e[type=arrow,tag=lightningarrow,nbt={inGround:1b},limit=1] run summon minecraft:armor_stand ~ ~ ~ {Tags:["lightning"],Invulnerable:1b,Invisible:1b}
[Chain] execute at @e[tag=lightningarrow,nbt={inGround:1b}] run scoreboard players remove @a UseBow 1
[Chain] kill @e[tag=lightningarrow,nbt={inGround:1b}]

Second separate chain:

[Repeat] scoreboard players add @e[tag=lightning] Timer 1
[Chain] execute as @e[tag=lightning,scores={Timer=1}] at @s run summon minecraft:lightning_bolt
[Chain] execute as @e[tag=lightning,scores={Timer=1}] at @s run scoreboard players add @s Strike 1
[Chain] execute as @e[tag=lightning,scores={Timer=5}] at @s run scoreboard players set @s Timer 0
[Chain] kill @e[tag=lightning,scores={Strike=5}]

So this works perfectly, to change the number of lightning strikes, we only have to change the number in

kill @e[tag=lightning,scores={Strike=5}]

However, after being Zeus for an hour, I became pretty bored, and I thought, what else can I summon? A falling block of course. Now, to become Gaia, I can just change what to summon and state where to summon it (~ ~10 ~) right? Well, technically, that's correct, but it will only summon a column of sand, not really spread out.

So here's my problem, I want to summon a bunch of falling blocks, that is a 3 x 4 x 4. (Basically, a rectangular prism, height 3, width & length 4, that is all sand), 10 blocks on top of an arrow shot from a specific bow.

You can just say, well, make 12 of the second separate chains, and you'll be done, right?
Yep, that's true, but for that you need 24 variables, which is pretty boring and no one wants to write that much code. Two requirements, 1, in must have a less amount of chains and variables. 2. It must be flexible, say, I want to increase the x by 10 and y by -5, I can just change 2 variables, and done, not like destroying command blocks and having to paste them in again.

This is very much appreciated if you solve this problem, I might put a bounty on this later if this doesn't get answers.

P.S. I'm not using /setblock or /fill because I might want to replace the falling block with another block.

6
  • 1
    Credit goes to @circusbaby23 for the first command chain, I only expanded on it. Commented Nov 2, 2021 at 16:05
  • Simply summon a falling block entity. Once the arrow strikes, you can use something like: /summon ~ ~ ~ falling_block (My command syntax is rusty.)
    – WG481
    Commented Nov 2, 2021 at 16:36
  • @WG481 ? That summons one.
    – AlexJaynMF
    Commented Nov 3, 2021 at 4:17
  • Use multiple of them? Seriously.
    – WG481
    Commented Nov 4, 2021 at 18:07
  • 1
    Would using functions be acceptable? It should be easier to use for something that is surprisingly complex like this. Also, how do you want that 4x4 to center? is the arrow in one of the corners? One of the center blocks? (the corner would be easier)
    – Plagiatus
    Commented May 2, 2023 at 5:22

1 Answer 1

-1

Haven't tested it yet, but nothing should prevent you from duplicating the command block that summoned the lightning, change it to a summon falling sand entity and giving each copy different coordinates. You'd also have to place the copies in series, resulting in something like this:

[Repeat] scoreboard players add @e[tag=earth] TimerE 1
[Chain] execute as @e[tag=earth,scores={TimerE=1}] at @s run summon minecraft:falling_block ~ ~ ~
[Chain] execute as @e[tag=earth,scores={TimerE=1}] at @s run summon minecraft:falling_block ~ ~ ~1
[Chain] execute as @e[tag=earth,scores={TimerE=1}] at @s run summon minecraft:falling_block ~1 ~ ~
...
...
[Chain] execute as @e[tag=earth,scores={TimerE=1}] at @s run scoreboard players add @s StrikeE 1
[Chain] execute as @e[tag=earth,scores={TimerE=5}] at @s run scoreboard players set @s TimerE 0
[Chain] kill @e[tag=earth,scores={StrikeE=5}]

I've also changed the tag and scores to avoid conflicts.

That gives me an idea... you could also test not only for a TimerE=1 but also for a certain StrikeE. If this works you could summon different patterns on each strike, making for a possibly cool looking animationof sorts.

This solution, if it works, should only be used for map mechanics. To build landscapes in a way that actually equals Gaia, use WorldEdit instead.

1
  • Yea, I pondered on that, but my purpose for summon falling sand is to suffocate enemies, so world edit has no business here. Your answer, is good, it meets the 1 of the criteria: It has only 2 variables, very noice. But what if I want to change it so that it summons an x + 1 by y + 5 by z + 2 cuboid? I would have to add more to it, which is a bit of a pain. So basically, I want one of two answers, that you can make a chain, and if you want to change the dimensions of the cuboid, you only have to change 3 numbers, not add more blocks. Or if it's impossible entirely.
    – AlexJaynMF
    Commented Nov 4, 2021 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.