Verse Library verse

01 Standalone

Handles sword pickup events to announce the winner globally and progress the challenge objective.

verse-library/using-sword-in-the-stone-devices-in-fortnite-creative/01-standalone.verse

using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }

# This is our main script class. Think of it as the "Brain" of our island.
# It inherits from `creative_device_base`, which means it can interact with devices.
SwordMasterScript := class(concrete):

    # We need to find our devices. In the Scene Graph, we "link" them here.
    # Replace "MySwordDevice" with the actual name of your Sword in the Stone device in the editor.
    MySwordDevice: sword_in_the_stone_device = nil

    # We also need a way to talk to players.
    # This is like a global chat channel.
    BroadcastDevice: broadcast_device = nil

    # This is our "Event Handler." It’s a function that runs automatically
    # when the sword is picked up.
    # It’s like a trap: when the trigger is hit, this function fires.
    OnSwordPickedUp := func(player: player):
        # 1. Get the player's display name (their in-game nickname).
        player_name := player.Get_Display_Name()

        # 2. Construct a victory message.
        # This is like typing in the chat, but we do it programmatically.
        victory_message := $"CONGRATULATIONS, {player_name}! YOU ARE THE CHOSEN ONE!"

        # 3. Send the message to everyone on the island.
        # This is like hitting the "Send" button on a global announcement.
        BroadcastDevice.Broadcast_Message(victory_message)

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