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]

In Yakuza0, What does divine intervention mean on the Sacred Wooden Katana? In Yakuza0, What does divine intervention mean on the Sacred Wooden Katana?

Posted On: March 20, 2023
The description of the Sacred Wooden Katana states:. This wooden sword is protected by the gods, and legend has it that divine intervention will occur when your health is low. What does "di...[More]


Why does this solution to 5-3 work? Didnt the Prince get eaten? Why does this solution to 5-3 work? Didnt the Prince get eaten?

Posted On: November 26, 2023
In Storyteller, a puzzle game about telling stories that fit a title, I accidentally solved Chapter 5.3 - Duplicity: A Kiss and a Curse without understanding why my solution worked. Kiss, Witch, Pr...[More]


New player in Hogwarts Legacy!! New player in Hogwarts Legacy!!

Posted On: June 25, 2023
Currently downloading the game on steam, anybody have any tips or anything for my first time ever playing the game? All advice welcome! Thanks :D. Question from user sullydtd at HogwartsLegacyGamin...[More]


Whats the software used in Megaman X speedruns? Whats the software used in Megaman X speedruns?

Posted On: March 1, 2024
I'm starting out with my personal journey toward a 100% speedrun of Megaman X and I noticed that pretty much every speedrunner on YouTube are using a software that keeps track of time for each level: ...[More]


What is the health bar in Halo games? What is the health bar in Halo games?

Posted On: June 17, 2023
In most Halo games, there's usually a "shield capacity bar" which depletes with damage. When this bar is fully depleted, there's a secondary bar that starts to deplete. What is this ...[More]


I need help in Hogwarts Legacy I need help in Hogwarts Legacy

Posted On: July 15, 2023
Can someone please tell me why these potions are locked and how I can fix it? I have the needed ingredients for all of them but it’s saying it’s locked. I tried looking it up, found nothin...[More]


Is it possible to run RollerCoaster Tycoon 2 in windowed mode? Is it possible to run RollerCoaster Tycoon 2 in windowed mode?

Posted On: April 9, 2024
Is it possible to run RollerCoaster Tycoon 2 in windowed mode?I have Windows 7 and the game works, but since my resolution is bigger than the game can handle, I would prefer to play in windowed mode i...[More]


Are there American cars faster than NASCAR cars in GT5? Are there American cars faster than NASCAR cars in GT5?

Posted On: May 26, 2023
In B specs I'm trying to win an American championship that only allows American cars. I've tried with a Pilot Level 30 and a NASCAR car, but he can't win. . I'm wondering if ther...[More]


Can't connect to ONE Minecraft server but to others I can Can't connect to ONE Minecraft server but to others I can

Posted On: January 22, 2023
For at least a couple of years now I get SUPER strange behavior in Minecraft. I can connect freely to 99.9% of servers and play them without any issues and with a fast connection. Every time I o...[More]


How did GeorgeNotFound use water on leaves without waterlogging it? How did GeorgeNotFound use water on leaves without waterlogging it?

Posted On: January 15, 2023
You know, placing water on leaves will make them waterlogged. But how GeorgeNotFound placed water on a tree in Minecraft death swap video without waterlogging it? Is it possible? If yes, how? I'...[More]