How do I make mobs slowly respawn up to a certain cap?

[BACK]
How do I make mobs slowly respawn up to a certain cap?
Posted On: January 27, 2023

I am currently making a Legend of Zelda themed adventure map. I am struggling to make it, so enemies spawn every few minutes but not spawn large amounts over time. I have tried using things like hopper clocks to time when enemies spawn but after a while it turns into a large swarm of unwanted enemies. I am looking to make it so if an enemy has already spawned another will not spawn.


Example: if there are 5 enemies in a room, there will never be more than 5. So even if a few are killed, a few minutes later more will respawn, but no more than 5 in total.


Question from user Opllusion at gaming.stackexchange.com.


Answer:

You can store the result of the execute if entity subcommand to count how many entities there are and then execute based on that.


You will need a dummy scoreboard objective (let's say count) and a fakeplayer to store the amount in (let's say $zombies).


Now we can count the amount of zombies and only summon another one if there are 4 or less zombies in total:.


execute store result score $zombies count if entity @e[type=zombie].


execute if score $zombies count matches ..4 run summon zombie.


Answer from user Plagiatus at gaming.stackexchange.com.


[BACK]
How do I make mobs slowly respawn up to a certain cap?
Posted On: January 27, 2023

I am currently making a Legend of Zelda themed adventure map. I am struggling to make it, so enemies spawn every few minutes but not spawn large amounts over time. I have tried using things like hopper clocks to time when enemies spawn but after a while it turns into a large swarm of unwanted enemies. I am looking to make it so if an enemy has already spawned another will not spawn.


Example: if there are 5 enemies in a room, there will never be more than 5. So even if a few are killed, a few minutes later more will respawn, but no more than 5 in total.


Question from user Opllusion at gaming.stackexchange.com.


Answer:

You can store the result of the execute if entity subcommand to count how many entities there are and then execute based on that.


You will need a dummy scoreboard objective (let's say count) and a fakeplayer to store the amount in (let's say $zombies).


Now we can count the amount of zombies and only summon another one if there are 4 or less zombies in total:.


execute store result score $zombies count if entity @e[type=zombie].


execute if score $zombies count matches ..4 run summon zombie.


Answer from user Plagiatus at gaming.stackexchange.com.


[BACK]

Why does the Tinker aspect only work on some skills in Dead Cells? Why does the Tinker aspect only work on some skills in Dead Cells?

Posted On: April 12, 2023
The description for the Tinker aspect says "Reduce skill cooldown to 1 sec." In practice the cooldown seems to be unchanged on most abilities I've tried (Infantry Grenade, Pollo Power, Tonic, Face Fla...[More]


EU4: Why is my personal union ending? EU4: Why is my personal union ending?

Posted On: August 5, 2023
I am playing as Aragon and I have a personal union with Castile. My ruler is called "Alfons VI de Trastámara". Everything is well, Castile's opinion of me is 200, and I have just ...[More]


In Hogwarts how do I unlock chests with an eyeball on it? In Hogwarts how do I unlock chests with an eyeball on it?

Posted On: February 14, 2023
I have come across multiple chests that will not let me open them. They have an eye in the middle which looks at me when I get close. Question from user Oast at gaming.stackexchange.com. Answer:...[More]


How do I stop a mother from breastfeeding? How do I stop a mother from breastfeeding?

Posted On: March 13, 2024
My colony recently welcomed a dirtmole hybrid into its community. The lil' tyke has -4 metabolism, which means a x200% food requirement, and had not reached one quadrum in age before coming down with ...[More]


How does Skyrim determine if a dungeon is cleared? How does Skyrim determine if a dungeon is cleared?

Posted On: July 19, 2022
Skyrim adds an awesome feature, that lets you know if you have cleared a dungeon or not. This saves a lot of time and effort, because you do not have to revisit every dungeon you have been through lik...[More]


Can I alter the biome of an area? Can I alter the biome of an area?

Posted On: January 12, 2023
In part 3 of my adventures, I would like to find out if there is a way to change biomes. In part 2, fredley said that it is possible to move terrain from one world to another, but the biomes wouldn...[More]


Where are all the Daedalian Key locations in Hogwarts Legacy? Where are all the Daedalian Key locations in Hogwarts Legacy?

Posted On: July 20, 2023
I'm trying to find all the Daedalian Keys to put onto the chest cabinet thing in my common room, but I'm struggling to find all of them. Where can I find all of them? Does someone have a li...[More]


Are my Assassins Creed experience levels bugged? Are my Assassins Creed experience levels bugged?

Posted On: July 8, 2023
I'm confused. In Assassins Creed: Revelations I have lots of assassins which I've sent off on missions, however their XP to next level is less than their current XP (i.e, XP of 13k, next level...[More]


How do you role play anything but nice characters? How do you role play anything but nice characters?

Posted On: October 27, 2023
I'm someone who feels bad in any video game if I am mean to some NPC. I'm also someone who tries to get everything in a single playthrough and try to pick the right dialogue option for that, r...[More]


How can I get more ancient arrows in Breath Of The Wild? How can I get more ancient arrows in Breath Of The Wild?

Posted On: August 11, 2023
I've finished the Divine Beast quests and heaps of side quests, but I've never received any more than a handful of ancient arrows. How can I buy or farm more? Question from user l0b0 at sta...[More]