Verse Library verse

01 Device

Toggles the visibility of the build menu when players enter or exit a designated trigger zone.

verse-library/creative-hud-identifier-build-menu/01-device.verse

# Import the UI module so we can talk to the HUD elements.
# Think of this as plugging into the electrical grid.
using { /Fortnite.com/UI }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Simulation }

# Define our actor. This is the "box" in the map that runs the logic.
test_stealth_mode_actor := class(creative_device):
    # We need a reference to the Trigger Volume to know when someone enters.
    # In a real build, you'd drag the Trigger Volume from the editor into this slot.
    # For this example, we assume we have a trigger named "stealth_trigger".
    @editable
    stealth_trigger: trigger_device = trigger_device{}

    # This function runs when the actor is created (when the map loads).
    OnBegin<override>()<suspends>: void =
        # 1. Get the HUD Controller.
        # This is like finding the main breaker box for the screen.
        HudController := GetPlayspace().GetHUDController()
        
        # 2. Identify the Build Menu.
        # This is the specific "name tag" for the build menu UI element.
        BuildMenuId := creative_hud_identifier_build_menu{}
        
        # 3. Listen for the trigger.
        # When someone enters the box, we hide the menu.
        # When they leave, we show it.
        stealth_trigger.TriggeredEvent.Subscribe(OnTriggered)

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