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]

Hogwarts Legacy 2 how to keep Hogwarts Castle fresh? Hogwarts Legacy 2 how to keep Hogwarts Castle fresh?

Posted On: August 11, 2023
Just finished Hogwarts Legacy and loved it. As we're a 5th-year, it makes sense that a trilogy of games could be planned with us being 6th and 7th-year students. For HL 2, how do you think they...[More]


Are there any achievements - secrets for beating Mega Satan? Are there any achievements - secrets for beating Mega Satan?

Posted On: August 31, 2023
So I've finally collected Key Piece 1 and Key Piece 2 from the Angel Room and the golden door in Dark Room is now open. . Do I need to beat Mega Satan? I mean, I can't find any achievements...[More]


Wands and Brooms Wands and Brooms

Posted On: June 16, 2023
I feel like it would make the game more interesting if choosing your wand had a bigger impact on your abilities. Right now it’s pretty much just a cosmetic choice. Same thing goes for brooms I w...[More]


Whats the most efficient Minecraft mining strategy? Whats the most efficient Minecraft mining strategy?

Posted On: December 28, 2022
When I'm not exploring fresh caves or lands in minecraft, I'm busy trying to find deposits of diamond, gold and iron deep in the earth. So far I've just been digging around just above bedrock on a whi...[More]


Are the Draugr apologizing to me? Are the Draugr apologizing to me?

Posted On: February 4, 2015
Draugr sometimes say "Unstaad Krosis" when attacking. I understand that means "many apologies" in dragon tongue (convo with Paarthurnax). .Does this hint that they are doing something against their wi...[More]


Pretty Morbid painting to have at Hogwarts, don't you think? Pretty Morbid painting to have at Hogwarts, don't you think?

Posted On: April 7, 2023
Also only painting I found that does not move. Question from user TOKERJOKERSWAY at HogwartsLegacyGaming at reddit.com. Answer: If you do revelio in front of one of them there’s a scrol...[More]


What is the purpose of a D Flip-Flop in Minecraft? What is the purpose of a D Flip-Flop in Minecraft?

Posted On: October 23, 2023
Based on the design of the circuit and on the description, what is its purpose? It says that it transfers the state of D to Q. This means it can store one bit. But what is the purpose of a D Fli...[More]


How do you discover combos in Street Fighter V? How do you discover combos in Street Fighter V?

Posted On: April 11, 2023
If I wanted to learn a character in SFV (or any fighting game, really), how should I go about discovering new combos (without the use of videos). Should I be looking at frame data? Question from us...[More]


Are craftable traps a viable option? Are craftable traps a viable option?

Posted On: March 8, 2024
How viable of a weapon are the craftable traps for adventuring?The items I'm talking about:.Caltrops.Poisoned caltrops.Bear trap.Bleeding bear trap.Do they receive bonus damage from any of the basic d...[More]


Why is the firmware of the Xbox Wireless Controller not updated automatically? Why is the firmware of the Xbox Wireless Controller not updated automatically?

Posted On: January 19, 2024
I have now updated all Xbox Wireless Controllers (the first time since years). I didn't know that I had to do this regularly. Is there a reason why this is not done automatically? Updates to games...[More]