Verse Library verse

01 Fragment

Activates audio devices when player actors overlap a designated volume.

verse-library/using-audio-player-devices-in-unreal-editor-for-fortnite/01-fragment.verse

# Import the necessary modules for devices and audio
import devices: {
    TriggerVolume: class,
    AudioPlayer: class,
}

# This is our main script. It will be attached to the Trigger Volume.
# Think of this as the "brain" of the trigger.
struct JumpScareTrigger struct {
    # We need to reference the Audio Player device.
    # This is like saying "I want to control the CD player in the other room."
    audio_player: AudioPlayer
}

# This function runs when the script starts.
# It's like loading the map.
OnBegin<override>()<suspends>: void = {
    # We don't need to do much here for a simple trigger,
    # but this is where you could set up initial logic.
}

# This function runs when a player enters the trigger volume.
# 'player' is the person who stepped on the pressure plate.
OnActorBeginOverlap<override>(other: Actor)<suspends>: void = {
    # Check if the thing that entered is a player.
    # In Fortnite, players are "Pawn" actors.
    if (other is Pawn) {
        # PLAY THE SOUND!
        # This tells the audio_player device to start playing.
        # It’s like pressing the 'Play' button on the CD player.

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