How To Use Equipment To Create Great Games, Part 10: Triggering Cooldowns
We’re breaking down some of the many uses of the On-Equip feature in this 11-part series.
Welcome back with another entry in our ongoing series exploring the power of The Sandbox Game Maker’s “On-Equip” feature.
For those new to the series, On-Equip is a versatile tool that enhances Player experiences by allowing items to trigger specific actions or effects when equipped. By integrating On-Equip mechanics, creators can introduce new levels of interactivity, making gameplay more dynamic and engaging.
In this installment, we’ll dive into how creators can use On-Equip to Trigger Cooldowns.
Ready to learn more? Update to the latest version of Game Maker and prepare to see what’s possible with On-Equip!
This article is part four of an 11-part series about using On-Equip. To read more, click one of the links below:
- Part 1: NPC Interactions
- Part 2: Toggling Between States
- Part 3: Hex or Impede Players
- Part 4: Trigger Unique Interactions
- Part 5: Create Class-Based Systems
- Part 6: Avoid Environmental Hazards
- Part 7: Crowd Events
- Part 8: Quests
- Part 9: Trigger Power Ups
- Part 10: Triggering Cooldowns
Using Equipment to Trigger Cooldowns
Power-ups are a classic game mechanic that temporarily or permanently enhance Player abilities. While we previously focused on items that permanently enhanced Player abilities in Part 9 of this series, now we will shift the focus to temporary enhancements.
While the On-Equip feature can be used to let Players activate a Power-Up or heal themselves with a button press, triggering cooldowns prevents Players from using the ability repeatedly. This adds a level of strategy, as Players will have to decide when and how often to use the effect. Whether it’s restoring health in a tough boss fight or boosting speed to escape danger, timing becomes a critical element of gameplay.
Popular in both RPGs and shooters, this mechanic opens up many new scenarios for Players.
How This Could Appear in Your Game or Experience
Players may encounter Power-Ups with Cooldowns similarly to the ways they would encounter Power-Ups without Cooldowns. These include:
- Exploring the World: Items could be hidden in treasure chests, scattered throughout dungeons, or earned through exploration.
- Defeating Enemies: Certain powerful foes might drop unique gear that boosts attributes when equipped.
- Completing Quests: Power-Ups could be rewards for completing specific missions or challenges.
- Purchasing from Shops: Players could buy items from in-game merchants or craft equipment that grants special abilities.
Regardless of how they acquire the gear, once equipped, the benefits should be immediately apparent, allowing the Player to continue their adventure with newfound strength. Attributes that can currently be affected using Power-Ups include:
- Health can heal or damage the Player.
- Attack Power can increase or decrease attack damage.
- Damage Resistance affects how much damage the Player takes.
- Oxygen influences how quickly oxygen is consumed.
- Speed affects how fast or slow the Player moves.
Stay tuned for additional attributes that may be able to receive Power-Ups.
How to Implement
The following flow will closely mimic the implementation order for Power-Ups, featured in Part 9.
Start by creating a piece of equipment that players can collect in your game. This item should be marked as collectible and set to trigger an On-Equip” message. Once this message is triggered, use it in the Rule System to begin applying buffs or effects. “Buff” refers to the positive status effect or change that enhances equipment, making it stronger or more effective. In this context, when we say “buff,” we are referring to the equipment’s Power-Ups. The two terms can be used interchangeably.
Next, set up a Message Rule in the Rule System. Create a “Send Message” rule, selecting the On-Equip message from the equipment. Set up different check messages if you want multiple pieces to have different effects when equipped.
Once the message rule is in place, apply Power-Ups to the equipment. The On-Equip feature can currently affect several attributes, including health, attack power, damage resistance, oxygen depletion rate, and speed. When setting these attributes, they will be highlighted in the message system, allowing you to fine-tune the effects to match your game’s needs.
Then, create a Variable that keeps track of whether the item is equipped or not. Use a Math Rule to add “1” to that Variable whenever the equip message is triggered.
Next, set up a Timer Rule with its own Trigger Message, and create a separate Variable to handle the countdown. This timer kicks off after the Player uses their ability, like healing. Let’s say you call this message “HEALTH.”
Now for the actual button press. Set up a Trigger Value rule that responds to a button press (like a number key or mouse click). That rule should check two things: first, is the item equipped? And second, is the cooldown timer at zero?
You’ll do this with a pair of Compare Value rules. The first Compare checks if the equipment variable equals one, confirming that the Player has it equipped. If that’s true, it moves on to the second Compare, which checks whether the cooldown timer variable is zero. If both conditions are met, the ability activates — you send the “HEALTH” message and apply whatever effect you want, like restoring 50% health or giving a temporary stat boost. The cooldown timer starts ticking from there, preventing the ability from being used again until time’s up.
If you get lost at any point or need more detailed information, check out the GitBook.
Potential Uses for Power-Ups
A Player finds and equips a potion pack. Every time they press the “1” key, they can heal themselves, but only once every 30 seconds. They now have to think carefully about when to use it, especially in the middle of a tough battle!
In another case, a Player has to cross a stretch of lava. Luckily, they’re fully geared up with protective equipment. A quick button press boosts their defense for 30 seconds, giving them just enough time to make it across. Without the gear, they’d be toast!
Unleash Your Creativity with On-Equip
Cooldowns offer a world of possibilities, allowing you to create exciting game worlds that Players keep revisiting. By strategically utilizing the many On-Equip mechanics, you can introduce new layers of interactivity and immersion into your creations.
Get started today and discover the transformative potential of the On-Equip feature in shaping your gaming experiences in The Sandbox. Stay tuned for the final chapter of this 11-part series, Part XI: Using Attributes on Player Equipment to Enhance Gameplay!
