Started by
LaTortiia
on
Topic category: Help with Minecraft modding (Java Edition)
So, I'm trying to to program COD BO2's Tranzit in Minecraft, and for now, everything is going fine except the zombie spawning.
I was wondering if any of you know a way to program a procedure that spawns an "X" amount of zombies distributed in a couple of predefined coordinates.
Also, I've been struggling in figuring out how to code that zombies should despawn and respawn near the player in case he gets too far away.
Do any of you guys have any experience or ideas on how to code this?
Thanks!!
by predefined coordinated what do you mean? Also there is a checkbox on your entity editor "Despawn Entity When Idle"
I know some commands that could help you. You have to use a Function
First add a tag "killable" with:
/tag @e[type=minecraft:zombie] add killable
Then use this command after use [limit] for the amount of zombies you want:
/execute if entity @e[type=minecraft:zombie,limit=5] run execute as @e[type=minecraft:zombie,limit=5,sort=nearest] run tag @s add safe
Then add
/tag @e[type=minecraft:zombie,tag=safe] remove killable
Then add a procedure that kills the zombies that are tagged "killable" with a slight time delay so you dont wind up killing every zombie
/kill @e[tag=killable]