How do I make it so when a player hits an entity it deals damage to the player?

Started by PokePika__10339__ on

Topic category: Help with MCreator software

Last seen on 23:10, 26. Jun 2023
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make it so when a player hits an entity it deals damage to the player?

I would like the entity to run away but because its a cacti mob to deal damage on the player, but whenever I try to make it deal the player it damages the mob instead. I have it so it uses instant damage but I only want to deal half a heart. Help!

Last seen on 00:35, 26. Jan 2022
Joined Apr 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can use the 'When entity…
Sat, 01/22/2022 - 03:39

You can use the 'When entity is hurt' trigger to make a procedure that deals 1 damage (half a heart) to the sourceentity, which should (?) be the player. I haven't actually tested this, but try it and see if it works.

 

Last seen on 23:10, 26. Jun 2023
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@MILLIMEDIA what do you mean…
Sat, 01/22/2022 - 13:08

@MILLIMEDIA what do you mean by sourceentity, how do I do that?

Lol I suck at this XD

Last seen on 22:12, 7. Mar 2024
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the "Minecraft Components…
Thu, 02/10/2022 - 11:57

In the "Minecraft Components" section in the procedure, you can replace the event/target entity in the block with sourceentity.