using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is a simple Verse script for an Ammo Station
# It gives ammo when a player interacts with it
# First, we define what our station is.
# An 'Entity' is any object in our game world.
# Think of it like a Lego brick that can do things.
ammo_station := class():
# This is a 'Component'. It is a part of our station.
# The 'Item Granter' component gives items to players.
ItemGranter : item_granter_device = item_granter_device{}
# This is a 'Function'. It is a set of instructions.
# It runs when a player interacts.
GiveAmmo(Player : agent) : void =
# We tell the granter to give the item.
# 'GrantItem' is the action we take.
ItemGranter.GrantItem(Player)
# This part connects the player to the action.
# When a player touches the station, run 'GiveAmmo'.
PlayerInteracts(Station : ammo_station, Player : agent) : void =
Station.GiveAmmo(Player)
Verse Library
verse
01 Standalone
Grants ammunition to players when they interact with a custom station object.
verse-library/using-ammo-items-in-fortnite-creative/01-standalone.verse