This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Hi, how do I count number of players in a set area (square)?
Im making a maze which spawn more mobs when more players are inside, when there are 2/4/6 players inside
Ive tried /execute if entity@e[type=player,distance=..5,limit=2] run......, doesnt work
Quote from ventusstrife001» Hi, how do I count number of players in a set area (square)? Im making a maze which spawn more mobs when more players are inside, when there are 2/4/6 players inside Ive tried /execute if entity@e[type=player,distance=..5,limit=2] run......, doesnt work
First, make a scoreboard. Example:
/scoreboard objectives add kermit dummy
Then, run these chained commands in the corresponding order:
/execute as @a[x=123,y=24,z=-38,dx=30,dy=10,dz=30] run scoreboard players add kys kermit 1
(Note: The above command detects players from x:123,y:24,z:-38 to x:153,y:34,z:-8. As you can see, it's a 30x10x30 box)
/execute if score kys kermit matches 2 run <your command>
/execute if score kys kermit matches 4 run <your command>
/execute if score kys kermit matches 6 run <your command>
/scoreboard players set kys kermit 0
Well, for sure you don't want to copy my commands exactly, but that's the rough idea to do it.
Thanks, can I replace Kermit with PlayerNo, and kys with No?
will
"/execute if score kys kermit matches 2 run [/b][/i]<your command>" execute when 3 players detected?
Hi, how do I count number of players in a set area (square)?
Im making a maze which spawn more mobs when more players are inside, when there are 2/4/6 players inside
Ive tried /execute if entity@e[type=player,distance=..5,limit=2] run......, doesnt work
First, make a scoreboard. Example:
/scoreboard objectives add kermit dummy
Then, run these chained commands in the corresponding order:
/execute as @a[x=123,y=24,z=-38,dx=30,dy=10,dz=30] run scoreboard players add kys kermit 1
(Note: The above command detects players from x:123,y:24,z:-38 to x:153,y:34,z:-8. As you can see, it's a 30x10x30 box)
/execute if score kys kermit matches 2 run <your command>
/execute if score kys kermit matches 4 run <your command>
/execute if score kys kermit matches 6 run <your command>
/scoreboard players set kys kermit 0
Well, for sure you don't want to copy my commands exactly, but that's the rough idea to do it.
Thanks, can I replace Kermit with PlayerNo, and kys with No?
will
"/execute if score kys kermit matches 2 run [/b][/i]<your command>" execute when 3 players detected?