This is a tutorial on how to make an Energy Bar or otherwise buffing consumable that when purchased can be eaten and will provide additional speed for a limited amount of time using a similar process to CTF’s InvisaBits.
Some parts of this tutorial may be confusing or hard to read, so if you have any questions feel free to ask me and I can help clarify.
Additionally, feel free to add to or modify parts of the system to fit your needs, such as changing how fast or slow the player moves, how quickly the item is drained, or even the item itself!
For this tutorial, I will be making Energy Bars that will give the player 1.25x speed while being eaten.
Along with a Vending Machine, this is what will be required to make the system:
Exploded version showing all wires:
Step 0: Set up a Vending Machine that will provide Energy Bars for whatever price and other settings you would like.
Step 1: Place down a Repeater. Set it to run a task every 0.5 seconds and to start running when receiving on a channel or other means of activation such as a Lifecycle device.
Step 2: Place down a Checker and set it to the following settings:
Set the Checker so it broadcasts when a check passes/fails:
Connect a wire between the two devices so when “Repeater Runs Task” → “Run check”.
Step 3: Place down two Game Overlays. Set one to track Energy Bars and be visible when the game starts. Set the other to a button that is not visible when the game starts, but shows/hides when receiving a message.
Step 4: Place a Movement Meter and set it to drain 1 Energy Bar every second. Set “Use as Default” to Off and “Player Speed…” to 1.00.
Step 5: Connect a wire from the Checker to the Movement Meter where “Check Fails” → “Deactivate Movement Meter”. Connect another wire from the second Game Overlay to the Movement Meter when “Button Pressed” → “Activate Movement Meter”.
Step 6: Place two Speed Modifiers with one set to 1x Speed and the other set to ±1.25x* Speed. The second value can be changed to however fast or slow you would like the players to move, but the first value should stay the same.
"±"1.25x Speed, in this scenario, is used to represent that the value could vary. Usually (in statistics or sciences) the symbol is used to represent that a value could be more or could be less due to potential errors in the data.
Step 7: Connect a wire from the Movement Meter to the 1x Speed Modifier where “Player runs out of movement resource” → “Set player to configured speed”. Additionally, connect a wire from the second Game Overlay to the ±1.25x Speed Modifier where “Button Pressed” → “Set player to configured speed”.
That should be the system complete. Start the game. Firstly, check that there is an Energy Bar icon and a 0 (zero) in the top left and that there is not a button in the bottom right.
Purchase the Energy Bars from the Vending Machine. If all goes well, the Energy Bar icon in the top left should increase and a button should appear in the bottom right saying “Eat Energy Bars”.
Clicking the button should make you faster while the Energy Bar count decreases. When the Bars count reaches zero, the player should be returned to normal speed.
Again, if something doesn’t make sense or there’s an error in my tutorial (most likely), please let me know and I can help resolve it. I hope this helps!