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]

Can you romance anyone in Hogwarts Legacy? Can you romance anyone in Hogwarts Legacy?

Posted On: July 20, 2023
I'm wondering if I'm able to get my flirt on with someone from Hogwarts. Is it possible to have a romantic relationship with anyone in Hogwarts Legacy? Question from user Shaun Roselt at...[More]


What game is this music featured in Garrys Mod Idiot Box from? What game is this music featured in Garrys Mod Idiot Box from?

Posted On: September 3, 2023
I was watching some funny Garry's Mod Idiot Box episodes on YouTube. In episode 3 at 5:41 is a scene that has some music being played in the background. What game is from? It sounds so familiar to...[More]


What dialogue choice do you regret choosing? What dialogue choice do you regret choosing?

Posted On: December 17, 2024
Question from user andyyhs at BaldursGate3 at reddit.com.Answer:letting Laezel go on her own to Crèche on my first playthrough and then she turned to shadow Laezel and I wasnt able to get her back. h...[More]


Are any of the quests in Horizon: Zero Dawn time sensitive? Are any of the quests in Horizon: Zero Dawn time sensitive?

Posted On: April 4, 2023
I started playing Horizon: Zero Dawn a few weeks ago and have been focusing mainly on sidequests and exploring the world. I advanced the game just enough so I got to Meridian, but as I collected more ...[More]


Links to webpages in books Links to webpages in books

Posted On: February 3, 2023
In multiple multiplayer servers I play in (e.g. Hypixel), There are books with text in them, and when you click on the text it takes you to a website.How do I replicate this?Question from user 65_7a a...[More]


Baldur's Gate 2 workout! Baldur's Gate 2 workout!

Posted On: April 28, 2025
This was made from the feedback I got earlier! I hope y'all enjoy!.Question from user VieEphemere at BaldursGate3 at reddit.com.Answer:15 squats per critical .Level 12 champion fighter, using deadshot...[More]


The combat has ruined this game for me The combat has ruined this game for me

Posted On: March 31, 2025
I think I've given Baldur's Gate 3 a fair shake. I've played through most of Act 1 and I think the characters and writing are great. The combat on the other hand, is absolutely horrendous. Every actio...[More]


How do Dragoon and Daybreak pieces work in Team Battles? How do Dragoon and Daybreak pieces work in Team Battles?

Posted On: December 3, 2023
In normal matches, the Dragoon and Daybreak items in Smash Ultimate require a player to collect all three pieces before they can be used. How do these items work in team battles? If player A picks up ...[More]


Friends cant connect to my server with external IP Friends cant connect to my server with external IP

Posted On: February 9, 2023
Year after year I have been the one to host a minecraft server for a few weeks when the new minecraft update comes so me and my buddies can have some nostalgia. Every year I set up the server. In m...[More]


Why are Fallouts computers so backwards? Why are Fallouts computers so backwards?

Posted On: April 16, 2024
The games are set in the future right? Circa 2077. But the terminals look like the computers back in the 1950's. When we actually had to type commands to get things done. Why is this? Im assuming it h...[More]