Verse Library verse

01 Fragment

Activates a specific audio mix to mute or adjust sound volumes at runtime.

verse-library/audio-mixer-api/01-fragment.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# This is our main Script Device. 
# Think of it as the "Brain" that controls the Audio Mixer.
class StealthAudioScript is functional_game_script()

    # We need a reference to the Audio Mixer device.
    # In the editor, you'll link this to the Audio Mixer you placed.
    audio_mixer_device: audio_mixer_device = audio_mixer_device{}

    # We also need a Timer to simulate the "Prep Phase" ending.
    # Link this to a Timer device in the editor.
    timer_device: timer_device = timer_device{}

    # This function runs when the game starts.
    # It's like the "Battle Bus" dropping off players.
    OnBegin<override>()<suspends>: void = 
        # First, let's make sure the footsteps are MUTED.
        # We do this by activating the mix we set up in the editor (Volume 0.0).
        # Since we unchecked "Activate on Game Start" in the editor, 
        # we have to call this manually to set the initial state.
        audio_mixer_device.ActivateMix()
        
        # Print a message to the debug console so we know it worked.
        Print("Stealth Mode ON: Footsteps are muted!")

    # This function is called when the Timer finishes.
    # Link the Timer's "On Finish" event to this function in the editor,
    # OR we can handle it in code if we started the timer ourselves.

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