Why doesn't my item spawner work?

Hello,

I’ve been following the tutorial as I get started with verse, I’ve bad a button that’s supposed to spawn and item. The code, taken from the tutorial is this:


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

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

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

    @editable
    Button:button_device = button_device{}
    @editable

    ItemSpawner:item_spawner_device = item_spawner_device{}

    OnBegin<override>()<suspends> : void =
        Print("Verse Code Started")
        Button.InteractedWithEvent.Subscribe(OnButtonInteractedWith)


    OnButtonInteractedWith(InPlayer:agent) : void =
        Print("Button pressed")
        ItemSpawner.SpawnItem()
            Print("Cancelled this InteractedWithEvent")

As you can see when the button is interacted with a message is printed to say it was prssed and then the SpawnItem function is called. The problem is, it doesn’t do anything, I can see that the printed messages are met but nothing ever spawns

ON my hello_world_device I have ensured that both the button and the spawnitem devices are selected in the variables ( I even doubled down on this by selecting them with the dropper just to be sure ).

Am I missing a really simple piece of the puzzle here?

Verse looks good, got anything in your spawner?

I had not selected an item to spawn specifically, I had set it to random assuming that would be enough. I defined a shotgun just now for testing and that’s it working now. Such a simple thing and it wasn’t in the documentation. Thanks @GraemeBB

1 Like

You’re welcome :slight_smile:

Hi @Yanayaya ,

Can you post a link to the document you were using for this? If it’s ours I want to make sure it’s correct.

@capen_r this is the tutorial he was following, I have the same issue, it looks like a bug

Thank you! I’ve reported that and we’ll make sure it gets fixed.

Glad to see this will be fixed soon, recently checked out this tutorial and ran into the same issue, since the documentation only says to drop the spawner in and not specify any items to spawn.

The second half of the tutorial still has issues though. I’m encountering the same as the user here: Coding Device Interactions Instructions Don't Seem to Work

I had this same question about the tutorial. The Verse code is correct, so I had to made some settings in the UEFN “Details” about the “Item Spawner” device:

  1. User Options → Unmark the “Spawn Item on Timer” and “Respawn Item on Timer”
  2. User options → Item List → Add an item in the “Array Element”
1 Like

@acarolinamat Looks like your settings are correct, I tried them out.
Example shown in the tutorial now works.
Thank you so much ! :hearts:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.