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]

What does glowing Mantis Blades mean? What does glowing Mantis Blades mean?

Posted On: December 31, 2023
I am playing with Mantis Blades and occasionally after eliminating an enemy the blades glow with a blue hue and have blue 'code' rising from them. I have no idea what this is telling me. Wh...[More]


How can you run Skyrim in borderless window mode? How can you run Skyrim in borderless window mode?

Posted On: April 6, 2023
I've noticed Skyrim has some issues when minimizing. This is a real pain when playing on multiple monitors and you attempt to find something on the other monitor. Is there anyway to enable borderl...[More]


Where does this blue cube-shaped object belong in Unpacking? Where does this blue cube-shaped object belong in Unpacking?

Posted On: July 25, 2023
I cannot understand what this blue cube-shaped object is. I cannot find where it belongs. Every place I put it in shows it's wrong. Where should I place this object? Question from user sdo at s...[More]


Can you die from an Unknown Location in Slay The Spire? Can you die from an Unknown Location in Slay The Spire?

Posted On: December 17, 2023
I encountered an Unknown Location (aka a ? room) with an option to upgrade 2 cards but would make me lose 16 HP. I encountered this room while I only had 1 hp. If I had taken the upgrade, would the ro...[More]


Could Phoenix tears cure Anne? Could Phoenix tears cure Anne?

Posted On: September 1, 2023
I don’t know a whole lot about what Phoenix tears can and cannot cure, but when rewatching Chamber of Secrets, the thought came to me. Question from user Proud-Product-7748 at HogwartsLegacyG...[More]


How do restaurants and markets differ in their functions and benefits in Tropico? How do restaurants and markets differ in their functions and benefits in Tropico?

Posted On: May 30, 2023
It seems that both the restaurant and the market are used by Tropicans to satisfy their "food" needs. Since the restaurant has the added convenience of also satisfying the "entertainmen...[More]


How to get the Steam Workshop to work with Civilization V for a Mac? How to get the Steam Workshop to work with Civilization V for a Mac?

Posted On: June 12, 2023
I currently own Civilization V, (not the Gods & Kings expansion,) and have the latest version of it and have subscribed to several items on the Steam Workshop, but when I start-up the game, none o...[More]


How do I kill these spiders in Hogwarts Legacy? How do I kill these spiders in Hogwarts Legacy?

Posted On: August 20, 2023
I’m trying to make my way to jackdaws rest. I’m going through the forbidden forest. And these spiders I keep running into seem to be impossible to beat with my noob status. Like they keep ...[More]


Why do I create 2 characters when starting a new playthrough? Why do I create 2 characters when starting a new playthrough?

Posted On: August 8, 2023
The character creation process is very confusing to me. I know it's early access and things are being polished continuously, but it's unclear why I need to create 2 characters. After comple...[More]


What *exactly* is the action - event that fixes your choice of Grimm Troupe quest? What *exactly* is the action - event that fixes your choice of Grimm Troupe quest?

Posted On: February 16, 2023
I recently found out that there are 2 options of the final portion of the Grimm Troupe content. Fight the Nightmare King. Help Brumm banish the Troupe. My wife and I have 2 saves, we've b...[More]