using { /Fortnite.com/Devices }
using { /Unreal.com/Engine }
using { /Fortnite.com/Items }
# This is our main device. It is the "brain" of our station.
power_exchange_device := class(fn_device):
# This is the button players will press.
exchange_button := button_device:
# We connect our "check_inventory" function to the button press.
on_player_interact:=func(player: player):
# Check if the player has an Active Powercell.
if player.has_item("Active_Powercell"):
# Give the player a Jetpack!
player.give_item("Jetpack")
# Remove the Active Powercell from their inventory.
player.take_item("Active_Powercell")
# Tell the player it worked!
print("You got a Jetpack! Enjoy flying!")
else:
# Tell the player they need Power.
print("You need an Active Powercell to fly!")
Verse Library
verse
01 Standalone
Checks player inventory for a specific item and exchanges it for a jetpack when a button is pressed.
verse-library/using-power-crafting-items-in-fortnite-creative/01-standalone.verse