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]

I absolutely hate Merlin trials in Hogwarts. I absolutely hate Merlin trials in Hogwarts.

Posted On: June 23, 2023
I have completed the main quests and I’ve still just done maybe 2 or 3 Merlin trials at max. Is it just me? Question from user Spiritualmatterhorn at HogwartsLegacyGaming at reddit. Answer...[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]


How do I light (and clear) a torch in The Witcher 3? How do I light (and clear) a torch in The Witcher 3?

Posted On: August 13, 2023
I'm sure that I have some torches in my inventory. But how can I light a torch? What exactly do I have to do? And how long does a torch "burn"? Question from user PeterCo at sta...[More]


How do I find my Outpost(s)? How do I find my Outpost(s)?

Posted On: September 6, 2023
In my adventures I found a planet that had an iron deposit, which I need a lot of. I placed down the outpost marker, miner, and powered up. Then I went on my way with other interstellar adventures. I&...[More]


BG3 map is incredibly small. BG3 map is incredibly small.

Posted On: May 29, 2024
The entire Wilderness map grid is 310 squares from top to bottom. .As each D&D grid square is 1,5 meters, it means the map is only 465 meters from top to bottom.If we consider it's 465 meters wide, th...[More]


What is the time difference between BOTW and TOTK? What is the time difference between BOTW and TOTK?

Posted On: May 30, 2023
The whole story is pretty clearly 'a few years later' but is there at any point where they do give a precise time that happened between games? Question from user Fredy31 at gaming.stackexch...[More]


What is a Turtle Goal in Rocket League? What is a Turtle Goal in Rocket League?

Posted On: May 7, 2023
While playing ranked doubles, I received 20 points for a turtle goal. . What is a turtle goal? Question from user HazyKingdom at gaming.stackexchange.com. Answer: When you score a goal by ...[More]


Most Frustrating Thing Ever in Hogwarts Legacy Most Frustrating Thing Ever in Hogwarts Legacy

Posted On: April 20, 2023
I have 139 out of 140 conjurations. Fairly certain I found all the butterflies and the chests in the Vivarium's so now I have to start all over again and recheck them all. Question from user...[More]


What is the highest speed possible? What is the highest speed possible?

Posted On: April 9, 2024
What is the maximum speed in MechWarrior Online? I know the light mechs easily go beyond 120 kph.Question from user Vanguard66 at gaming.stackexchange.com.Answer:Gauging by the Pirate's Bane Locust, w...[More]


What do the stars under can produce mean in against the storm What do the stars under can produce mean in against the storm

Posted On: February 7, 2023
Does it mean it can produce those goods faster, higher quality or what? Is it worth it to replace buildings with higher starred versions or prioritize going for buildings with new stuff?So for example...[More]