I tested the whole thing, simplified a bit and this worked perfectly for me (1.16.1) :
Save pos :
scoreboard players enable @a savePos
execute as @a[scores={savePos=1..}] store result score @s posx run data get entity @s Pos[0]
execute as @a[scores={savePos=1..}] store result score @s posy run data get entity @s Pos[1]
execute as @a[scores={savePos=1..}] store result score @s posz run data get entity @s Pos[2]
execute as @a[scores={savePos=1..}] store result score @s rx run data get entity @s Rotation[0]
execute as @a[scores={savePos=1..}] store result score @s rz run data get entity @s Rotation[1]
scoreboard players reset @a[scores={savePos=1..}] savePos
Load pos :
scoreboard players enable @a loadPos
execute as @a[scores={loadPos=1..}] at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Tags:["loadPos"]}
execute as @a[scores={loadPos=1..}] store result entity @e[tag=loadPos,limit=1] Pos[0] double 1 run scoreboard players get @s posx
execute as @a[scores={loadPos=1..}] store result entity @e[tag=loadPos,limit=1] Pos[1] double 1 run scoreboard players get @s posy
execute as @a[scores={loadPos=1..}] store result entity @e[tag=loadPos,limit=1] Pos[2] double 1 run scoreboard players get @s posz
execute as @a[scores={loadPos=1..}] store result entity @e[tag=loadPos,limit=1] Rotation[0] float 1 run scoreboard players get @s rx
execute as @a[scores={loadPos=1..}] store result entity @e[tag=loadPos,limit=1] Rotation[1] float 1 run scoreboard players get @s rz
execute as @a[scores={loadPos=1..}] run tp @s @e[tag=loadPos,limit=1]
scoreboard players reset @a[scores={loadPos=1..}] loadPos
The teleportation gets perfectly well, and all chained command blocks are on chain-unconditional-always active
I maybe didn't understand the full thing, but basically, if you have X,Y and Z score values that are the coords you want the box to be teleported at, you simply have to copy X score into box's Pos[0], Y score to Pos[1] and Z to Pos[2].
Thenthe game will move the box at its new position, as if it was teleported.
Well if you already programmed a space invaders game, it is pretty much the same.
Because if you want to create a space invaders game in minecraft, there is no other way than entirely build the components of the game as they would be on a real console.
In order to make the arrows go up, you will need to increase their position each "game tick" through an emulated game loop
Also, to get asteroids/ship health, you must store their health value in some data storage place (like storage file), and decrease their health when you detect they get hit.
Well the thing is that's impossible (And when I say this, I really know what I'm talking about)
The difference between a /clear and nbt{} selector is that the nbt{} selector searches precisely what you write in it, while the /clear can convert "#things" into "[thing1, thing2, thing3]" and stuff like that
For example, when you want to look for a player on ground, you can use this :
/execute if entity @a[nbt={OnGround:1b}]
However, if you forget the "b" after the value, the game could not find any player with the exactly-written "OnGround:1" tag.
This shows there is not any kind of translation in nbt{} selector (cause if they don't even support missing data type, they won't convert item tags neither)
With my current knowledge, the only trick I see for now is this :
-Store the number of #boats into a player's inventory using /clear with 0 count
-Copy the item frame's item into player's inventory
-Store again the number of #boats in player's inventory
-If the 2 numbers are different, that means the item frame contains a boat
However, it was only "skating" when I set the horse to NoAI:1. If I set the skeleton passenger to NoAI:1 (no matter if the horse was or not), it totally froze.
I guess when a horse is rod, all the horse's movement is controlled by the passenger. Probably there's still some issue with that.
Actually, probably not, but since one of the functions has 1800 commands that will be executed in a single, probably longer, tick, I think running them with set names will be easier on the TPS
......................
"I'm a beginner but I am already on a 1800-commands function"
Hmmm well that could be a big piece of learning for you, but if you manage to make it, so you could only get better from that...
I don't know your level of commands so maybe there will be things you don't understand ; feel free to ask for deeper explanations!
I think I'll do one post per question so it would look better...
1. Summon asteroids at random X
3 steps in there :
A. Summon the asteroid
B. Generate a random X value
C. Copy the randomized X value into asteroid.
A. Summon the asteroid
Summon the asteroid at top right of the "screen" (it must have its final YZ values, the X value doesn't matter yet)
B, Generate a random X value
...Well here, it is not only commands ; it also requires some logic knowledge.
So let's say your screen goes from X=30 to X=39 and there are 10 columns. You'd want a number , like 30, 31, 32,... to 39.
In order to do that, the best way takes 3 steps :
1. Make minecraft generate a random value, and store it into a score
2. Fit the value on your needs
1. Generate random value and store it into a score
Here, you need the game to generate a random value that you could copy into a score. A good way is to summon an entity and copy one of its numerical UUID value, into a dummy player's score (let's call this value [Random score])
2. Fit the value on your needs
Here, you basically first want to operate a modulo in order to get a value from 0 to 9, then add 30 to it. This can be done with dummy players' scores. Here are the operations :
[Random score] % 10 = [Result]
[Result] + 30 = [Final X coord]
This [Final X coord] value should be stored on a dummy player's score
And there, you have the randomized X coords. You can then apply it to the asteroid.
C. Copy the randomized value into Asteroid's X
Now that you got a random X value for your asteroid, you only have to apply it!
On step A, you summoned the asteroid so it had already the correct Y and Z positions.
You will now copy the [Final X coords] into the asteroid (armor stand)'s Pos[0] using /data modify. Make sure you store it as a "double" data type.
And now the asteroid should be right on its randomized position.
And so this should be enough for you to generate random asteroids positions when you want to...
I hope (but doubt) my explanations were clear enough... Feel free to ask if you want to!
1
Last try... could you store your command blocks into a structure file and send it on the forum?
This way, we could look at your setup
0
If you want to improve the command, you don't even need to use /execute to target coords. This command is enough :
(not sure for the "name=Joacotatu", though that should be close)
1
Well of course, you can... It will work no matter what entity you coose, as long as youo don't target the same entity twice
1
Yeah, it works only once, as minecraft only generate an uuid for an entity when it appears.
You'll have to summon a new entity for each random nmber
1
For the arrow bouncing off the armor stands, you can set your armor stands {Marker:1}, which means they get "no hitbox"
I don't know if they could move while marked, though...
Or you can simply replace your arrows by invisible entities, and make some particles around them
1
You might have something wrong, you could try these :
1. Check your command blocks
2. Try to save pos again, then load pos once more
1
Well when you summon an entity, it gets an UUID tag, which contains 4 numbers.
You can target one of these numbers and then copy it into a score.
For example, this command will target an area_effect_cloud's UUID value, and copy it into _score_ (you must summon an area_effect_cloud first)
This number can get from ~-2 000 000 000 to ~2 000 000 000
1
I tested the whole thing, simplified a bit and this worked perfectly for me (1.16.1) :
Save pos :
Load pos :
The teleportation gets perfectly well, and all chained command blocks are on chain-unconditional-always active
0
I maybe didn't understand the full thing, but basically, if you have X,Y and Z score values that are the coords you want the box to be teleported at, you simply have to copy X score into box's Pos[0], Y score to Pos[1] and Z to Pos[2].
Thenthe game will move the box at its new position, as if it was teleported.
1
Well if you already programmed a space invaders game, it is pretty much the same.
Because if you want to create a space invaders game in minecraft, there is no other way than entirely build the components of the game as they would be on a real console.
In order to make the arrows go up, you will need to increase their position each "game tick" through an emulated game loop
Also, to get asteroids/ship health, you must store their health value in some data storage place (like storage file), and decrease their health when you detect they get hit.
0
Well the thing is that's impossible (And when I say this, I really know what I'm talking about)
The difference between a /clear and nbt{} selector is that the nbt{} selector searches precisely what you write in it, while the /clear can convert "#things" into "[thing1, thing2, thing3]" and stuff like that
For example, when you want to look for a player on ground, you can use this :
/execute if entity @a[nbt={OnGround:1b}]
However, if you forget the "b" after the value, the game could not find any player with the exactly-written "OnGround:1" tag.
This shows there is not any kind of translation in nbt{} selector (cause if they don't even support missing data type, they won't convert item tags neither)
With my current knowledge, the only trick I see for now is this :
-Store the number of #boats into a player's inventory using /clear with 0 count
-Copy the item frame's item into player's inventory
-Store again the number of #boats in player's inventory
-If the 2 numbers are different, that means the item frame contains a boat
This is an... ugly way.
For this one, I'd give up on hardcoding
0
I tried and it and even on 1.15, I got this bug.
However, it was only "skating" when I set the horse to NoAI:1. If I set the skeleton passenger to NoAI:1 (no matter if the horse was or not), it totally froze.
I guess when a horse is rod, all the horse's movement is controlled by the passenger. Probably there's still some issue with that.
Have you also disabled the skeleton rider's AI?
1
There's something I don't really inderstand... If player gets a savePos score of 1, its position gets stored 20 times, right?
And I guess same for loadPos
Why won't you only store them once?
And also, what minecraft version are you on? you are using rx and ry tags, which have been replaced by Rotation[0,1] tags on more recent versions
0
Well for targetting purposes, names can always be remplaced by numerical values, but of course, it entirely depends on what you need.
......................
"I'm a beginner but I am already on a 1800-commands function"
Am I even talking to the same person?
1
Hmmm well that could be a big piece of learning for you, but if you manage to make it, so you could only get better from that...
I don't know your level of commands so maybe there will be things you don't understand ; feel free to ask for deeper explanations!
I think I'll do one post per question so it would look better...
1. Summon asteroids at random X
3 steps in there :
A. Summon the asteroid
B. Generate a random X value
C. Copy the randomized X value into asteroid.
A. Summon the asteroid
B, Generate a random X value
C. Copy the randomized value into Asteroid's X
And so this should be enough for you to generate random asteroids positions when you want to...
I hope (but doubt) my explanations were clear enough... Feel free to ask if you want to!