DestroyedEvent

event
DestroyedEvent<public>: listenable(?agent)

Triggers when the turret is destroyed. Sends the triggering `agent`. If the activator is a non-agent then `false` is returned.

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}")
ResetTargetAfterDelay()<suspends> : void =
        Sleep(5.0)
        DamageSensor.ActivateObjectivePulse(DamageSensor.DestroyedEvent.Await())

    # OnBegin is the real Verse entry point for creative_device.
    OnBegin<override>()<suspends> : void =
        # Connect the sensor's damage event to our handler.
        DamageSensor.DestroyedEvent.Subscribe(OnTargetHit)
JoustingGame / Jousting Actor Controller verse-source
SetupCargoSystem():void =
        CargoManipulator.DamagedEvent.Subscribe(OnCargoDamaged)
        CargoManipulator.DestroyedEvent.Subscribe(OnCargoDestroyed)
        if (EnableDebug?) then Logger.Print("Cargo system setup with {CargoConfig.Length} pieces")

    SpawnCargo():void =
        if (EnableDebug?) then Logger.Print("Spawning cargo")
        ClearCargo()
        if (ActorTransform := GetCurrentActorTransform()?):
JoustingGame / Jousting Elephant Controller verse-source
SetupCargoSystem():void =
        # Subscribe to cargo prop manipulator events
        # Subscribe to PropManipulator events
        CargoManipulator.DamagedEvent.Subscribe(OnCargoDamaged)
        CargoManipulator.DestroyedEvent.Subscribe(OnCargoDestroyed)

        if (EnableDebug?) then Logger.Print("Cargo system setup with {CargoConfig.Length} pieces")

    SpawnCargo():void =
        if (EnableDebug?) then Logger.Print("Spawning cargo")
PropSystem / Prop Controller verse-source
if (PropMan := PropZone?.PropManipulator):
                PropMan.DamagedEvent.SubscribeAgent(OnManipPropDamaged, PropName)
                PropMan.DestroyedEvent.SubscribeAgent(OnManipPropDestroyed, PropName)
                PropMan.HarvestingEvent.SubscribeAgent(OnManipPropHarvested, PropName)
                PropMan.ResourceDepletionEvent.SubscribeAgent(OnManipResourceDepleted, PropName)
                Logger.Print("Subscribed to Prop Manipulator events for {PropName}")
            else:
                Logger.Print("Prop {PropName} does not have a Prop Manipulator")
ActorSystem / Actor State Controller verse-source
SetupCargoSystem():void =
        Sub.Add(CargoManipulator.DamagedEvent.Subscribe(OnCargoDamaged))
        #Sub.Add(CargoManipulator.DestroyedEvent.Subscribe(OnCargoDestroyed))

    SpawnCargo():void =
        if (EnableDebug?) then Logger.Print("Spawning cargo")
        var ActorTransform : transform = transform{}
        # Clear existing cargo
        ClearCargo()
MiniGameSystem / Minigame Controller verse-source
if (VehicleRespawns > 0):
                    Vehicle.DestroyedEvent.Await()
                    if(Timeout := RespawnVehicleTimeout?):
                        Logger.Print("{MinigameName} - Reassigning Driver to Vehicle in {Timeout}", ?Level := log_level.Normal)
                        # Reassign the driver to the vehicle if the player exits the vehicle
                        Sleep(Timeout)
                    set VehicleRespawns -= 1
                    Logger.Print("{MinigameName} - VehicleDestroyed- Respawned Count: {VehicleRespawns}")                    
                    Print("Vehicle Destroyed - Respawn Count: {VehicleRespawns}")
                    Vehicle.RespawnVehicle()