bedrock edition creators
know more about selectors
selectors
Selectors are very simple and are low-mid level expertise. Selectors can be reffered to as:
@s - At self
@p - Closest player
@e - At entity (every entity)
@a - At everyone (excludes entities)
@r - At random (could be entity)
@s - At self
@p - Closest player
@e - At entity (every entity)
@a - At everyone (excludes entities)
@r - At random (could be entity)
learn
Red highlights = Selector
Blue highlights = Command
Green highlights = Specified things in selector
Let's just assume you wanted to kill everyone in your world. You would type:
kill @a
The kill command kills whatever selector you typed, in this case it was @a - At everyone.
Now what if you wanted to kill every entity in your world?
kill @e
Just like before, the kill command runs the specified selector chosen, and in this case it was @e - At entity.
Let's get more in-depth. What if you wanted to kill every husk in your map? Simply do this:
kill @e[type=husk]
This command specifically kills EVERY husk in your world. kill is the command, then you type your selector which would be @e, followed by specifying which type of entity you are trying to kill. Writing an equal sign after "type" just tells Minecraft that the type of entity you want to kill is "husk".
Now what if you wanted to kill only 1 husk? or 2? or more? This is what you should do:
kill @e[type=husk,c=1]
"c" is referred to as "count". It essentially tests for the amount of the specified entity you chose, So if you were to do [type=husk,c=1] then it would basically kill only one husk entity.
Let's jump a little bit further.. let's say you were working on a map and you wanted to kill a husk in a certain specified range?
kill @e[type=husk,r=5,x=0,y=4,z=0]
x, y, z are coordinates. x and z correlate horizontally while y correlates up and down. So let's say you wanted to kill your husk at a range of 5 within the coordinates 0,4,0. so therefore you would type x=0,y=4,z=0.
How about we try something else. What if we did an argument called "not". How do we use "not" in a command?
kill @e[type=!husk]
Simple as that. Putting an exclamation point before typing your entity will exclude that entity and kill everything else
What if the husk had a name above their head? or a tag?
kill @e[type=husk,name=john]
This selector will kill every husk with the name "john". What about full names? Let's try John Doe.
kill @e[type=husk,name="John Doe"]
Whenever you put a space in between a name just remember to quote it so MInecraft can read it properly. What if all the husks in your world had the tag "pickle"?
kill @e[type=husk,tag=pickle]
This also kills every husk with the tag "pickle"
Let's say you want to kill 2 husks in coordinates 1 1 1 with a range of 4 and a tag of pickle with a name of john?
kill @e[type=husk,x=1,y=1,z=1,r=4,tag=pickle,name=john]
Not too hard, right?
Let's try something new. What if we wanted to test if a player was in gamemode survival?
testfor @a[m=s]
This tests for every player in survival.
Blue highlights = Command
Green highlights = Specified things in selector
Let's just assume you wanted to kill everyone in your world. You would type:
kill @a
The kill command kills whatever selector you typed, in this case it was @a - At everyone.
Now what if you wanted to kill every entity in your world?
kill @e
Just like before, the kill command runs the specified selector chosen, and in this case it was @e - At entity.
Let's get more in-depth. What if you wanted to kill every husk in your map? Simply do this:
kill @e[type=husk]
This command specifically kills EVERY husk in your world. kill is the command, then you type your selector which would be @e, followed by specifying which type of entity you are trying to kill. Writing an equal sign after "type" just tells Minecraft that the type of entity you want to kill is "husk".
Now what if you wanted to kill only 1 husk? or 2? or more? This is what you should do:
kill @e[type=husk,c=1]
"c" is referred to as "count". It essentially tests for the amount of the specified entity you chose, So if you were to do [type=husk,c=1] then it would basically kill only one husk entity.
Let's jump a little bit further.. let's say you were working on a map and you wanted to kill a husk in a certain specified range?
kill @e[type=husk,r=5,x=0,y=4,z=0]
x, y, z are coordinates. x and z correlate horizontally while y correlates up and down. So let's say you wanted to kill your husk at a range of 5 within the coordinates 0,4,0. so therefore you would type x=0,y=4,z=0.
How about we try something else. What if we did an argument called "not". How do we use "not" in a command?
kill @e[type=!husk]
Simple as that. Putting an exclamation point before typing your entity will exclude that entity and kill everything else
What if the husk had a name above their head? or a tag?
kill @e[type=husk,name=john]
This selector will kill every husk with the name "john". What about full names? Let's try John Doe.
kill @e[type=husk,name="John Doe"]
Whenever you put a space in between a name just remember to quote it so MInecraft can read it properly. What if all the husks in your world had the tag "pickle"?
kill @e[type=husk,tag=pickle]
This also kills every husk with the tag "pickle"
Let's say you want to kill 2 husks in coordinates 1 1 1 with a range of 4 and a tag of pickle with a name of john?
kill @e[type=husk,x=1,y=1,z=1,r=4,tag=pickle,name=john]
Not too hard, right?
Let's try something new. What if we wanted to test if a player was in gamemode survival?
testfor @a[m=s]
This tests for every player in survival.
hasitem
blank
extra notes
Selectors work with every command using the @ variable.