Jump to content

loop-block-1 is not a world?


AgentGamerPro

Recommended Posts

im trying to find out how many mobs there are in 1 area, but its thinking that loop-block-1 is a world?

on spawn of a pig:
	loop all blocks in radius 4 around event-entity:
		if loop-block is spawner:
			cancel event
			set {_foundspawner} to true
			set {_spawnerloc} to location of loop-block-1
			loop all blocks in radius 3 of loop-block-1:
				if loop-block-2 is air:
					if block above loop-block-2 is air:
						add loop-block-2 to {_spawnmobloc::*}
			loop all entitys in radius 9 of loop-block-1:
				if loop-entity is not a player:
					add 1 to {_counter}
	if {_counter} is greater than or equal to 5:
		broadcast "&cToo many mobs in 1 area!"
		stop
	else:
		...

 

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

Are you just trying to stop mob from spawning if there is too many in that one area? Try using this. I got no errors with it but I haven't tested it so not sure if it works.

on spawn of pig:
  set {_size} to amount of entities in radius 5 around event-location where [input is not a player]
  if {_size} > 5:
    cancel event
    broadcast "&cToo many mobs in 1 area!"

 

  • Thanks 1

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

7 hours ago, _Tarna_ said:

Are you just trying to stop mob from spawning if there is too many in that one area? Try using this. I got no errors with it but I haven't tested it so not sure if it works.




on spawn of pig:
  set {_size} to amount of entities in radius 5 around event-location where [input is not a player]
  if {_size} > 5:
    cancel event
    broadcast "&cToo many mobs in 1 area!"

 

so umm...2021-03-26_21_08_37.thumb.png.b4b9a21e4b2d8de6a87faadd8b1d718e.pngHere my new skript:

on spawn of a pig:
	loop all blocks in radius 4 around event-entity:
		if loop-block is spawner:
			cancel event
			set {_foundspawner} to true
			set {_spawnerloc} to location of loop-block-1
			loop all blocks in radius 3 of loop-block-1:
				if loop-block-2 is air:
					if block above loop-block-2 is air:
						add loop-block-2 to {_spawnmobloc::*}
			set {_size} to amount of entities in radius 9 around loop-block-1 where [input is not a player]
			if {_size} > 5:
				broadcast "&cToo many mobs in 1 area!"
				stop
		else:
			...

i only want it to spawn like 2 zombies not 200.

EDIT: I fixed it, i had to remove the "else:" Thanks @_Tarna_

Edited by AgentGamerPro

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...