# This is our main script. It runs when the game starts.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We create a new class. Think of this as a blueprint.
# It holds the data for our power-up zone.
# Attach this device to a Verse Device in the editor.
power_up_zone := class(creative_device):
# These two variables are set in the editor by dragging
# devices onto the Verse Device's property panel.
# SkydiveVolume lets us detect when a player enters the zone.
@editable
EntryVolume : skydive_volume_device = skydive_volume_device{}
# RocketBoostDevice is the power-up we will activate.
@editable
PowerUpDevice : health_powerup_device = health_powerup_device{}
# This function runs when the game starts.
OnBegin<override>()<suspends> : void =
# We subscribe to the EntryVolume's AgentEntersEvent.
# This means: "When a player enters the volume, call OnPlayerEntered."
EntryVolume.AgentEntersEvent.Subscribe(OnPlayerEntered)
# This event happens when a player enters the volume.
# The agent parameter is the player who stepped inside.
OnPlayerEntered(Agent : agent) : void =
# Enable the Power-Up device.
Verse Library
verse
01 Device
Creates a zone device that enables a health power-up when a player enters a designated volume.
verse-library/other-device-options/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.