Verse Library verse

02 Device

Activates game logic when players enter capture zones while holding required items.

verse-library/game-ends/02-device.verse

# ConditionalScoreTrigger.verse
# Only award points if the player is currently holding a Pickaxe (any item in slot 0).
# Demonstrates conditional logic before calling score_manager_device.Activate().

using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

ConditionalTrigger := class(creative_device):

    # Wire this to a Trigger device in the editor (the capture zone).
    @editable
    CaptureTrigger : trigger_device = trigger_device{}

    # Wire this to a Score Manager device configured for the correct team.
    @editable
    TeamScoreManager : score_manager_device = score_manager_device{}

    # Wire this to a Class Selector or Item Spawner that hands out the required item.
    # We use a class_and_team_selector_device as a proxy to identify which players
    # already received the "flag" item, since direct inventory inspection APIs
    # are not yet exposed in public Verse. See note below.
    # note: Full item-in-hand inspection (e.g. GetEquippedItem) is not available in
    #       the current public Verse API. The pattern below uses a boolean flag set
    #       by a separate device (e.g. an Item Granter + Trigger that calls
    #       SetHasItem() via a custom event) to approximate the check.
    var HasRequiredItem : logic = false

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