How to have a procedure that is run by an entity but damages the player?

Started by Sharpblade1 on

Topic category: Help with Minecraft modding (Java Edition)

Active 1 day ago
Joined Jul 2024
Points:
129

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
How to have a procedure that is run by an entity but damages the player?

Is there a way to create create a procedure so that if the player is at a distance from an entity the player is damaged?

Active 4 months ago
Joined Mar 2025
Points:
32

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
You could use the "get…
Sat, 04/26/2025 - 18:57

You could use the "get nearest entity at xyz in square cube of type" procedure block to get the nearest player in a given radius, and then deal damage to that player.

Of course, you may want to first check that a player actually does exist within that radius, to avoid trying to deal damage to a null entity.

Active 1 day ago
Joined Jul 2024
Points:
129

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
I have tried that, but the…
Mon, 04/28/2025 - 17:12

I have tried that, but the main problem I always run into is that it damages the entity and not the player.

Active 1 day ago
Joined Jul 2024
Points:
129

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
I just had a thought and…
Mon, 04/28/2025 - 17:40

I just had a thought and tested it out, it worked. Thank you for replying.

 

p.s If you want I can tell you what I did.