Verse Library verse

02 Standalone

Custom device that damages and launches players when they step on a triggered zone.

verse-library/from-creative/02-standalone.verse

using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }

RevengeTrap := class<concrete>(creative_device_base):

    @editable
    DamageAmount<public>: float = 10.0

    @editable
    LaunchForce<public>: float = 2000.0

    @editable
    Trigger<public>: trigger_device = trigger_device{}

    # This is our "already used" switch.
    # var means it can be changed after the game starts.
    # It starts as true: the trap is armed.
    var IsArmed<private>: logic = true

    OnBegin<override>()<suspends>: void =
        Trigger.TriggeredEvent.Subscribe(OnPlayerStep)

    OnPlayerStep<private>(Agent: ?agent): void =
        # Check the switch. If IsArmed is false, do nothing.
        if (IsArmed?):
            # Disarm FIRST so a second player can't trigger it
            # while we're still running this code.
            set IsArmed = false

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