TargetFoundEvent

event
TargetFoundEvent<public>: listenable(agent)

Triggers when the turret finds a target. Sends the `agent` that was found.

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

Used in

var Score : int = 0

    # OnBegin runs automatically when the game starts.
    OnBegin<override>()<suspends> : void =
        # We wait for an Event.
        # DestroyedEvent fires when the turret is destroyed, or we can use TargetFoundEvent.
        # This means an enemy was hit by this turret.
        loop:
            # Block here until the turret finds a target (eliminates someone).
            Turret.TargetFoundEvent.Await()

            # When the event happens...
            # Add one to our score.
            set Score = Score + 1

            # Print the score to the screen.
            # This helps us see it working.
            Print("Score: {Score}")