Started by
Sweattypalms
on
Topic category: Help with Minecraft modding (Java Edition)
I would like to add spread between 3 arrows which are summoned when i right click with my item: "Terminator", I summon the 3 arrows but I can't figure out how to add spread between the 3 arrows. Like in the previous versions e.g. 2021.1 you were able to edit the velocity in the code since it doesn't exist now ( or so I think ), How can I add spread between the arrows?
Hi. I also had a hard time finding somthing that works on the current version.
I went with this solution:
In the "RangeItemUsed"-Procedure, set a "Repeat X times"-block(set it to "2" if you want 3 arrows in total, with the one summoned by the ranged item itself) and inside add a "shoot ranged item..."-block.
For these 2 summoned projectiles you can now manipulate their spread.
I chose random spread like with a shotgun-type weapon.
To do this simpy add "Set rotation of ..."-block inside the "repeat"-block, above the "shoot ranged item..."-block.
Whithin there, you can now change the inputs for "yaw" and "pitch" to include a random number. For example, for the yaw input set: [[Direction (yaw) of event/target entity] + [random number between min.[-5] and [5] ]].
This works nicely for a single-shot item, but unfortunately if you choose to modify it for use in "full auto" ranged item, it will cause the player head movement to spasm according to the randomized pitch and yaw-inputs.
I hope this still helps you in some way.
Here is a screenshot of the procedure I used:
https://imgur.com/a/GMO7nPA
I'm aware this topic is a year old today, but oh my god. Such a simple way to achieve a shotgun, and yet it works perfectly for a simple shotgun. Finally something that doesn't involve changing the code or some obtuse command shenanigans. It doesn't even effect the camera despite what the procedure would make you think!