Execute command os used when you want to run a command as someone or at a special place, and when you want to store the result or the success of the following command
Maybe you can create a scoreboard that will store player position, and if the position change drastically, it will be because the player has teleport, and then you test if he is on your land.
For this, you can set a range to your base, and have this command :
/execute positioned x y z as @a[distance=..[range]] at @s if entity [pseudo][distance=..1] run tp x' y' z'
You have to change x y z by the coordinate of the middle of your base, [range] by the range of your base, [pseudo] by your pseudo, and x' y' z' where you want the player to be teleported.
If you're in your base and someone is at 1 block or less of you, it will teleport him
Don't know if it will work, I haven't try it, tell me if something is wrong. (you can test it by summon an armor_stand, change "@a[distance=..[range]]" in the command by "@e[distance=..[range], type=armor_stand]" and tp the armorstand on you)
your command is not wright, here is the good way :
/execute if entity @e[distance=..3,type=minecraft:item,nbt={Item:{id:"minecraft:sea_pickle",tag:{display:{Name:'"Key"'}}}}] run ...
Also, I recommand you to give your item a custom tag, since it's impossible in vanilla to change tag, 'cause if the player just rename a sea pickles, your command will work.
execute as @e[tag=skeleton_horse] run function datapack:save_coords
save_coords.mcfunction :
scoreboard players add @s paused 1
execute store result score @s save_x run data get entity @s Pos[0]
execute store result score @s save_y run data get entity @s Pos[1]
execute store result score @s save_z run data get entity @s Pos[2]
execute store result score @s save_rx run data get entity @s Rotation[0]
execute store result score @s save_rz run data get entity @s Rotation[1]
every tick function :
execute as @e[scores={paused=1}] run function datapack:tp
tp.mcfunction :
execute store result entity @s Pos[0] int 1 run scoreboard players get @s save_x
execute store result entity @s Pos[1] int 1 run scoreboard players get @s save_y
execute store result entity @s Pos[2] int 1 run scoreboard players get @s save_z
execute store result entity @s Rotation[0] float 1 run scoreboard players get @s save_rx
execute store result entity @s Rotation[1] float 1 run scoreboard players get @s save_rz
1) You have to set a trigger scoreboard like this :
scoreboard objectives add SetHome trigger
scoreboard objectives add Home trigger
scoreboard players enable @a Home
scoreboard players enable @a SetHome
2) You set the trigger function to add 1 to score when the player run the command :
trigger Home add 1
trigger SetHome add 1
3) In your every_tick_function, you write that if a player use the SetHome trigger function, it save his coordinates, and if he use the Home trigger, it will tp him.
every_tick_function.mcfunction :
execute as @a[scores={SetHome=1}] run function datapack:set_home
execute as @a[scores={Home=1}] run function datapack:home
scoreboard players reset @a set_home
scoreboard players reset @a home
set_home.mcfunction :
scoreboard objectives add save_x dummy
scoreboard objectives add save_y dummy
scoreboard objectives add save_z dummy
scoreboard objectives add save_rx dummy
scoreboard objectives add save_rz dummy
execute store result score @s save_x run data get entity @s Pos[0]
execute store result score @s save_y run data get entity @s Pos[1]
execute store result score @s save_z run data get entity @s Pos[2]
execute store result score @s save_rx run data get entity @s Rotation[0]
execute store result score @s save_rz run data get entity @s Rotation[1]
home.mcfunction :
summon area_effect_cloud ~ ~ ~ {Tags:["move"]}
execute store result entity @e[tag=move,limit=1] Pos[0] int 1 run scoreboard players get @s save_x
execute store result entity @e[tag=move,limit=1] Pos[1] int 1 run scoreboard players get @s save_y
execute store result entity @e[tag=move,limit=1] Pos[2] int 1 run scoreboard players get @s save_z
execute store result entity @e[tag=move,limit=1] Rotation[0] float 1 run scoreboard players get @s save_rx
execute store result entity @e[tag=move,limit=1] Rotation[1] float 1 run scoreboard players get @s save_rz
tp @s @e[limit=1,tag=move]
kill @e[tag=move]
With that, if the player want to run the set_home command, he can do /trigger Set_Home, and if he want to run the home, command, he can do /trigger Home, without being OP.
I haven't tested it, so tell me if something is wrong, I never used trigger before ^^'
You create a dummy scoreboard that will count how many tick the player stood on the position
(once) : /scoreboard objectives add TimePassed
(every tick) : /scoreboard players add @a[x=0,y=0,z=0,distance=..1] Time Passed 1
(if you want the counter to reset if the player is not on the position) : /scoreboard reset @a[x=0,y=0,z=0,distance=1..] TimePassed
(every tick) : /execute as @a[scores={TimePassed=200}] run say "I stood 200 tick in there... So what now?"
I haven't test the code, so tell me if something is wrong.
I think a good solution will be to use function instead of command block.
I don't know what you want to do, but 500*40 commands blocks is so much !
With function, you can just change command to call under conditions, and so have some commands in your function that will change without touching or copied the rest of yout function.
If you can't, I have no idea what you can do, sorry :s
1
Execute command os used when you want to run a command as someone or at a special place, and when you want to store the result or the success of the following command
0
Hey, you just have to use "at" in an execute command like this :
1
Maybe you can create a scoreboard that will store player position, and if the position change drastically, it will be because the player has teleport, and then you test if he is on your land.
1
For this, you can set a range to your base, and have this command :
You have to change x y z by the coordinate of the middle of your base, [range] by the range of your base, [pseudo] by your pseudo, and x' y' z' where you want the player to be teleported.
If you're in your base and someone is at 1 block or less of you, it will teleport him
Don't know if it will work, I haven't try it, tell me if something is wrong. (you can test it by summon an armor_stand, change "@a[distance=..[range]]" in the command by "@e[distance=..[range], type=armor_stand]" and tp the armorstand on you)
0
your command is not wright, here is the good way :
Also, I recommand you to give your item a custom tag, since it's impossible in vanilla to change tag, 'cause if the player just rename a sea pickles, your command will work.
1
For the arrow, you can just make the arrow with NoGravity, and give it a motion, just one time or every tick, like you want, it will be easier.
1
We can't figure what's the problem with only that infos.
Send us the command you write in, check if you are on "unconditionnal" mode.
0
For what you want, you have to use "distance" instead of dx.
Like this, it would run the command for all the bee with the good name at maximum 0.1 block of the armor stand.
I suggest you to use tag instead of custom names for checking entities, because it's easy to rename an entity.
0
Oups my bad, don't see the "#"
0
Pressure_plate don't have a "s" at the end.
0
If there no other way, you can spawn an AEC at the horse position, and tp it on the AEC, then when you push the button, kill it.
first time button pushed :
every tick function :
second time button pushed :
But that will only work with one skeleton at a time.
If you have more, you can store the position where it was when you pushed the button, and tp on it until you pushed the button a sencond time.
scoreboard create :
First time button pushed :
save_coords.mcfunction :
every tick function :
tp.mcfunction :
second time button pushed :
I haven't tried these commands anyways, so maybe there are some errors ^^
0
You can use a trigger function.
Here how to do it :
1) You have to set a trigger scoreboard like this :
2) You set the trigger function to add 1 to score when the player run the command :
3) In your every_tick_function, you write that if a player use the SetHome trigger function, it save his coordinates, and if he use the Home trigger, it will tp him.
every_tick_function.mcfunction :
set_home.mcfunction :
home.mcfunction :
With that, if the player want to run the set_home command, he can do /trigger Set_Home, and if he want to run the home, command, he can do /trigger Home, without being OP.
I haven't tested it, so tell me if something is wrong, I never used trigger before ^^'
0
Why do you write "minecraft:execute"?
You just have to write "/execute"
1
All you need is to use scoreboard.
You create a dummy scoreboard that will count how many tick the player stood on the position
I haven't test the code, so tell me if something is wrong.
0
I think a good solution will be to use function instead of command block.
I don't know what you want to do, but 500*40 commands blocks is so much !
With function, you can just change command to call under conditions, and so have some commands in your function that will change without touching or copied the rest of yout function.
If you can't, I have no idea what you can do, sorry :s