weapons that are both ranged and melee

Started by Pokudo on

Topic category: Help with modding (Java Edition)

Last seen on 09:56, 15. Apr 2020
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
weapons that are both ranged and melee

Hello everyone, I really need some help:

i'd like to make a weapon (Mjölnir-->Thor's hammer) that shoots lightning wherever you look and not only in the reach you can hit blocks and I already understood that you have to make a ranged item that shoots an arrow at full speed (ammo=air) and when the arrow hits the ground it strikes lightning. I can already do that, it's pretty easy. But now my problem is that I also want it to deal extra damage (like a sword) and be a pickaxe with a procedure on block break that allows it to break 3x3x3 (already made th procedure). All the coding I tried (I've never learned any coding) didn't work and made build gradle task fail. Can anybody please help me???

Last seen on 06:31, 18. Nov 2022
Joined Oct 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Finally I know how to spell…
Tue, 01/08/2019 - 17:44

Finally I know how to spell the name of Thor’s Hammer!

But more importantly:

The Lightning wherever you look probably has something to do with the “get” operation of where the player is looking somewhat like this: spawn “lightning” where: “get block where player crosshair is pointing”.

That is NOT code by the way, it’s just a way of explaining the code that I don’t know how to write yet.

 

-jaden-

Last seen on 09:56, 15. Apr 2020
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're probably right but I…
Wed, 01/09/2019 - 20:45

You're probably right but I've got zero knownlenge of coding so I still can't do it... (by the way, you're welcome for the spelling of Thor's Hammer)

Either way, I found another way to make it work: make a custom structure spawn that spawns once in a world with some command blocks that detect if you're holding Mjölnir and if you do, it would set a specific tag on any arrow in a range of 1 block from the player and make it summon a lightning bolt when it hits the ground. As for shooting the arrow, there is a block in "world management" called "shoot arrow" so...

For anyone who'd be interested in the commands, here they are (change TagName and the item's id):

1st command block (repeating, unconditional, always active): scoreboard players tag @e remove TagName

2nd (chain, uncondit, always active): scoreboard players tag @a add TagName {SelectedItem:{id:testenvironmentmod:mjölnir}}

3rd (same as last one): scoreboard players tag @e remove TagName1

4th (again):  execute @e[tag=TagName] ~ ~ ~ scoreboard players tag @e[type=arrow,r=1] add TagName1

5th (it goes on): scoreboard players tag @e remove TagName2

6th (and on): scoreboard players tag @e[tag=TagName1] add TagName2 {InGround:1b}

7th (and on): execute @e[tag=TagName2] ~ ~ ~ summon lightning_bolt ~ ~ ~

8th (chain, conditional, always active): execute @e[tag=TagName2] ~ ~ ~ kill @e[tag=TagName2,r=1]

That doesn't change the fact that i'd like to know how to code it though, and it would seem weird you can't code something with js, but you can code with something made with js...

Last seen on 10:24, 30. Dec 2023
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, how did you make the…
Fri, 05/01/2020 - 16:46

Hey, how did you make the procedure for a pickaxe to destroy a 3x3x3? I've been wanting to do that for a while.