Quickly create a loot box in UEFN with Verse for Fortnite

This is a slightly simplified and shortened version of the video tutorial from Graeme Bull on how to add your own custom loot box to the Fortnite map.

We will assume that you already have a model that you would like to use as a loot box, in fbx or glb format. Import this model into the Content Drawer, preferably in a separate folder so that everything is more structured. After importing, you will most likely have 3 files. Add a new Blueprint Class – Building Pror to the same folder. In the window that opens on the left, select the Static Mesh Components item and in the settings block on the right, in the Static Mesh section, select our model (it will have the same name as the model file.). Compile and save. Close this window.

Next, add the Button and Item Granter devices, drag our created material and place our loot box next to the Item Granter (of course, if you don’t want to run for loot to the other end of the map). We “press” the Button button into the middle of the loot box model, for interactivity, uncheck the Visible During Game checkbox and set the Interaction Radius (radius around the button when it becomes active) to the one you need, you will see it visually.

For Item Granter On Grant Action it is better to set Keep All, Grant – Current Item, in Item List add everything you want to be in the loot, Drop Items at Player Location it would be more logical to set to Always. You can do all other settings at your discretion.

Create a Verse script. In the top panel go to Verse – Verse Explorer and right-click and select Add new Verse file in Project. In the new popup select the Verse Device type, name it, for example box_manager, click Create and do the following filling.

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

box_manager := class(creative_device):

    @editable
    var LootBoxButton:button_device = button_device{}

    @editable
    LootGranter:item_granter_device = item_granter_device{}


    OnBegin<override>()<suspends>:void=
        LootBoxButton.InteractedWithEvent.Subscribe(OnLootBoxButton)

    OnLootBoxButton(Agent:agent):void=
        spawn:
            RotateBoxLid(Agent)

    RotateBoxLid(Agent:agent)<suspends>:void=
        LootBoxButton.Disable()
        loop:
            LootGranter.GrantItem(Agent)
            break

Save the file, go to Verse – Build Verse Code, this will be a kind of compilation of our script, if there are no errors then everything is great, let’s move on.

In the Content Drawer, in the folder with the name of your project, a new Verse Class icon will appear with the name from our example – box_manager. Drag it anywhere on the map, although in order not to confuse anything it is better to put it next to our loot box. Click on the device and see several device settings.

We immediately remove the checkbox from Visible in Game, so as not to mess with working devices in the game, and make sure that there is a checkbox next to Enable At Game Start. Below we see the settings for selecting our “hidden” button for the loot box and for the Item Granter. I advise you to immediately set unique names for the button and item granter (right-click on the object in the Outliner – Edit – Rename) and then simply use the select to find the desired button and granter by this name.

We save all our changes and launch a session with the map for verification.

Of course, if you want, you can find this tutorial on YouTube and make it complete, with opening the lid, visual effects, but for this you will need a suitable model.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *