Verse Library verse

01 Fragment

Binds touch events to trigger a warning VFX and countdown timer before detonating an explosive.

verse-library/explosive-device-design-example-in-fortnite-creative/01-fragment.verse

# This script makes a barrel warn you before it blows!
# We name our devices so Verse can find them.

# This is a 'Function'. It is a list of instructions.
# Think of it like a recipe for an explosion.
On_Touch := func (source: actor) {
    # 1. Start the warning bubbles!
    # We tell the VFX Creator to play its effect.
    VFX_Creator.Play()

    # 2. Wait for 3 seconds.
    # The timer does the waiting for us.
    Timer.Start()

    # 3. When the timer ends, explode!
    # We listen for the 'Finished' signal from the timer.
    Timer.Finished.Bind(On_Explode)
}

# This function runs after the timer finishes.
On_Explode := func () {
    # Tell the explosive device to blow up!
    Explosive.Activate()
}

# This connects the player touching the trigger to our recipe.
# When someone touches the trigger, run On_Touch.
Trigger.Touched.Bind(On_Touch)

Comments

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