Verse Library verse

01 Device

Switches between calm and combat music states when enemy spawners generate new threats.

verse-library/fortnite-ai-music-manager/01-device.verse

using { /Fortnite.com/Devices }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our custom device blueprint.
# Think of it as a "Smart Music Remote" that we place in the level.
combat_music_switch := class(creative_device):

    # @editable means you can change these settings in the editor panel.
    # It's like the "dials" on a radio.
    
    # The Guard Spawner that triggers the change.
    @editable
    EnemySpawner: guard_spawner_device = guard_spawner_device{}
    
    # The Music Manager we want to control.
    @editable
    MusicController: music_manager_device = music_manager_device{}
    
    # This is our "Light Switch" variable.
    # It starts as False (Calm Mode).
    is_panic_mode: bool = false

    # This function runs when the device is first placed in the world.
    # It's like the "Power On" button for your code.
    OnBegin<override>()<suspends>: void =
        # Subscribe to the spawner's "Spawned" event.
        # This means: "Hey Spawner, tell me every time you make a new enemy."
        EnemySpawner.SpawnedEvent.Subscribe(SpawnHandler)

    # This is the function that runs when the event happens.

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