Verse Library verse

02 Device

Creates a throw bomb that triggers an explosion effect upon being dropped or hitting surfaces.

verse-library/using-carryable-spawner-devices-in-fortnite/02-device.verse

# Bomb_Spawner.verse
using { /Fortnite.com/Devices }

# We define our device class
class Bomb_Spawner(creative_device):
    # This is a variable to store the explosion effect
    explosion_fx := creative_effect:creative_effect

    # This runs when the game starts
    OnBeginPlay():void:
        # Enable the spawner
        self.Enable()
        # Print a message to the console
        print("Bomb Spawner is ON!")

    # This runs when a player picks up the carryable
    OnCarryablePickedUp(carryable: creative_object, player: player):
        print("Player picked up the bomb!")

    # This runs when the carryable is dropped
    OnCarryableDropped(carryable: creative_object, player: player):
        print("Player dropped the bomb!")

    # This runs when the carryable hits something
    OnCarryableHit(carryable: creative_object, hit: creative_hit):
        # If the hit is real, explode!
        if (hit.IsValid()):
            # Trigger the explosion on the device
            self.TriggerExplosion()
            print("BOOM!")

Comments

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