Verse Library verse

02 Fragment

Shows a non-blocking pop-up dialog to players entering a trigger zone without pausing gameplay.

verse-library/using-pop-up-dialog-devices-in-fortnite-creative/02-fragment.verse

# Import the necessary Verse types for players and devices
using /Fortnite.com/Devices
using /Fortnite.com/Players

# Define our main actor. This is the "Brain" of our trap.
LootTrapActor := actor {
    # These are "Properties" (settings we can change in the editor).
    # Think of them as dials on a mixer.
    TriggerVolume: TriggerVolumeDevice = TriggerVolumeDevice{}
    PopupDialog: PopUpDialogDevice = PopUpDialogDevice{}

    # This function runs when a player enters the trigger volume.
    # 'player' is the person who walked in.
    OnPlayerEntered := func(player: Player) {
        # We want to show the dialog to THIS specific player.
        # The Pop-up Dialog device has a 'Show' function.
        # We pass the player to it so only they see the box.
        
        # We also define the text dynamically here, 
        # overriding the editor settings if needed.
        PopupDialog.Show(player, 
            "Do you want the Legendary Loot?", 
            "Click YES to take it. Click NO to get shocked."
        )
        
        # NOTE: The dialog will stay on screen until the player clicks.
        # The game DOES NOT pause. The player can still move, shoot, etc.
        # while reading the text.
    }
}

Comments

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