I'm trying to make an item that, when held, summons a fireball above the player's head. I'm using command blocks to do so, but I've run into some problems. I don't want to use any redstone because that stops working when I go too far away.
/scoreboard players add @a Fireball 1 {SelectedItem:{tag:{display:{Name:"Summon Fireball"}}}}
/execute @a[score_Fireball_min=18,score_Fireball=20] ~ ~ ~ /summon FireworksRocketEntity ~0 ~1 ~0 {Life:1,LifeTime:1,FireworksItem:{id:fireworks,Count:1,tag:{Fireworks:{Explosions:[{Type:0,Flicker:0,Trail:0,Colors:[15627776]}]}}}}
/execute @a[score_Fireball_min=20,score_Fireball=20] ~ ~ ~ /summon Fireball ~ ~2.5 ~ {direction:[0.0,0.0,0.0],ExplosionPower:1}
This part of the code works, but I want to reset the Fireball
score once the fireball has been shot.
/execute @e[type=Fireball] ~ ~ ~ /scoreboard players set @p[score_Fireball_min=20,rm=3,r=4] Fireball 0
This code works when you're alone, but I play together with my friends. The problem is, that if my fireballs passes my friend, who's also summoning fireballs, his score will be reset, too. Instead, I'm trying to make a command that looks for a fireball around the player, and resets the score when the output is negative. It should be something like this;
/execute @a[score_Fireball_min=20] ~ ~ ~ /testfor @e[type=Fireball,r=3]
INV
/scoreboard players set @p Fireball 0
Note that @p
in the second command has to be the same player as @a[score_Fireball_min=20]
in the first command. Again, I don't want to use any redstone here, because the code will stop working when I move too far away.
Does anyone know how I can change the commands above to make them work?