How to add spread between arrows?

Started by Sweattypalms on

Topic category: Help with modding (Java Edition)

Last seen on 05:41, 23. Apr 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to add spread between arrows?

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?

Last seen on 12:48, 17. May 2024
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi. I also had a hard time…
Wed, 08/10/2022 - 18:34

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.
 

Last seen on 23:20, 6. Apr 2024
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm aware this topic is a…
Tue, 10/10/2023 - 20:09

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!