Anyone able to get creatures to drop loot?

Hello again @swaggod !

I followed that tutorial in my Island and it works perfectly. Have you implemented the code exactly as explained in the tutorial?

Just in case, here is the code, replacing the creature spawner device (used in the tutorial) by a wildlife spawner device (the one you want to use)


using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }

# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.

loot_drop_data := class<concrete>:
    @editable
    CreatureSpawnerDevice : wildlife_spawner_device = wildlife_spawner_device{}

    @editable
    ItemSpawnerDevice : item_spawner_device = item_spawner_device{}

    @editable
    DropChance : type {_X:float where 0.0 <= _X, _X <= 1.0} = 0.0

    var MaybeMainDevice : ?loot_drop_device = false

    OnCreatureEliminated(DeviceAIInteractionResult : device_ai_interaction_result):void=
        if(MainDevice := MaybeMainDevice?):
            MainDevice.OnCreatureEliminated(DeviceAIInteractionResult, Self)



# A Verse-authored creative device that can be placed in a level
loot_drop_device := class(creative_device):

    @editable
    LootDropsData : []loot_drop_data = array{}

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=

        for (LootDropData : LootDropsData):
            set LootDropData.MaybeMainDevice = option{ Self }
            LootDropData.CreatureSpawnerDevice.EliminatedEvent.Subscribe(LootDropData.OnCreatureEliminated)


    OnCreatureEliminated(DeviceAIInteractionResult : device_ai_interaction_result, LootDropData : loot_drop_data):void=
        RandomChance : float = GetRandomFloat(0.01, 1.0)
        if ( LootDropData.DropChance < RandomChance ):
            return
        
        if (TargetAgent := DeviceAIInteractionResult.Target?, TargetFortCharacter := TargetAgent.GetFortCharacter[]):

            Location := TargetFortCharacter.GetTransform().Translation
            if (LootDropData.ItemSpawnerDevice.TeleportTo[Location, IdentityRotation()]):
                LootDropData.ItemSpawnerDevice.SpawnItem()

Additionaly, this is the config you need to do in your Item Spawner device to make it work:


And here is a video of this feature working on my testing Island:

Let me know if you need more help with this!