Assign

method
Assign<public>(Patroller: agent): void

Assign an AI to this patrol path.

Module
/Fortnite.com/Devices
Declared in
ai_patrol_path_device
Source
fortnite

Used in

VO_Corner := vo_prop: {
                # Assign the Corner Prop from your Gallery
                # This is like picking a specific wall piece from your Quick Bar.
                Prop := PT.Building1_corner 
            }
        }

        # 2. Define the Walls/Faces (The Fillers)
Tile1 : color_changing_tiles_device = color_changing_tiles_device{}

    @editable
    Tile2 : color_changing_tiles_device = color_changing_tiles_device{}

    # We also need the button that triggers the reset.
    # Assign your Conditional Button in the Details panel.
    @editable
    Button : button_device = button_device{}

    # OnBegin runs once when the island starts.
    # It waits for the button to be pressed.
    OnBegin<override>()<suspends> : void =
target_practice_script := class(creative_device):

    # These are the two devices we placed in the editor.
    # Assign them in the Details panel in UEFN.
    @editable
    TargetDevice : skilled_interaction_device = skilled_interaction_device{}

    @editable
    PrizeBox : item_granter_device = item_granter_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # We wait for the player to interact with the target.
        # 'InteractedWithPerfectEvent' fires when someone hits the Perfect zone.
        # 'InteractedWithGoodEvent' fires when someone hits the Good zone.
        loop:
            # Block here until the Perfect zone is triggered.
            Agent := TargetDevice.InteractedWithPerfectEvent.Await()
            # If it was a perfect hit, we give the prize!
            PrizeBox.GrantItem(Agent)
crafting_table_device := class(creative_device):

    # Place two Item Granter devices on the island and set one to Grub,
    # one to Acorn. Assign them here in the editor.
    @editable
    IngredientGranter1 : item_granter = item_granter{}

    @editable
    IngredientGranter2 : item_granter = item_granter{}

    # Place a third Item Granter set to Primal Pistol for the reward.
    @editable
    RewardGranter : item_granter = item_granter{}

    # Place a Conditional Button on the island and assign it here.
    @editable
    CraftButton : conditional_button_device = conditional_button_device{}

    OnBegin<override>()<suspends> : void =
        # Listen for the button's success event (all key items found)
        CraftButton.SuccessEvent.Subscribe(OnCraftRequested)

    # This function is called when the Conditional Button confirms
    # the player holds both key items
    OnCraftRequested(Agent : agent) : void =
        if (FortCharacter := Agent.GetFortCharacter[]):
            # HasIngredients check is handled by the Conditional Button
            # device in the editor — it unlocks only when both items
            # are present, so we go straight to crafting
            CraftItem(Agent)

    # This function checks the player's bag
    # It looks for the items in the recipe
    # Note: Verse has no direct inventory-query API; the Conditional
    # Button device performs the item check for us automatically.
    HasIngredients(Agent : agent) : logic =
        # Delegate the check to the Conditional Button's built-in
        # key-item validation — always returns true here because
        # SuccessEvent only fires after the check passes
        return true
MyGarageDevice := class(creative_device):
    # This is the spawner.
    # It will make the car appear.
    # note: Assign this device reference in the UEFN details panel after adding the Verse device to your island.
    @editable
    car_spawner : sports_car_spawner_device = sports_car_spawner_device{}

    # This is the trigger.
    # It detects when a player steps on it.
    # note: Assign this device reference in the UEFN details panel after adding the Verse device to your island.
    @editable
    start_button : trigger_device = trigger_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # We listen for the button press.
        # When the button is pressed, we call "OnButtonPressed".
        start_button.TriggeredEvent.Subscribe(OnButtonPressed)

    # This function makes the car appear.
    OnButtonPressed(agent : agent) : void =
        # We check that the agent is a player before spawning.
        if (player := player[agent]):
            # This line tells the spawner to spawn a car.
            # It uses the player's chosen car skin.
            car_spawner.SpawnVehicleFor(player)
