Sep 16, 2024 - min read
CREATE
How To Use Equipment To Create Great Games, Part 4: Trigger Unique Interactions
Welcome back to our series chronicling the many uses of The Sandbox Game Maker’s “On-Equip” feature.
If you’re joining us for the first time, On-Equip is a versatile tool built into the Collectable Component that enables creators to enhance player experiences through interactive gameplay mechanics. On-Equip allows items, when equipped by players, to trigger specific actions or effects within the game world. By strategically incorporating On-Equip mechanics, creators can introduce new layers of interactivity and engagement.
Today, we’re examining how On-Equip can trigger unique interactions.
Ready to learn more? Update to the latest version of Game Maker and prepare to see what’s possible with On-Equip!
Using Equipment to Trigger Unique Interactions
In genres like farm simulations or role-playing games, obtaining certain accessories to interact with the world around you can sometimes be necessary. Work gloves might be needed before smithing a sword. A magical amulet might be worn to access hidden areas.
This game mechanic requires the player to wear specific gear to interact with otherwise inaccessible items. This allows for new ways to engage with the game world, enhancing gameplay and adding layers of realism and immersion, making the player’s journey more engaging.
How This Could Appear in Your Game or Experience
Imagine a player in a cooking game inspired by Gordon Ramsay’s Hell’s Kitchen. They discover an item they can’t interact with — a cutting board holding a block of cheese. They try to interact, but nothing happens. They’re told by an NPC, or by a pop-up, that they need specific equipment, like Cheese Sleeves, to interact with the block of cheese. Now, the player must explore the surrounding area on your LAND to find the sleeves or purchase them from a shop, whichever you as the game creator decide.
Once the Cheese Sleeves (or other items) have been obtained, a pop-up should appear explaining how to equip the sleeves and what they do. For example, “Press ‘I’ to open the inventory and double-click the sleeves to equip them. These sleeves allow you to interact with cheese!”
The player equips the sleeves and reapproaches the cutting board. They are now able to collect slices of cheese! The cutting board should swap assets or destroy itself to indicate that the cheese has been secured. The cutting board can later regenerate over time.
With the cheese in hand, the player can carry it to the other side of the kitchen and deposit the required amount of cheese slices to finish their recipe. When the decided-upon amount of cheese has been deposited into the processing asset (perhaps a slice of bread or a toaster), a sandwich will spawn, allowing the player to collect and serve it.
How to Implement
Using equipment to trigger unique interactions is a multi-step process.
First, you’ll want to place the equipment, like the Cheese Sleeves for the player to collect. Set up a Message On Equip that will trigger when the player equips it. Next, create a number variable to count equipped items. Add a Math Rule via the Game Rules system to add “1” to the variable when the On Equip message is received.
Then, set up a Compare Numbers rule so that when the player interacts with an object, like the cutting board, a Check Message is sent to this rule to see if the correct number of items has been equipped. In this case, if the variable equals 1, the cheese slices can be obtained. Set the Message to Send, which will be used to spawn the cheese.
Create a Preset of multiple cheese block assets to drop. Place the objects almost on top of each other with Collisions+Gravity enabled if you want them to force apart when dropped. Select all of them so you can add the same logic to each one at the same time. Add the Pickable Component so the player can pick them up. Add a Health Component with an Instant Death Message. Finally, add a simple tag for reference. Save the objects as a preset and delete them.
Now, set up a cutting board with cheese on it to drop the cheese preset when the player interacts after they have equipped the correct item. Add a Drop Component to a cutting board. Toggle Use Preset to True, select the cheese preset and set the Required Message to drop it as the one sent by the Compare Numbers rule when the condition in it is met. Add a Plant Component to the cutting board and assign the Harvest Message from the rule system to destroy it, causing the cheese to drop.
The player should be able to pick up the cheese and carry it by pressing “E” and placing it on an asset, such as a plate, to “process” the cheese. Add a Trigger Volume Component to the plate to detect when cheese is nearby. Set the detection to a certain tag assigned to the cheese. Set the detection message to the cheese’s instant death message, causing it to be “processed.” Processed cheese, if you will!
You’ll need to create a Math Rule to trigger the message used to “kill” the cheese, adding one to a variable that checks if the cutting board is “full.” Set a variable to track how many times the “cheese kill message” has been triggered. Then, create a compare value to check the number of processed cheeses. Once the variable reaches three, trigger a message indicating the cutting board is “full.”
Now, you can attach a Speaker to the cauldron that waits for the full message. When triggered, it says, “The cheese is processed; add the bread.” Allow the player to pick up a loaf of bread, tagged for detection by the cutting board Trigger Volume, which can be placed in front of the cutting board to detect the bread. This detection should trigger an Asset Spawner near the cutting board to spawn a sandwich for the player to collect.
That’s it! The player now has the cheese sandwich and can serve it, eat it, or use it to complete the mission, whichever you decide!
Potential Uses for Triggering Unique Interactions
There are many ways you could implement this feature into your game. One possible example where you could use unique interactions is in a game where your objective is to clean up a town before the contemptuous, trash-hating mayor arrives!
His Chief of Staff instructs you to clean up as much trash as possible to please the mayor. To do so, you will need special gloves for the varying levels of waste. You will need a gas mask for hazardous waste that is just too stinky for even the strongest of noses! Coins earned from the cleanup can be spent on better tools that allow you to pick up more varied trash items. This adds a layer of strategy to manage resources and improve efficiency. With all the trash removed, you’ll be sure to impress the mayor and maintain a pristine city.
In another example, you could step into the role of a potion maker in a bustling village. Players gather herbs and fruits to craft potions, using different tools to interact with plants, bushes, trees, and even creatures. Cooperation with friends could enhance the experience as they work together to gather resources and create potions to support the townsfolk. This example highlights a potential multiplayer use case of the On-Equip feature and highlights the importance of teamwork and strategic planning.
Unleash Your Creativity With On-Equip
By strategically utilizing On-Equip mechanics, game designers can introduce new layers of interactivity and immersion into their creations. Whether enhancing the realism of a cooking game, adding cooperative components to a retrieval game, or intensifying the thrill of a clean-up mission, On-Equip mechanics enrich the gameplay experience and deepen player involvement.
Get started today and discover the transformative potential of the On-Equip feature in shaping your gaming experiences in The Sandbox, and stay tuned for Part V: Using Equipment to Create Class-Based Systems.
Latest Articles