Using carrot on a sticks as triggers
From Zedwiki
Revision as of 15:28, 14 July 2017 by Dax23333 (Talk | contribs) (Created page with "Carrot on a sticks are often used as activators for tools in maps. The reason for this is that a scoreboard objective with the type stat.useItem.carrot_on_a_stick will increme...")
Carrot on a sticks are often used as activators for tools in maps. The reason for this is that a scoreboard objective with the type stat.useItem.carrot_on_a_stick will increment whenever the item is right clicked, regardless of any kind of success condition as is common with other items. Blocks for example need to be placed, and food needs to be eaten. But the carrot on a stick becomes a right click detector with this objective set up, making it extremely useful.
This tutorial will cover the construction of a simplified version of the class ability system from dungeondash, which is far too large and complex to properly cover here. It will also feature the ability to have seperate carrot on a sticks that do different things depending on thier lore, creating vast numbers of possible uses for them in a single map. The dungeon dash class system is unfortunatly outdated, and the 1.12 addition of @s would help simplify some of the commands. Other aspects of it will likely be covered in future tutorials.
Commands
This tutorial uses 4 commands.
- scoreboard (tagging, creating objectives, setting scores, testing scores)
- execute
- say
- give
The Tutorial
Firstly we want to setup our objective to track players right clicking a carrot on a stick. There should only be one of these on the server, more are completly unnecessary.
/scoreboard objectives add UseStick stat.useItem.minecraft.carrot_on_a_stick
Set this objective to be displayed on the sidebar to see it working.
/scoreboard objectives setdisplay sidebar UseStick