Verse Library verse

01 Device

Links a trigger volume to a HUD controller to manage stealth mode interactions.

verse-library/using-hud-controller-devices-in-fortnite-creative/01-device.verse

# Import necessary modules
using { /Fortnite.com/Devices }    # Gives us access to devices like trigger_device
using { /Verse.org/Simulation }    # Gives us access to game simulation logic
using { /Fortnite.com/Characters } # Gives us access to fort_character for agent casting
using { /Verse.org/Colors }        # Gives us access to color types (unused here, safe to remove)
using { /Fortnite.com/UI }         # Gives us access to fort_hud_controller and hud_element_identifier types
using { /Fortnite.com/Game }       # Gives us access to fort_playspace and GetHUDController

# Define the device class
# This is like building a new custom device in the Creative UI
StealthModeTrigger := class(creative_device):

    # 1. Define the Trigger device we'll place in the editor
    # We expose this so you can drag-and-drop a trigger_device into this device's slot
    @editable
    TriggerVolume : trigger_device = trigger_device{}

    # 2. Define the HUD Controller
    # We expose this so you can link the HUD Controller device here
    @editable
    HudController : hud_controller_device = hud_controller_device{}

    # 3. The "On Begin" function
    # This runs once when the game starts
    OnBegin<override>()<suspends> : void =
        # Subscribe to the trigger's TriggeredEvent for every agent who enters.
        # trigger_device exposes TriggeredEvent, which fires with the triggering agent (optional).
        TriggerVolume.TriggeredEvent.Subscribe(OnAgentTriggered)

    # Called automatically by TriggeredEvent each time a player triggers the trigger

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.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in