Settings

type
Settings<native><epic_internal>: fort_npc_component_settings
Module
AI
Declared in
fort_npc_component
Source
fortnite

Used in

# This is a conceptual script to show how Verse talks to Hiding Props
# In reality, you mostly use the Device Settings UI for basic hiding.

# Define a "Hiding Prop" as a specific type of Actor in the Scene Graph
HidingProp := struct:
    # The physical object
    Mesh: Actor
    # The event that fires when someone enters
# We grab the player who triggered the trap (we'll assume a trigger zone for simplicity)
        # In a real scenario, you'd bind this to a specific trigger event.
        # For this demo, we just log the settings to prove they are readable.
        
        # This line prints to the debug console what the current settings are.
        # You can change the values in the editor, push, and see this print change!
        Print("Trap Settings Loaded: Damage = {DamageAmount}, Delay = {TriggerDelay}")

    # This is a simple function to deal damage.
    # It's not editable, because it's logic, not a setting.
    DealDamage(target_player: player): void =
        if (FortChar := target_player.GetFortCharacter[]):
            FortChar.Damage(DamageAmount)
// Think of these as sliders on a radio.

Post Process Volume Settings:
├── Post Process Effects
   ├── Depth of Field: [ON]  <-- Turn this on!
      ├── Focus Distance: 200.0  <-- How close is "sharp"?
      └── Maximum Blur: 10.0     <-- How fuzzy is the background?
   └── Color Grading
       └── ... (save this for later!)
script PerformanceManager: component() {
    # A variable to store the player's current device tier
    # Think of this as the "Graphics Settings" dropdown menu
    var PlayerDeviceTier: int = 0

    # A function that runs when the component starts
    # This is like pressing "Play" on your island
    OnBegin<override>()<scalespawner, clientauthoritative>: <async> () = async
    (
        # Get the local player (you!)
        LocalPlayer := GetLocalPlayer()
        
        # Check the player's device tier
        # This is like asking: "Are you on a phone, a console, or a super PC?"
        # The result is stored in PlayerDeviceTier
        # 0 = Low, 1 = Medium, 2 = High, 3 = Epic, 4 = Cinematic
        PlayerDeviceTier := LocalPlayer.GetDeviceTier()

        # Now, let's react to what we found
        if (PlayerDeviceTier < 2) {
            # If tier is Low or Medium
            Print("Low-End Mode Activated: Simplifying graphics for smooth gameplay!")
            # In a real island, you'd use Verse to hide complex meshes here
        } else {
            # If tier is High, Epic, or Cinematic
            Print("High-End Mode Activated: Loading full-res textures and lights!")
            # In a real island, you'd use Verse to enable ray tracing here
        }
    )
// Add health to the target.
            // 'Add_Health()' is the Verse API for healing.
            target.Add_Health(heal_amount)
            
            // Optional: Visual feedback (Debug Draw)
            // This draws a line in the air so you can see what's happening.
            // NOTE: Requires Verse Debug Draw enabled in Island Settings.
            Draw_Line(Get_Location(), target.Get_Location(), Color_Green)
            
            // If the target is now full health, stop healing them.
            if (target.Get_Health() >= target.Get_Max_Health()) {
                target = null
            }
create_arena_device := class(creative_device):

    # 1. DEFINE THE ARENA SIZE
    # Think of this like setting the "Win Condition" or "Match Settings"
    # We use named constants because these numbers won't change during the game.
    # Distances are in centimetres in Unreal Engine (2000.0 = 20 metres).
    Arena_Width : float = 2000.0
    Arena_Depth : float = 2000.0
    Arena_WallHeight : float = 500.0   # How tall each wall panel is
    Arena_Thickness : float = 50.0     # How thick the walls are

    # Reference to a barrier device that must be placed and wired in the editor.
    # Duplicate it in UEFN for each of the four walls and assign each below.
    # note: Verse cannot spawn barrier_device instances at runtime; they must
    # be pre-placed in the editor and referenced here as editable properties.
    @editable
    Front_Barrier : barrier_device = barrier_device{}

    @editable
    Back_Barrier : barrier_device = barrier_device{}

    @editable
    Left_Barrier : barrier_device = barrier_device{}

    @editable
    Right_Barrier : barrier_device = barrier_device{}

    # 2. THE SETUP FUNCTION
    # This runs once when the game starts, like the "Pre-Game Lobby" phase.
    Setup() : void =
        # We need to know where the device itself is placed in the world.
        # This is like checking your GPS location.
        My_Transform := GetTransform()
        My_Location  := My_Transform.Translation

        # 3. ACTIVATE THE BARRIERS
        # Each barrier_device was pre-positioned in the editor to match the
        # arena corners. We simply enable them here so they block players
        # and projectiles from the moment the game starts.
        Front_Barrier.Enable()
title_sequence_device := class(creative_device):

    # --- CONSTANTS: The "Locked" Settings ---
    # These are like the fixed map boundaries. They don't change.
    # We link this to a Fixed Point Camera in the editor.
    # Drag your gameplay_camera_fixed_point_device from the level into this slot.
    @editable
    SplashCamera : gameplay_camera_fixed_point_device = gameplay_camera_fixed_point_device{}

    # We link this to our Pop-Up Dialog Device in the editor.
    # This is the "Loot Drop" container for our menu.
    @editable
    MenuDialog : popup_dialog_device = popup_dialog_device{}

    # --- VARIABLES: The "Changing" State ---
    # This is like the "Game State" flag. Is the game started or not?
    # Starts as FALSE (game hasn't started).
    var GameStarted : logic = false

    # --- FUNCTIONS: The Actions ---

    # This function is like a "Prop Mover" that moves the camera.
    # It activates the splash camera sequence, waits, then shows the menu.
    StartIntroSequence()<suspends> : void =
        # "Print" is like shouting in chat. It shows text in the debug console.
        Print("Intro sequence started!")

        # We tell the splash camera device to activate (play its cinematic view).
        # In Verse, we call methods on the device reference to change its state.
        SplashCamera.AddToAll()

        # We wait 3 seconds (like a storm timer) before showing the menu.
        # This gives the player time to absorb the hype.
        Sleep(3.0)

        # Now we show the menu.
        ShowMenu()

    # This function shows the Pop-Up Dialog device we configured in the editor.
    ShowMenu() : void =
PowerupDevice.GrantToAgent(LiveAgent)
                # note: stat_powerup_device exposes GrantToAgent; point value
                # is configured in the device's UEFN property panel (set to 1).

                # Read the player's current score from the stat creator device
                # and check whether they have reached the win threshold.
                # note: Score comparison is handled through Island Settings
                # Victory Condition (Score >= WinScore) configured in UEFN,
                # because stat values are read server-side by the engine.
                Print("Point collected! Reach {WinScore} to win!")
# This event fires when the game starts (the bus launches).
    OnBegin<override>()<suspends>: void =
        # Step 1: Force Team Assignment
        # We explicitly tell the team settings to apply.
        # In some modes, this happens automatically, but in Verse, we can be precise.
        # Note: SetTeamForPlayer() usually happens via the Team Settings device's 
        # own internal logic, but we can trigger other events here.

        # Step 2: Grant Weapons
        # We activate the granter devices.
        # This is the "Welcome Gift" moment.
        Red_Grant.GrantItemToAll()
        Blue_Grant.GrantItemToAll()
        Green_Grant.GrantItemToAll()

        # Step 3: Teleport Players
        # We fire the teleporters.
        # This moves players from the "Lobby" to their "Spawn Room".
        Red_Tele.Enable()
        Blue_Tele.Enable()
        Green_Tele.Enable()