How to make a sword that gives effect to player when hitting mob.

Started by RaphBizz on

Topic category: Help with Minecraft modding (Java Edition)

Active 5 years ago
Joined Jul 2019
Points:
663

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
How to make a sword that gives effect to player when hitting mob.

Hey guys can anyone tell me how to make a sword that gives a potion effect to a player when they hit an animal/a mob?

Active 5 years ago
Joined Dec 2016
Points:
735

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 11
I'm pretty sure it can be…
Wed, 07/24/2019 - 09:33

I'm pretty sure it can be solved using Procedures. Try exploring the coding blocks, and tell me if you can or can't find a way to do it.

Active 5 years ago
Joined Jul 2019
Points:
663

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
I explored the coding blocks…
Sun, 07/28/2019 - 20:23

I explored the coding blocks but decided to do it again and could only find a way to give potion effects to the entity attacked and not to the player who attacked the entity.

 

Active 10 months ago
Joined Mar 2020
Points:
626

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
yeah ... that is my problem…
Mon, 03/16/2020 - 08:51

yeah ... that is my problem too... anyone can't help us ?

Active 4 years ago
Joined Aug 2019
Points:
647

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 4
I have made new procedure…
Mon, 03/23/2020 - 09:53

I have made new procedure that when mob is killed with a chosen item in main hand it will give the player effect but for some reason if the item loses duration it will no longer give the player the effect. So if any of you know how to make the effect work even when the item loses duration please tell me. But this will work with item that does not lose duration.

Code: https://ctrlv.cz/Gc3D

Active 5 months ago
Joined Jun 2019
Points:
2788

User statistics:

  • Modifications: 4
  • Forum topics: 48
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3716
just do when mobs hurt with…
Mon, 03/23/2020 - 10:34

just do when mobs hurt with tool

execute command /effect and the effect you want

Active 4 years ago
Joined Aug 2019
Points:
647

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 4
Could you please show me a…
Mon, 03/23/2020 - 11:27

Could you please show me a picture of the procedure? I tried multiple things with the execute command thing, but I cannot get it to work.

Active 5 months ago
Joined Jun 2019
Points:
2788

User statistics:

  • Modifications: 4
  • Forum topics: 48
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3716
vanilla commands for 1.14: …
Mon, 03/23/2020 - 11:29

vanilla commands

for 1.14:

/effect give @p resistance 100 2

gives resistance II for 100 secs

Active 4 years ago
Joined Aug 2019
Points:
647

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 4
I know vanilla commands ;D…
Mon, 03/23/2020 - 12:42

I know vanilla commands ;D. I went to the tool procedures menu and picked "When mob is hit with tool" and added "execute command" procedure and added the "effect command", but in game when I hit something with it id does not give me any effect. I tried multiple ways to do it but nothing seems to work could you please make the procedure your self and post a screenshot It would be very helpful?
here are some ways i tried to do it but they didn't work: https://ctrlv.cz/XG3D

Active 5 months ago
Joined Jun 2019
Points:
2788

User statistics:

  • Modifications: 4
  • Forum topics: 48
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3716
your image does not work
Mon, 03/23/2020 - 13:22

your image does not work

Active 3 years ago
Joined Jun 2021
Points:
518

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
you first create a procedure…
Sun, 06/20/2021 - 09:25

you first create a procedure. then you go to your sword menu and go to triggers. there you can put your procedure in *when living entity is hit with tool* hope this helped you I was searching for that for a bit of time xD