Verse Library verse

01 Fragment

Displays a personalized pop-up dialog to individual players upon entering a trigger zone.

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

# This is a comment. Verse ignores lines starting with #.
# We are defining a new "Actor" (a game object) that holds our logic.
LootDialogActor := actor {
    # This is a "Variable" (a container that changes).
    # Think of it like a backpack slot.
    # Here, we link it to the Pop-up Dialog device we placed in the editor.
    # We'll assign this in the editor later.
    DialogDevice: PopUpDialogDevice = PopUpDialogDevice{}

    # This is a "Function" (a set of instructions).
    # Think of it like a combo move in fighting games.
    # It triggers when a player interacts with our trigger zone.
    OnPlayerEntered := func(player: Player) {
        # We are calling a method (an action) on the DialogDevice.
        # Show() is the action. It takes two things:
        # 1. The player who should see it.
        # 2. The text to show (we defined this in the device settings, 
        #    but we can also override it here if we wanted to).
        
        # Note: In Verse, we often pass the player to the dialog.
        # This ensures only THAT player sees the box.
        DialogDevice.Show(player)
        
        # Optional: Wait for the player to click.
        # The dialog stays open until they click.
        # We can listen for their choice if we want to do something different 
        # based on Yes or No. For now, we just show it.
    }
}

Comments

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