I have written commands to summon custom mobs in the world. I would like to limit how many are summoned. A clock is connected to the command block that summons the mob, how can I limit the number of mob that are in the world at a given time?
This will work in 1.9 only, as it uses the new command blocks. You can try to transfer this into a 1.8 version, but since 1.9 is coming out on Monday, I'm just going to explain in 1.9 terms.
First, change your summon block to a repeat command block (always active) that says this:
/execute @a[score_Count=##] ~ ~ ~
Followed by your summon command (in the same command block). Be sure to change the ## to however many mobs you want at a time, minus one. This will make it so it only summons when there are less than Count mobs in the world.
After that, in the chat, create a new scoreboard objective.
/scoreboard objectives add Count dummy
Then, put a chain command block after the repeat, saying this:
/scoreboard players set @a Count 0
This will reset our counter so we can remake it again every tick
Change TARGET so that is specifically targets your special mob, and nothing else. This will make each one of your mobs add one to our Count.
Now, if you really want this to be 1.8, you can just make it so the three normal command blocks are all on the same clock, activating in the same order designated. However, the 1.8 method may make it so there are one or to more mobs than you want, due to the delay of the clock.
I have written commands to summon custom mobs in the world. I would like to limit how many are summoned. A clock is connected to the command block that summons the mob, how can I limit the number of mob that are in the world at a given time?
Single/Multi User Passcode Protected Vanilla Bank (1.7.4+) V2 http://www.minecraft...ulti-user-bank/
This will work in 1.9 only, as it uses the new command blocks. You can try to transfer this into a 1.8 version, but since 1.9 is coming out on Monday, I'm just going to explain in 1.9 terms.
First, change your summon block to a repeat command block (always active) that says this:
Followed by your summon command (in the same command block). Be sure to change the ## to however many mobs you want at a time, minus one. This will make it so it only summons when there are less than Count mobs in the world.
After that, in the chat, create a new scoreboard objective.
Then, put a chain command block after the repeat, saying this:
This will reset our counter so we can remake it again every tick
Then, put a chain command block that says this:
Change TARGET so that is specifically targets your special mob, and nothing else. This will make each one of your mobs add one to our Count.
Now, if you really want this to be 1.8, you can just make it so the three normal command blocks are all on the same clock, activating in the same order designated. However, the 1.8 method may make it so there are one or to more mobs than you want, due to the delay of the clock.
This should do it! Hope it helps!
This is exactly what I was looking for, thank you!
Single/Multi User Passcode Protected Vanilla Bank (1.7.4+) V2 http://www.minecraft...ulti-user-bank/