• 1

    posted a message on Spectate random player at interval. 1.15

    For detecting when to run the command an reset the score, one option would be to use "/execute if score..."

    The resulting command sequence might look something like this:


    /scoreboard players add Timer YourScore 1


    /execute if score Timer YourScore matches 1 as @a[gamemode=spectator] run spectate @r


    /execute if score Timer YourScore matches 200.. run scoreboard players set Timer YourScore 0


    Another option would be to use the "scores" argument in your target selectors:


    /scoreboard players add @a[gamemode=spectator] YourScore 1


    /execute as @a[gamemode=spectator,scores={YourScore=1}] run spectate @r


    /scoreboard players set @a[gamemode=spectator,scores={YourScore=200..}] YourScore 0


    Let me know if this dose what you need

    Posted in: Commands, Command Blocks and Functions
  • 2

    posted a message on Hardcore Revival Command

    This isn't exactly what you proposed, but a potentially easier way to approach reviving would be to detect if a netherstar item is within a certain radius of the spectating player, then change the player's game mode and remove the netherstar. For game play purposes, I'd also summon some particles around spectators so the living players can see where they are.


    Sequence of commands:


    execute at @e[type=item,nbt={Item:{id:"minecraft:nether_star"}}] run tag @a[gamemode=spectator,distance=..4,sort=nearest,limit=1] add Reviving


    gamemode survival @a[tag=Reviving,gamemode=spectator]


    execute at @a[tag=Reviving,gamemode=survival] run kill @e[type=item,nbt={Item:{id:"minecraft:nether_star"}},sort=nearest,limit=1]


    tag @a remove Reviving


    Here's my personal take on the ghost particles:


    execute as @a[gamemode=spectator] at @s anchored eyes run particle minecraft:sneeze ^ ^ ^ .01 .01 .01 .025 1

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Function minecraft:tick not running every tick

    is the function in the function listed in the tick.json file in the tags folder? If not, then it needs to be. Placing this tags folder in <datapack name>/data/minecraft should make the function you want run every tick. If you need, you can have more or different functions run every tick by adding them to the list in the json file. You could also have functions activate when the data pack loads as well by adding their names to the "load" file.


    Let me know if this works or if there are any problems.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Testfor/Execute problems 1.14

    All you're missing is the "distance" part of the target selector. /execute if entity @a[x=35,y=67,z=9,distance=..1] should do the trick. You can change the distance value if you want to increase the range.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on How to detect if mob takes damage (1.14)?

    The same concept holds. Use the target selector @e[tag=YourMobTag,nbt={HurtTime:10s}]. It doesn't have to look exactly like this to work, but for what you're doing, it's probably the best.


    The full command would look something like this.

    /execute at @e[tag=YourMobTag,nbt={HurtTime:10s}] run playsound ...

    Posted in: Commands, Command Blocks and Functions
  • To post a comment, please or register a new account.