spawn_pad_device := class(creative_device):

    # Reference to the player_spawner_device placed in the scene.
    # Assign this in the UEFN details panel.
    @editable
    SpawnPad : player_spawner_device = player_spawner_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # Tell the device to wait for players.
        # It will trigger when someone steps on it.
        SpawnPad.SpawnedEvent.Subscribe(SpawnPlayerHandler)

    # This is a handler. It reacts to events.
    # note: SpawnedEvent sends an `agent` argument via its subscribe callback.
    SpawnPlayerHandler(Agent : agent) : void =
        # Give the player a weapon.
        # This makes the game fun immediately.
        # note: Verse has no direct Give_Weapon API; item_granter_device
        # is the real device used to grant items to players at runtime.
        if (Fort := Agent.GetFortCharacter[]):
            Fort.Show()  # Confirm the character is active on spawn.
futuristic_room_manager := class(creative_device):

    # This is a prop_spawner_base_device reference.
    # Assign your Prop Spawner device here in the editor.
    @editable
    RoomSpawner : prop_spawner_base_device = prop_spawner_base_device{}

    # OnBegin runs automatically when the game starts.
    OnBegin<override>()<suspends> : void =
        # We call SpawnObject on the device.
        # This spawns the prop that is already configured
        # on the Prop Spawner device in the editor.
        RoomSpawner.SpawnObject()

        # We print a message.
        # This helps us know it worked.
        Print("Room placed! Enjoy your futuristic base!")
Green_Gun_Grant := item_granter

    # This function runs once when the match begins.
    OnBegin<override>()<suspends>: void =
        # 1. Assign Players to Teams
        # We tell each Team Setting device to "take control" of players.
        # This is like the bus dropping players into specific departments.
        Red_Team_Setting.SetTeamForPlayer()
        Blue_Team_Setting.SetTeamForPlayer()
        Green_Team_Setting.SetTeamForPlayer()

        # 2. Grant Items
        # We activate the Item Granter devices.
        # This is like handing out the welcome kits to new employees.
        Red_Gun_Grant.GrantItem()
        Blue_Gun_Grant.GrantItem()
        Green_Gun_Grant.GrantItem()

        # 3. Teleport to Spawns
        # We activate the teleporters to move players to their specific pads.
        # This ensures no one is standing in the wrong room.
        Red_Teleporter.Activate()
        Blue_Teleporter.Activate()
        Green_Teleporter.Activate()
my_music_maker := class(creative_device):
    # These are the devices we will use.
    # Think of them like boxes in your inventory.
    # note: Assign each device in the UEFN details panel after placing it on the island.
    @editable
    drum_player : drum_player_device = drum_player_device{}

    @editable
    distortion : distortion_effect_device = distortion_effect_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # 1. Set the Drive to high.
        # This makes the sound crunchy!
        # note: distortion_effect_device exposes Drive and Mix as editable
        # properties in the details panel; SetDrive/SetMix are not runtime API.
        # Set Drive to 0.8 and Mix to 1.0 in the UEFN details panel instead,
        # or use the Patchwork graph to wire devices together visually.
        distortion.Enable()

        # 2. Set the Mix to 100%.
        # This means we hear ONLY the distorted sound.
        distortion.Enable()

        # 3. Start the drum player.
        # The music will start playing now.
        drum_player.Enable()
MyDoorScript := class(creative_device):

    # This is the sound component.
    # It is the "tool" that makes noise.
    # Assign a sound asset to this in the UEFN editor's Details panel.
    @editable
    SoundComp: audio_player_device = audio_player_device{}

    # This is the trigger device.
    # It detects when a player touches the door.
    # Place a trigger_device in your level and wire it here.
    @editable
    Trigger: trigger_device = trigger_device{}

    # This function runs when the game starts.
    OnBegin<override>()<suspends>: void =
        # Connect the trigger to our sound.
        # When the trigger fires, play the sound.
        Trigger.TriggeredEvent.Subscribe(OnDoorTriggered)

    # This function plays the sound.
    # agent? is the optional agent (player) that activated the trigger.
    OnDoorTriggered(Source: ?agent): void =
        # Play the sound attached to the component.
        SoundComp.Play()