Verse Library verse

03 Standalone

Toggles a platform prop visibility and collision on trigger, creating dynamic disappearing platforms.

verse-library/create-a-platformer-with-scene-graph-in-unreal-editor-for-fortnite/03-standalone.verse

using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }

# Declare a tag so we can find the Trigger device inside the Prefab by name.
# In the UEFN editor, assign this tag to the Trigger device that sits
# inside the DisappearingPlatform Prefab.
tag_my_trigger := class(tag) {}

# creative_prop_component is the real base class for Verse components
# that control a creative prop (static mesh + collision).
# Hide() makes the prop invisible and non-collidable.
# Show() reverses that. Both are inherited from creative_prop_component.
DisappearingPlatformLogic := class(creative_prop_component):
    # A variable to store how long the platform stays hidden.
    @editable
    HideDuration : float = 2.0

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Find the Trigger device inside our Prefab by its tag.
        if (Trigger := GetCreativeObjectsWithTag(tag_my_trigger{})[0],
            TriggerDevice := trigger_device[Trigger]):
            # Infinite loop: re-arms itself after every hide/show cycle.
            loop:
                # Block here until a player steps on the trigger.
                Agent := TriggerDevice.TriggeredEvent.Await()

                # Wait for the hide duration, then toggle visibility.
                Sleep(HideDuration)

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