Verse Library verse

01 Device

Plays an explosion effect when a creative object collides with another actor in the game.

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

# This script makes the bomb explode on impact
using { /Fortnite.com/Devices }

Bomb_Spawner_Device := class(creative_device):
    # This is a variable for the explosion
    Explosion_Effect := creative_effect:creative_effect

    # This function runs when the game starts
    OnBeginPlay():void:
        # We get the device itself
        self := creative_device(self)
        # We enable the device
        self.Enable()
        print("Bomb is ready to throw!")

    # This function runs when the bomb hits something
    OnHit(hitter: creative_actor, hit: creative_hit):
        # Check if the hitter is our bomb
        if (hitter != self):
            return
        # Make it explode!
        self.Explode()
        print("Boom! The bomb hit something.")

Comments

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