4

Context:

I have a bunch of scheduled tellraw commands which give the players gameplay tips, which is useful for those who are new to our server's modpack.

Now that some players are accustomed to the modpack and don't need the tips, I want to give them the option to disable these tips through a simple /trigger command, which will give them a "DisableTips" tag. The scheduled tellraw commands for tips are written like this:

/tellraw @a[tag=!DisableTips] (example gameplay tip here)

So in conclusion, if they have the DisableTips tag, they will be excluded from receiving tips.

How can I allow players to give themselves the DisableTips tag through a trigger command?

2 Answers 2

3

Trigger commands are fairly easy to use and set up, but here is a quick run through:

  1. You need a trigger type objective that players can use, let's say you call it DisableTips.
  2. For players to be able to run /trigger on an objective, you need to /scoreboard ... enable the objective for those players.
  3. Check for changes in this scoreboard. There are multiple ways to do this, also depends on how you expect players to trigger this.

So, let's assume that you just want players to be able to run /trigger DisableTips to add the corresponding tag. That means in concrete terms you need the following commands.

Setup:

scoreboard objectives add DisableTips trigger

Repeating-chain of commandblocks (or in a function), all always active and unconditional

scoreboard players enable @a DisableTips

tag @a[scores={DisableTips=1..}] add DisableTips
tellraw @a[scores={DisableTips=1..}] ["Tips have been disabled"]
scoreboard players reset @a[scores={DisableTips=1..}]

With a few changes you can make this a toggle to turn it back on at will, or change it to use the value in the scoreboard objective instead of adding another tag on top of the scoreboard objective.

1
  • How can I turn this into a toggleable command?
    – D. Tunus
    Jul 14 at 15:33
-1

If you have a lobby of some kind you could use two command blocks: one that enables tips for @p, one that disables it. If you don't like that solution, you could write up a mod that registers a custom command that toggles the tag on the player that runs it. (Contact me via a GitHub issue in this repo if you decide you want a mod; I'd be happy to do that for you. Just let me know which modloader you are using.)

# Command to enable tips for the nearest player.
tag @p add DisableTips

# Command to disable tips for the nearest player.
tag @p remove DisableTips
1
  • My bad, I didn't read the question carefully enough before answering. Sorry for the unhelpful answer.
    – AdamRaichu
    May 30 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .