Pages

terça-feira, 13 de junho de 2023

Item Spawner device

In this article we will start configuring the Item Spawner device. Our level will have several Item Spawner devices that will be used to generate the coins that the player needs to collect.

Access the Content Drawer and the CollectGame Content > Fortnite > Devices folder. Search for itemspawner: 


Drag the Item Spawner on the level and drop to one of the grid positions around the Player Spawner :


We'll be using Verse code to decide when a coin spawns in the Item Spawner, so we're going to disable automatic item spawning. On the Details tab, User Options category, uncheck the Spawn Item on Timer and Respawn Item on Timer properties:


The Item Spawner device can spawn many different types of items. The list of items that can be generated is stored in an array. We will learn more about array in the next article.

In our game the Item Spawner will spawn only one type of item. To add an item to the array, click the + button in the Item List row on the Details tab. 


Click on the small arrow next to Index [ 0 ] to access the item's properties. Note that the first element of an array is stored at position 0. Click on the Pickup to Spawn dropdown and look for the item labeled Gold.

Only two properties of the Item Spawner remain to be modified. Look for Run Over Pickup and Allow Spawning when Blocked in the Details tab. Check these two options:


Run Over Pickup means the player doesn't have to press a button to collect the item. Allow Spawning when Blocked means that the item will spawn even if the player is on top of the Item Spawner device.

Save the level.

In the next articles, we will create an array in our Verse device to store the level's Item Spawners. We will also see how to create tags to retrieve the Item Spawners and fill the array automatically using Verse code.


Table of Contents Verse