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

Started by PokePika__10339__ on Sat, 01/22/2022 - 02:41

Topic category: Help with MCreator software

Last seen on 15:55, 6. Feb 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do I make it so when a player hits an entity it deals damage to the player?
Sat, 01/22/2022 - 02:41

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:
  • Tracker tickets:
  • 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 15:55, 6. Feb 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 21:12, 8. May 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.