How to affect an enemy after hitting it with a weapon?

Started by WhoAteMyCheerios on Mon, 08/10/2020 - 21:20

Topic category: Help with modding (Java Edition)

Last seen on 21:20, 10. Aug 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to affect an enemy after hitting it with a weapon?
Mon, 08/10/2020 - 21:20

Hi,

I've been trying to make a weapon that puts an effect on an enemy when it is hit with said weapon. I've tried a few different things but nothing has worked out in my favor. I'm relatively new to the whole procedure shenaniganry so I'm sorry if I'm missing something obvious. 

Last seen on 16:05, 13. May 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
It's pretty easy; You need…
Mon, 08/10/2020 - 22:45

It's pretty easy; You need to connect a procedure to it, and that procedure should be the "entity attacked" trigger. How I usually do it for this sort of thing is go into the "template library" and grab the "Add potion if entity has specific item in hand" template. You can put that under the trigger block, and finally choose your potion effect (You can make custom ones too ;). 

If you wish, you can grab the other potion block from the entity procedure tab that includes whether you can see potion particles and whether it's ambient.

 -Happy modding ;)