Verse Library verse

01 Fragment

Restricts item interaction to players on a specific team and character class during the gameplay phase.

verse-library/all-options-additional/01-fragment.verse

# Import the necessary libraries for game logic
using /Fortnite.com/Devices
using /Engine/Systems/GameplayTagManager

# Define our custom device
type SniperLootDevice < CreativeDevice> is
    # The device itself
    Self: CreativeDevice

    # We need to know what Class is allowed. 
    # In a real device, this might be a parameter you set in the editor.
    AllowedClass: GameplayTag = "Class.Sniper"

    # This function runs when a player interacts with the device
    OnInteract: (player: Player) -> void =
        # 1. Check the Phase
        # Get the current game phase
        current_phase := GetGamePhase(Self)
        
        # If the game isn't in "Gameplay" phase, stop.
        # Think of this as checking if the storm has started.
        if current_phase != GamePhase.Gameplay:
            return # Exit early. Player can't open it yet.

        # 2. Check the Team (Optional, but good practice)
        # Let's say only Team 1 can open it.
        player_team := GetPlayerTeam(player)
        if player_team != Team.One:
            return # Wrong team. Go away.

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