5
Command-Based Artillery
Whelp, here goes, my first forum thread. *deep breath*
Okay, so... I need help with some command block stuff. Fireball- and Wither-Skull based would work, but any other ideas are fine. I just need something that fits these three criteria:
Is disguiseable: Is small and versatile enough to be hidden inside of a build disguised as a cannon or something.
Is scaleable: The explosive power needs to be able to be adjusted in some way.
Is toggleable or fires single shots: It needs to be able to be able to be either easily turned on and off, or have some sort of mechanism to fire it.
If the system is aimable, that would be a big plus.
Thanks to anyone that can assist. If this post is in the wrong section, please, let me know so I can move and/or delete it.
Okay, so... I need help with some command block stuff. Fireball- and Wither-Skull based would work, but any other ideas are fine. I just need something that fits these three criteria:
Is disguiseable: Is small and versatile enough to be hidden inside of a build disguised as a cannon or something.
Is scaleable: The explosive power needs to be able to be adjusted in some way.
Is toggleable or fires single shots: It needs to be able to be able to be either easily turned on and off, or have some sort of mechanism to fire it.
If the system is aimable, that would be a big plus.
Thanks to anyone that can assist. If this post is in the wrong section, please, let me know so I can move and/or delete it.
8
You can easily launch about any entity in the direction a mob is looking with the with the Motion datatag. Summon arrows with a /tag and custom (impossible) potion effects. When an arrow with the tag is inGround (use NBT to detect block hits) or a mob has the potion effects, you can summon an exploding creeper or whatever else at that location. This lets you shoot projectiles long distances with a high level of control. You will need a dozen or so commands to do the aiming, but once that is set up you can just rotate a mob or look in a direction to aim.
The shooting process works like this: You have one mob at the turret point. This is where the projectile will be shot from. You store it's position NBT (x, y and z) into 3 scoreboard values Use a scale factor of 10000 or so to have a precise value.. Then, you use raycasting to spawn an invisible Area Effect Cloud (AEC) in the direction it is looking using ^ ^ ^d where d corresponds to the speed you want the projectile to shoot at. Save the position of that AEC into a scoreboard with the same scale factor. Subtract the turret position from it, and then use /execute store again to copy these values into the Motion value of the projectile with a scale factor of 0.0001.
Whatever value you set d to, the projectile will start moving that fast per tick or 20d/sec. It will quickly slow down due to gravity. I recommend staring with values around 1 and adjusting it to whatever feels best.
The shooting process works like this: You have one mob at the turret point. This is where the projectile will be shot from. You store it's position NBT (x, y and z) into 3 scoreboard values Use a scale factor of 10000 or so to have a precise value.. Then, you use raycasting to spawn an invisible Area Effect Cloud (AEC) in the direction it is looking using ^ ^ ^d where d corresponds to the speed you want the projectile to shoot at. Save the position of that AEC into a scoreboard with the same scale factor. Subtract the turret position from it, and then use /execute store again to copy these values into the Motion value of the projectile with a scale factor of 0.0001.
Whatever value you set d to, the projectile will start moving that fast per tick or 20d/sec. It will quickly slow down due to gravity. I recommend staring with values around 1 and adjusting it to whatever feels best.
Ehhmmm, maybe try Invisible (charged?) creepers? You can set the motion on them using NBT tags. They aren't really different from Fireballs or Wither Skulls (besides being taller and needing more space to move), so I don't really know what you're looking for.
EDIT: If you want a straight path, use a constantly repeating command that TPs the entity in it's current direction.
You probably know that ~# ~# ~# offsets the location along the axis from the current position. Now ^# ^# ^# offsets using the current rotation. If you apply it to the player, the first number is panning the camera left/right, the second number is panning the camera up/down and the third number is panning the camera forwards/backwards.
EDIT: If you want a straight path, use a constantly repeating command that TPs the entity in it's current direction.
#Set Direction
execute as @e[tag=my_ammo] at @s run tp @s ~ ~ ~ <rx> <ry>
#Tp in direction
execute as @e[tag=my_ammo] at @s run tp @s ^ ^ ^0.05 You probably know that ~# ~# ~# offsets the location along the axis from the current position. Now ^# ^# ^# offsets using the current rotation. If you apply it to the player, the first number is panning the camera left/right, the second number is panning the camera up/down and the third number is panning the camera forwards/backwards.
Essentially, I’m looking for some sort of projectile launcher that causes a large explosion on impact.
Snowballs that can be rendered as another item fits your 1st criteria. e.g.
For the aiming and the parabolic trajectory of the snowball, you can use relative motion to do that
How its all implemented is up to you and should be simple enough with passengers (for detecting the snowball hitting the ground), tags and scoreboards. The toggleability is also dependent on your choices of implemntation
/summon snowball ~ ~ ~ {Item:{id:"minecraft:oak_boat",Count:1b}}
When the snowball reaches the ground, you can summon a fireball that'll have scalable explosive powerFor the aiming and the parabolic trajectory of the snowball, you can use relative motion to do that
How its all implemented is up to you and should be simple enough with passengers (for detecting the snowball hitting the ground), tags and scoreboards. The toggleability is also dependent on your choices of implemntation
Would it be possible to somehow change a snowball mid-flight? I saw a weapon once that did that, turning a snowball into a fireball with the same trajectory. Simply put, while parabolic arcs are fun, for the distance I want the projectiles to go, it’d be easier to simply use something with a straighter path.
You can throw a snowball, summon a fireball at the snowball, copy the snowball's Motion into the fireball's direction, and then kill the fireball. Alternatively, you can give superfast custom motion to a projectile to make it shoot relatively straight. Having projectiles that move in a straight line and don't time out can cause problems...
I think giving the snowball big x/z motion values could theoretically work as well
Artillery! Aww man! So we back in the Maus...
