Verse Library verse

01 Fragment

Creates a damage-boosting power-up device that applies a multiplier to players who pick it up.

verse-library/using-damage-amplifier-powerup-devices-in-fortnite-creative/01-fragment.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }

# This is our main script class. Think of it as the "brain" for the powerup.
class GlassCannonPowerup is WorldDevice():
    # DATA MEMBERS (Variables):
    # These are the settings you can tweak in the editor or here.
    # Duration is how long the buff lasts (in seconds).
    Duration: float = 15.0
    
    # Multiplier is how much damage is boosted. 2.0 means double damage.
    DamageMultiplier: float = 2.0
    
    # This is a reference to the actual Powerup Device in the editor.
    # We link this in the editor, or we can find it programmatically.
    # For simplicity, we assume this script IS attached to the device.
    SelfDevice: DamageAmplifierPowerupDevice = Self
    
    # This tracks who currently has the buff.
    # An "Agent" is a player or NPC.
    # We use an "optional" type because no one has the buff at the start.
    CurrentHolder: optional Agent = none
    
    # INITIALIZATION:
    # This runs once when the island starts or the device spawns.
    OnBegin<override>()<suspends>: void = super.OnBegin() <suspends>
        # We connect our custom function to the device's pickup event.
        # Think of this like plugging a wire into a trigger.
        SelfDevice.ItemPickedUpEvent += OnItemPickedUp

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