Started by
TheGremm
on
Topic category: Help with Minecraft modding (Java Edition)
So essentially, i want to make a revolver type item that fires different projectile based on what is loaded in the slots. Any ideas on how i could make it??? Any Help is greatly appreciated!
Maybe you could use a bunch of if statements that check for a certain type of bullet in a certain slot before firing the gun and then fire the correct type of bullet.
You could use if like Beanerinsm said and use a variable to select exactly what type of bullet is going to be shot. I don’t know if you want it to be randomized, but you can use a number variable and do something like this:
RANDOMIZED:
If item in hand = revolver
if get number variable = 1shoot (name of projectile 1) from x y z with direction dx dy dz speed 1 inaccuracy 0if get number variable = 2shoot (name of projectile 2) from x y z with direction dx dy dz speed 1 inaccuracy 0Then you can either set a random number variable to select the bullet in a randomized way, or make a procedure that adds +1 to the variable every time it is called until it resets to 1 again, like:
set number variable to get random number between min 1 and max 10(you can put it on a different procedure and call it everytime the the gun shot using "call procedure 'randomizer'" for example)
OR
ORGANIZED AND FIXED WAY:
Set the default value of the variable to 1 and make a procedure like this:
if get number variable < 10set number variable to get number variable + 1if get number variable >= 10(10 is the max amount of bullets you want, change it to whatever number you want)set number variable to 1(Name the procedure something simple like
variable_loop.)Then make the gun procedure call it every time it shoots something to change the bullet, like:
if get number variable = 1shoot (name of projectile 1) from x y z with direction dx dy dz speed 1 inaccuracy 0call procedure variable_loopif get number variable = 2shoot (name of projectile 2) from x y z with direction dx dy dz speed 1 inaccuracy 0call procedure variable_loopAnd keep doing this until you reach the number of bullets you want to put in the gun.