Activate

method
Activate<public>(): void

Activates this device.

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

Used in

# LOGIC: Who died? Where should they go?
        # For simplicity, send every removed player to SpawnPad1 and
        # trigger the flash sequence so they know they are ready to go.
        # In a real game, you would track per-player state for richer logic!

        # Respawn the player at SpawnPad1.
        # player_spawner_device.Activate() respawns the player
        # the next time that spawn pad is used; to force immediate
        # teleport we move the player to the pad's transform.
        # note: player does not expose Set_location directly; we use
        # TeleportTo on the fort_character wrapped in a guard check.
        if (FortCharacter := RemovedPlayer.GetFortCharacter[]):
            PadTransform := SpawnPad1.GetTransform()
# This is the Function we want to call when the event happens
    OnBegin<override>()<suspends>:void=
        # We bind our event to a function on another device
        # In the editor, you do this by dragging and dropping in the Customize panel.
        # In Verse, you might do:
        # damage_zone_device.Activate.Bind(Self.OnButtonPressed)
        OnButtonPressed.Await()
# In UEFN, these are your Trigger Volume and your Teleporter devices.

    # The Trigger: Detects when a player steps on it.
    @editable
    TriggerDevice : trigger_device = trigger_device{}

    # The Healer: A health powerup device that grants health on Activate.
    # Place a health_powerup_device in the level and wire it here.
    @editable
    HealerDevice : health_powerup_device = health_powerup_device{}

    # The Teleporter: Moves the health station prop to a new location.
    # We use a teleporter_device to reposition the pickup each use.
# activation to award the point to the 'agent' (thief).
    # However, SetToAgentScore specifically sets the score 
    # *of the agent passed to it* to be the award amount 
    # for the *next* activation of the ScoreManager.
    
    # Let's activate the ScoreManager for the thief.
    score_manager.Activate()

# Connect the events.
# When the button is pressed, run the theft function for the player who pressed it.
button.Pressed.Bind(func(agent: agent):
    on_thief_action(agent)
)
# It was activated, so deactivate it.
                MyPropManipulator.Deactivate(player{})
                set IsActivated = false
                Print("Deactivated!")
            else:
                # It was not activated, so activate it.
                MyPropManipulator.Activate(player{})
                set IsActivated = true
                Print("Activated!")
OnButtonPressed := func():
    MyPropMover.Activate() # Tell the mover to start moving

# This function runs when the button is released
OnButtonReleased := func():
    MyPropMover.Deactivate() # Tell the mover to stop

# When the game starts, we connect the button to these functions
@editable
    target_prop: creative_prop = creative_prop{}
    
    # --- FUNCTIONS (The Abilities) ---
    
    # A function to turn the trap ON.
    # Like pressing the 'Activate' button on a trap.
    ActivateTrap() -> void:
        is_active = true
        # Change the prop's color to red.
        # We are accessing the 'material' component of the prop.
        target_prop.SetMaterialColor(Color{R:1.0, G:0.0, B:0.0})
        PrintToAll("Trap Activated! Watch your back.")