Verse Library verse

03 Fragment

Processes player Yes or No dialog responses to branch gameplay logic like granting loot or applying effects.

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

LootTrapActor := actor {
    TriggerVolume: TriggerVolumeDevice = TriggerVolumeDevice{}
    PopupDialog: PopUpDialogDevice = PopUpDialogDevice{}
    
    # We need a way to give loot. Let's assume we have an Item Granter.
    # For simplicity, we'll just use a print statement to log the choice.
    # In a real game, you'd call ItemGranter.Grant(player, "Legendary_Auto_Rifle")
    
    # When the player clicks a button on the dialog, this event fires.
    # 'response' is either "Yes" or "No" (based on the buttons you set up).
    OnDialogResponse := func(response: string) {
        if (response == "Yes") {
            # Player said Yes! Give them loot.
            # Print("Player took the loot!") # Debugging
        } else {
            # Player said No! Give them a shock.
            # Print("Player got shocked!") # Debugging
        }
    }
}

Comments

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