Respawn entity with interval

Started by RandomDrago on Wed, 07/20/2022 - 09:48

Topic category: Help with modding (Java Edition)

Last seen on 04:20, 24. Aug 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Respawn entity with interval
Wed, 07/20/2022 - 09:48

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 12:53, 2. Oct 2022
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 04:20, 24. Aug 2022
Joined Feb 2022
Points:

User statistics:

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