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

Active 2 years ago
Joined Nov 2021
Points:
524

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
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!

Active 3 years ago
Joined Apr 2018
Points:
745

User statistics:

  • Modifications: 3
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 39
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.

 

Active 2 years ago
Joined Nov 2021
Points:
524

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 2
@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

Active 4 months ago
Joined Nov 2021
Points:
621

User statistics:

  • Modifications: 7
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 21
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.