If EntityDies, a specific mob nearby attacks the source entity (Procedure)

Started by pichugirl11 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If EntityDies, a specific mob nearby attacks the source entity (Procedure)
Thu, 05/30/2024 - 02:41 (edited)

https://imgur.com/a/LPRkC7c

wanted to make it so my mob, 'mokeymokey' when killed with have others of the same type nearby hunt down the killer of the original one. i tried to do it on my own but i'm really stuck my line of code is not working and it won't let me add a condition in the mob ai

Edited by pichugirl11 on Thu, 05/30/2024 - 02:41
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Apologies for getting to…
Thu, 07/11/2024 - 04:29

Apologies for getting to this rather late, but, better late than never here...

I liked the idea of creating a pigmen-esque mechanic, so I tinkered around with it and tried a few things.

This is what I recommend:
Try having your mob aggressive towards all living entities, with a condition.


Condition procedures need to end with a 'Return logic'. And I like creating custom bools, setting them to false at the start of the procedure, and then checking a condition before allowing them.
If you're unfamiliar with NBT tags, don't worry, they're easy. You just make up your own variable names and you can use them.


Here's the procedure I have set to run when the entity is killed. I suggest using a numeric tag so you can treat it like a timer or counter if you'd like.
You could have a procedure running every tick that reduces the value of the tag on the player by getting it, subtracting a value, and setting it to the player again. Or you could do something like, every time your entity attacks the player, it chips away at the value.
However, I should note that during my testing, I spawned a group of these mobs, killed one, they all aggro'd on me, and then I spawned more, but they were not immediately aggressive. I had to kill another to get the new ones after me. Just feel free to play around with it all to get it to your liking.