How can I make a tool that heals the player after killing an entity

Started by Xyon on

Topic category: Help with modding (Java Edition)

Last seen on 23:23, 15. Sep 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I make a tool that heals the player after killing an entity

Im using Mcreator version 2024.2, I have seen a tutorial on how to do this on a different forum however, on this version there isn't a trigger for when the player kills a mob.  I need help and would appreciate it if anybody would tell me how to make it work.

Last seen on 21:06, 17. Sep 2024
Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This should work You can…
Tue, 08/06/2024 - 19:11

This should work

The procedure

You can replace the 2 with a different number to increase/decrease the amount of health healed

(You don't need to put this in any of the item's triggers, because you just need to select "Entity dies" in the global trigger)

Last seen on 23:23, 15. Sep 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you!
Tue, 08/06/2024 - 19:16

Thank you!

Last seen on 21:06, 17. Sep 2024
Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your welcome :D
Tue, 08/06/2024 - 19:19

Your welcome :D

Last seen on 23:23, 15. Sep 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It doesn’t work! ..well…
Tue, 08/06/2024 - 20:48

It doesn’t work! ..well sorta, with the code it just heals the player even if the player doesn’t have the tool or used the tool to kill the mob. How can I fix this? I tried to fix it by making it check if the user has the tool in the backpack AND has it in its hand. However, this did not fix it either.

Last seen on 22:49, 8. Aug 2024
Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you're checking both the…
Tue, 08/06/2024 - 21:47

If you're checking both the backpack and the hand, that means you need the tool in your backpack and in your hand, or it will not work. I would assume that's unintentional? Change the AND to OR maybe?

Last seen on 23:23, 15. Sep 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Eh still does not work, for…
Tue, 08/06/2024 - 22:03

Eh still does not work, for reference this is how the code is as of rn

Last seen on 23:23, 15. Sep 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That worked! Thank you and…
Wed, 08/07/2024 - 02:16

That worked! Thank you and everybody for helping me!