Respawn entity with interval

Started by RandomDrago on

Topic category: Help with modding (Java Edition)

Last seen on 19:28, 16. Aug 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Respawn entity with interval

Hoi! I've been planning on making a map and the map will have respawning custom mobs at a certain village when they die.

 So I want the mob to respawn after getting killed.

And if it's possible I want there to be a limit to how many of them can exist at the same time (only 7 alive at same time for example)

Would appreciate it if someone helped about this 

Last seen on 01:59, 29. Mar 2024
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It actually isn't too hard…
Sat, 07/30/2022 - 05:09

It actually isn't too hard to do this. So for your custom village, when it spawns, you have to make 3 global map variables: villagexpos, villageypos, villagezpos do the procedure:

When structure spawns:

Set villagexpos to x

Set villageypos to y

Set villagezpos to z

 

And now, in an "when entity dies" global procedure, add this:

If event/target entity is sub-type of your custom entity:

   Do in server-side world "The dimension your custom village spawns in"

   spawn entity at villagexpos villageypos+3 villagezpos Type: Your custom entity

Or something like that.

Last seen on 19:28, 16. Aug 2023
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ooh! That's pretty clever…
Sat, 07/30/2022 - 07:17

Ooh! That's pretty clever thank you for your help! I couldn't think of doing that lmao :D