Hello, I'm working on a map in minecraft that requires a shooting mechanic.
I'm looking for something like this: Detecting where a player is aiming, if the player is firing the gun, and spawning an arrow to face the direction the player is aiming at.
I also want something like a shotgun that fires multiple arrows in multiple directions.
1 : summon an entity in front of the player ~4 blocks away with ^ ^ ^ relative position
2 : Store both the player XYZ coords and the ones of the entity in scores (playerX,playerY,playerZ,entityX,entityY,entityZ)
3 : Substract the coords of player and entity. This will give you proportionnal vector to give X,Y and Z motion to the arrow (playerX-entityX, playerY-entityY,playerZ-entityZ)
4 : summon an arrow at the player
5 : apply the resulting XYZ scores into the arrow's motion using /execute store result entity. You can set a multiplier to make the arrow not go too fast (or negative multiplier if goes backwards). (resultX to Motion[0], resultY to Motion[1], resultZ to Motion[2])
And now, the arrow goes in the player direction.
Example :
1. Player is at X=24,Y=11,Z=-30. The entity is summoned in front of him, at X=26,Y=12,Z=-31
2. Storing Both XYZ
3. Substracting it :
-ResultX = 24-26 = -2
-ResultY = 11 - 12 = -1
-ResultZ = -30 - -31 =1
4. Summoning the arrow
5. Applying the results to arrow. In that case, it will have a X speed of -2, Y speed of -1 and Z speed of 1. Of course the "/execute store result entity" features a multiplier. you could so multiply the numbers obtained to get a higher or lower speed.
This is a somewhat advanced command system, there must be a minimum knowledge about commands and maths to do that properly.
And by the way, an "arrow shotgun" could only deal 1 arrow damage. If you already tested an 1-tick dispenser-arrow gatling on yourself in survival, you would have noticed that some arrows are deflected without dealing damage. This would be the case with shotgun, although we can still simulate a dispersion effect.
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Yes, all the problem is about the arrow's Motion...
Arrow movement is only determined by the XYZ Motion tags, and there is unfortunately no command like "/set Motion as @p".
I can definitely tell you that the only way currently is to have some trick convert the player's looking direction into XYZ movement vectors, and the "summon-an-entity-and-compare-coords" technique is probably the best in that case.
However, making a shotgun from that would be quite simple : just summon 4-5 arrows and modify a bit their motion value using scoreboard operation to make them spread in a half-random pattern.
Another thing, a bit simpler but still needing some knowledge, is raycasting guns : It is possible to make a ray of particles at the direction the player is facing, and apply a damage effect if an entity gets onto its path. This is only possible through datapacks only (or command blocks, but will be slow), though.
I would say overall, making a gun system definitely takes some command knowledge and logic understanding. The two ways I just told you are the most popular ways for gun systems (well there is not really any other way as good as that, as far as I know - and I know far -)
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Well I could do some working gun, but I use area_effect_clouds instead of armor stands, because quite smoother for the game.
However, it may take something like 1 day, as I am into exams right now.
Would you prefer a command block system or a datapack?
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
It doesn't matter whether it is armor stands or area effect clouds, but since you're having to prepare for exams, I wouldn't want to take away your free time.
Ye... I have some exams near right here, should be done with them after 26th may... I am sorry keeping you waiting but maybe another one could make something similar that you want
Once I am done with that stuff, I will be able to make some gun mechanic for you, of course...
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I just finished the system, gonna send it in few minutes
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I sent that as a structure file : You will have to place it into your world's structures directory, then place it using a structure block
The gun is made pretty simple : if the player clicks it while in right hand, it fires an arrow in the appropriate direction.
I set the arrow speed... well... let's say it's more a sniper than a pistol, right now...
You can still change it : The 3 command blocks following the 12th on the big chain (the summon arrow one) contains the speed modifier. They each contain a -0.1 modifier. You can change it, for example, -0.05 (keep the "-"). The values in each 3 command blocks must be same in order to shoot in the right direction.
Be aware that minecraft considers arrow speed to deal damages; the current speed one shots a creeper easily. You could also change the arrow damage nbt.
The quick-made gun (Once you placed the structure, push the button to initialize it, then activate the lever) :
Also, I had a challenge against some guy few days ago, and we each made a command-block-powered flamethrower. I saved the whole system as a structure, here is the link :
In order to activate the structure, activate each lever, push upper button to initialize, and lower button to get items.
This flamethrower would look quite like what you would expect for a good gun system; here are some features :
-Custom design (text only, I'm not good in ressourcepacks )
-You must have a filled fuel can (Bombonne de fuel : pleine) in your inventory and sneak+right click the flamethrower to reload it. If you lose all your filled can or the flamethrower in your hand, reload process is reset
-The emptied fuel cans (Bombonne de fuel : vide) are given back. You can fill them at the Armurier (armorer) NPC.
-Flames don't burn blocks, only entities which don't have the "Fireproof" tag (players dont burn, made for PvE)
-You can modify some settings : Flame duration, speed, burn duration, flames per can, reload time,...
-Flamethrower status are displayed on action bar only when held, and I added some sounds.
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Though, the flamethrower took some time to make...
If you thought about fully-customized guns from shoot to reload like this one (including the system to prevent reload glitches), I could probably make you wait a bit, but tell me first what you would need
I can control quite all parameters : Fire rate, reload time, ammos per mag, optional sounds, bullet speed, spread mode (like 3 shots per click), pseudo-random accuracy (not sure yet but it is possible, though very annoying, only good for a shotgun-like)
2 more things :
-I do not make ressourcepacks, because I am not really good at making nice textures. However I can set a CustomModelData so each gun gets a different skin, if you can make a ressourcepack
-Adding a couple of guns will be somewhat big, I would prefer make them using datapacks, but it wouldn't annoy if you prefered structures
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
under some circumstances, I farmed a fully legit 10 million diamonds... so I went a bit away from forums...
I'm gonna start working on that, maybe would take a couple days
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Hello, I'm working on a map in minecraft that requires a shooting mechanic.
I'm looking for something like this: Detecting where a player is aiming, if the player is firing the gun, and spawning an arrow to face the direction the player is aiming at.
I also want something like a shotgun that fires multiple arrows in multiple directions.
Does anyone know how to do something like that?
This one might help you :
https://www.minecraftforum.net/forums/minecraft-java-edition/redstone-discussion-and/commands-command-blocks-and/2906395-1-13-how-would-i-make-an-arrow-shoot-the-way-im
Basically, here is how that works :
1 : summon an entity in front of the player ~4 blocks away with ^ ^ ^ relative position
2 : Store both the player XYZ coords and the ones of the entity in scores (playerX,playerY,playerZ,entityX,entityY,entityZ)
3 : Substract the coords of player and entity. This will give you proportionnal vector to give X,Y and Z motion to the arrow (playerX-entityX, playerY-entityY,playerZ-entityZ)
4 : summon an arrow at the player
5 : apply the resulting XYZ scores into the arrow's motion using /execute store result entity. You can set a multiplier to make the arrow not go too fast (or negative multiplier if goes backwards). (resultX to Motion[0], resultY to Motion[1], resultZ to Motion[2])
And now, the arrow goes in the player direction.
Example :
1. Player is at X=24,Y=11,Z=-30. The entity is summoned in front of him, at X=26,Y=12,Z=-31
2. Storing Both XYZ
3. Substracting it :
-ResultX = 24-26 = -2
-ResultY = 11 - 12 = -1
-ResultZ = -30 - -31 =1
4. Summoning the arrow
5. Applying the results to arrow. In that case, it will have a X speed of -2, Y speed of -1 and Z speed of 1. Of course the "/execute store result entity" features a multiplier. you could so multiply the numbers obtained to get a higher or lower speed.
This is a somewhat advanced command system, there must be a minimum knowledge about commands and maths to do that properly.
And by the way, an "arrow shotgun" could only deal 1 arrow damage. If you already tested an 1-tick dispenser-arrow gatling on yourself in survival, you would have noticed that some arrows are deflected without dealing damage. This would be the case with shotgun, although we can still simulate a dispersion effect.
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Okay, this is all really complicated for me as I'm not really that into command blocks.
So I made a series of commands (in a chain) that almost work.
Here they are:
/execute if entity @p[scores={RClickAR=1..}]
/execute at @p run summon minecraft:armor_stand ^ ^1 ^0.5 {Invisible:1b}
/execute at @e[type=armor_stand] run summon minecraft:arrow ~ ~ ~
/kill @e[type=armor_stand]
/scoreboard players set @p RClickAR 0
What happens is it summons an arrow where I look at, but it isn't directional.
Do you think you can help me by working on what I already made? Thank you so much.
P.S.
For the arrow shotgun, I just want to spawn arrows in different directions from the original pellet.
Yes, all the problem is about the arrow's Motion...
Arrow movement is only determined by the XYZ Motion tags, and there is unfortunately no command like "/set Motion as @p".
I can definitely tell you that the only way currently is to have some trick convert the player's looking direction into XYZ movement vectors, and the "summon-an-entity-and-compare-coords" technique is probably the best in that case.
However, making a shotgun from that would be quite simple : just summon 4-5 arrows and modify a bit their motion value using scoreboard operation to make them spread in a half-random pattern.
Another thing, a bit simpler but still needing some knowledge, is raycasting guns : It is possible to make a ray of particles at the direction the player is facing, and apply a damage effect if an entity gets onto its path. This is only possible through datapacks only (or command blocks, but will be slow), though.
I would say overall, making a gun system definitely takes some command knowledge and logic understanding. The two ways I just told you are the most popular ways for gun systems (well there is not really any other way as good as that, as far as I know - and I know far -)
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I see. Could you maybe send me something that works off of what I already designed?
Thanks again
Well I could do some working gun, but I use area_effect_clouds instead of armor stands, because quite smoother for the game.
However, it may take something like 1 day, as I am into exams right now.
Would you prefer a command block system or a datapack?
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
It doesn't matter whether it is armor stands or area effect clouds, but since you're having to prepare for exams, I wouldn't want to take away your free time.
Hello?
Ye... I have some exams near right here, should be done with them after 26th may... I am sorry keeping you waiting but maybe another one could make something similar that you want
Once I am done with that stuff, I will be able to make some gun mechanic for you, of course...
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
I understand. Again, thank you so much.
Hehehe! you thought I forgot you?
I just finished the system, gonna send it in few minutes
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Here you go!
I sent that as a structure file : You will have to place it into your world's structures directory, then place it using a structure block
The gun is made pretty simple : if the player clicks it while in right hand, it fires an arrow in the appropriate direction.
I set the arrow speed... well... let's say it's more a sniper than a pistol, right now...
You can still change it : The 3 command blocks following the 12th on the big chain (the summon arrow one) contains the speed modifier. They each contain a -0.1 modifier. You can change it, for example, -0.05 (keep the "-"). The values in each 3 command blocks must be same in order to shoot in the right direction.
Be aware that minecraft considers arrow speed to deal damages; the current speed one shots a creeper easily. You could also change the arrow damage nbt.
The quick-made gun (Once you placed the structure, push the button to initialize it, then activate the lever) :
http://s000.tinyupload.com/?file_id=52163922244906448393
Also, I had a challenge against some guy few days ago, and we each made a command-block-powered flamethrower. I saved the whole system as a structure, here is the link :
http://s000.tinyupload.com/index.php?file_id=33836237258747127236
In order to activate the structure, activate each lever, push upper button to initialize, and lower button to get items.
This flamethrower would look quite like what you would expect for a good gun system; here are some features :
-Custom design (text only, I'm not good in ressourcepacks )
-You must have a filled fuel can (Bombonne de fuel : pleine) in your inventory and sneak+right click the flamethrower to reload it. If you lose all your filled can or the flamethrower in your hand, reload process is reset
-The emptied fuel cans (Bombonne de fuel : vide) are given back. You can fill them at the Armurier (armorer) NPC.
-Flames don't burn blocks, only entities which don't have the "Fireproof" tag (players dont burn, made for PvE)
-You can modify some settings : Flame duration, speed, burn duration, flames per can, reload time,...
-Flamethrower status are displayed on action bar only when held, and I added some sounds.
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Hello!
Unfortunately, due to the site you used to upload the files, I couldn't download it.
Could you try using MediaFire or Google Drive?
Thanks.
Oh ok I will do that
Though it seems to work perfectly for me, when clicking on "quick_gun.nbt" under "Download"
Here are the links :
Quick gun :
http://www.mediafire.com/file/34cee98mk38xo5q/quick_gun.nbt/file
Flamethrower :
http://www.mediafire.com/file/1av5wyszswe3u3t/lance-flammes_with_addons.nbt/file
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
This is amazing!
I will feature you in the map credits.
Thank you so much!
PS:
Would it also be possible to add different types of guns just by pasting the same structure and changing the objective names?
Of course I could do that...
Though, the flamethrower took some time to make...
If you thought about fully-customized guns from shoot to reload like this one (including the system to prevent reload glitches), I could probably make you wait a bit, but tell me first what you would need
I can control quite all parameters : Fire rate, reload time, ammos per mag, optional sounds, bullet speed, spread mode (like 3 shots per click), pseudo-random accuracy (not sure yet but it is possible, though very annoying, only good for a shotgun-like)
2 more things :
-I do not make ressourcepacks, because I am not really good at making nice textures. However I can set a CustomModelData so each gun gets a different skin, if you can make a ressourcepack
-Adding a couple of guns will be somewhat big, I would prefer make them using datapacks, but it wouldn't annoy if you prefered structures
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
You don't need to change the flamethrower, I only need guns for this map.
I'm looking for only 3 guns:
Assault Rifle (The one you already sent works good for it)
Shotgun (4 Different pellets going in slightly different directions)
Sniper Rifle (Extremely accurate but slow firing)
I can make 3d models that could look really good for the guns, so you don't need to make the textures yourself.
Again, thank you so much.
Well I'll work on that!
Should be done in some days...
Datapack, or structures?
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
Structures
Oaaaah yes sorry I was just on a server
under some circumstances, I farmed a fully legit 10 million diamonds... so I went a bit away from forums...
I'm gonna start working on that, maybe would take a couple days
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).