Community Tutorial: EASILY Make A Loot Box With Verse, UEFN, and Blender

In this tutorial I go over the steps it takes to make a loot box in UEFN with Blender for the custom lootbox and Verse for the mechanics of it.

https://dev.epicgames.com/community/learning/tutorials/aV59/fortnite-easily-make-a-loot-box-with-verse-uefn-and-blender

1 Like

Hi there, thanks for all the great tutorials you share, however on this particular one… I followed the tutorial and the loot box wont trigger… I am not sure what I have done wrong as I think I have reproduced everything accurately.

here’s the code:

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

GameManager := class(creative_device):
@editable
PS1:player_spawner_device = player_spawner_device{}

@editable
LootBoxButton: button_device = button_device{}

@editable
LootBoxLid: creative_prop = creative_prop{}

@editable
LootGranter: item_granter_device = item_granter_device{}

@editable
VFX: vfx_spawner_device = vfx_spawner_device{}

OnBegin<override>()<suspends>:void=
    
    LootBoxButton.InteractedWithEvent.Subscribe(OnLootBoxButton)
OnLootBoxButton(Agent: agent): void=
    spawn:
        RotateBoxLid(Agent)
RotateBoxLid(Agent: agent)<suspends>:void=
    #disable the button
    LootBoxButton.Disable()
    loop: 
        LidTransform:transform = LootBoxLid.GetTransform()
        Rotation:rotation=LidTransform.Rotation
        LootBoxLid.MoveTo(LidTransform.Translation, Rotation.ApplyLocalRotationY(-1.0), 0.5)
        NewRotation:rotation=LidTransform.Rotation
        YPR:= NewRotation.GetYawPitchRollDegrees()
        if(YPR[0] >= -90.0):
            LootGranter.GrantItem(Agent)
            VFX.Disable()
            break

The LootBox folder contains the following:

  • DeliveryBag (blueprint prop)
    • Button
    • LootBoxLid (blueprint prop)
    • LootGranter
    • VFXSpawner

When I launch the client, everything appears to work, however when I try to interact with the button… nothing happens. The Lid does not rotate open, and the item spawner does not respond.

Any idea where I have gone wrong… your help would be much appreciated.

Quick Update… having defined the editables, I neglected to select them in the device settings.

Problem solved … it all works :slight_smile: