minecraft execute command | Tutorial | Commands #1


Get Embed Codes

Level 23 : Expert Mage
Today I've got the execute command for you guys:
What is the execute command?
The execute command specifies, where a command should be executed from. You can make players kill thereself. And all that stuff.
But a more important role of the command is it, to specify/testfor a player like a testfor command, but used as a "pre"-command.
/execute @a ~ ~ ~ say exp
How to specify players/entities:
There are 2 ways you can specify the executor. 1st behind the @[email protected][email protected][email protected] in square brackets. 2nd you can make a "addon-command", named detect. It is something like a testforblock. It detects a blocks from the position of the executor and only if this it true, then the command after execute WILL be executed.
Way 1:
/execute @a[m=1] ~ ~ ~ The command will be executed from every player in the mode 1 (gamemode: creative).
some other testfors:
r= radius
lm= min. level
team= scoreboard team
type= mobtype (just type in entity spawn name)
name= name of mob/player
rm= min. distance to executor
Way 2:
/execute @a ~ ~ ~ detect ~ ~-1 ~ diamond_block 0 setspawn @p

The second way is more testing for blocks. This command tests, if a player is standing on a diamond block, and if one do, he'll get a checkpoint on the block. Because the execute command defines the player, who is executing, you can set @p in the 2nd command, because the player, who is executing, will be the nearest player.

Lets put both together:
Lets make a highspeedclock. connect this command block to the clock: execute @a[lm=10l] ~ ~ ~ detect ~ ~-1 ~ diamond_block 0 setspawn @p
Now make a comparator coming out from this block going into this one: execute @a[lm=10l] ~ ~ ~ detect ~ ~-1 ~diamond_block 0 xp @p -10l
This command makes the player pay 10 levels for the checkpoint, but only if he does have at least 10.
You could now extend it with a rightclick detector, so you only set checkpoint, if you want to. But thats something, I'll do in the future.

Hope you learned a bit, maybe you now know how to let people say something, what they didn't say.
PS: It's execute [playername] ~ ~ ~ say I am stupid !

Have fun with executing :D
Tags:Set, Spawn, Execute, Special, Commands, Tutorial, Block, Say, Detect, Secret, Testfor, Level, Check, Point

Comments : 0

Join us to post comments.