Verse Library verse

08 Sequence States

Validates current switch states against predefined combinations to track puzzle progress.

extracted-snippets/documentation/en-us/uefn/escape-room-10-switch-puzzle-in-unreal-editor-for-fortnite/08-sequence-states.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/escape-room-10-switch-puzzle-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/uefn/escape-room-10-switch-puzzle-in-unreal-editor-for-fortnite.md
# Section:    Sequence States
    # Function to validate the sequence of the switches
    CheckSequence(InPlayer : agent) : void =
        for (SwitchIndex -> Switch : Switches):
            if(Switch.GetCurrentState[]) then Print("{SwitchIndex} On") else Print("{SwitchIndex} Off")
        
        if:
            # check for valid states and hardcodes the validation of the states
            # [off],[off],[on],[off] State One
            not Switches[0].GetCurrentState[]
            not Switches[1].GetCurrentState[]
            Switches[2].GetCurrentState[]
            not Switches[3].GetCurrentState[]
        then:
            ValidState("One")

        else if:
            # check for valid states
            #[On], [Off], [On], [Off] State Two
            Switches[0].GetCurrentState[]
            not Switches[1].GetCurrentState[]
            Switches[2].GetCurrentState[]
            not Switches[3].GetCurrentState[]
        then:
            ValidState("Two")

        else if:
            # check for valid states

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