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]

Damp wall ignored in Dwarf Fortress why? Damp wall ignored in Dwarf Fortress why?

Posted On: April 26, 2023
I took as granted that Miners always detected damp walls and stopped mining in these cases. But a miner did not detect, or just decided to ignore, an obvious damp wall, and created a leak that led ...[More]


Hogwarts Legacy Beginner Tips Hogwarts Legacy Beginner Tips

Posted On: April 21, 2023
Hey! Orderd a ps5 yesterday with hogwarts legacy and it will arrive today. Are there any important things i should know about the game? (Without spoilers). And is the game long? Are the most glitch...[More]


Where do I sell Specials? Achievement: Arent you Special in Farmville? Where do I sell Specials? Achievement: Arent you Special in Farmville?

Posted On: April 13, 2023
How can I sell the specials? I would like to get the Google Play achievement but my selling board does not have a "special". I am level 52. I understand I may be lacking some requireme...[More]


How many types of charging ports do Nintendo handhelds have? How many types of charging ports do Nintendo handhelds have?

Posted On: June 17, 2023
I'm sorting through my old Nintendo handhelds and have found that many of them use different charging cables. I've seen at least four different types:. Nintendo Switch & Switch Lite. ...[More]


Is there a way to tell a Steam shortcut to open in big picture mode? Is there a way to tell a Steam shortcut to open in big picture mode?

Posted On: June 15, 2023
I have a monitor and a TV side by side. Sometimes I want to game from my couch and sometimes I want to sit and game at the computer. When I'm gaming at my desktop I don't have the TV on. Wh...[More]


Why can't I catch a Thestral in Hogwarts Legacy? Why can't I catch a Thestral in Hogwarts Legacy?

Posted On: March 5, 2023
I cannot for the life of me seem to catch a thestral. Any tips? Question from user Own_Doctor9472 at HogwartsLegacyGaming at reddit.com. Answer: I just use leviosa and then the nab sack. Neve...[More]


What happens if I defeat an enemy and run out of HP at the same time? What happens if I defeat an enemy and run out of HP at the same time?

Posted On: January 18, 2023
What happens if I defeat an enemy and run out of HP at the same time? For example, if you use a self damaging attack like Boomerang or if you take damage form attacking an enemy with Thorns. Questi...[More]


How much room do I need to play Ring Fit Adventure? How much room do I need to play Ring Fit Adventure?

Posted On: April 8, 2024
I'm interested in Ring Fit Adventure, but given the layout of my room, I have a relatively narrow strip of space between the Dresser/TV and the end of my bed. Is this enough room to successfully perfo...[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]


How much grain can a giant node produce with the production per 25 perk? How much grain can a giant node produce with the production per 25 perk?

Posted On: June 13, 2023
The total amount of stuff from a node can be increased by getting perks. Here are two such perks;. Mold supply: Increase the production of grain by +1 (or +2). Grain harvest: Increase the produc...[More]