Skip to content

Setting item dropping at a drop point

Overview

In this tutorial, you will learn how to set item dropping at a drop point by using the Item Drop component.

Steps

  1. Select an object in the scene to be an item drop point and open the Properties window by choosing the More icon. In our example, we choose rock2(1) close to the default respawn point as a drop point in the template scene Summer Forest.

  2. Add an Item Drop component to the object by choosing + Component>Gameplay>Item Drop. Then the component's pane appears in the Properties window.

    Item drop

  3. Configure the drop point in the Item Drop pane:

    a Set the trigger object and condition. In our case, we leave the object itself as the trigger and set the condition to On Enter. Then the component is triggered when a player enters the trigger box. For more details on trigger settings, see Trigger.

    b You will be prompted to add a trigger box. In the Set up trigger box dialog, click Set up Now to attach a pre-generated trigger box to the drop point.

    Set up trigger box

    You can also find the trigger box displayed in the Properties window:

    trigger box

    c Configure basic drop settings: basic drop settings

    • Picker: We set this to All players to allow all players to pick up dropped items.
    • Repeat: We set this to 1st time in one Round, so items drop once only when a player enters the trigger box the first time in a round.
    • Expire: We set the time period to 1min so items will expire after 1 minute if not picked up.
    • Drop Mode: We choose Weight Function to let items drop with a weighted probability. The drop rate is the drop weight divided by the weighted sum. Then a new Drop Settings property for further configurations appears below. For more information on these settings, see Item Drop.
  4. In the new Drop Settings property configure items to be dropped:

    a Click + New Item to start configuring the dropped item.

    b Select an item to drop. If you haven't created any items before, click Go Gameplay-Item and create one. In our case, we select item Blue Lilies by choosing and renaming the existing model flowers_blue from My Collections.

    c Specify the item amount to be dropped. We set it to 1.

    d Set the drop weight. We set it to 3.

  5. We complete setting an item to drop at this point. Since we would like 3 items to drop in total, we repeat Step 4 and set the rest:

    • Mushroom (model mushroom04_c) with item amount 2 and drop weight 5, and
    • Short Grass (model grass_short01) with item amount 3 and drop weight 2. Droppable item list

As a result, the weighted sum is 10 (3+5+2). When a player enters the trigger box the first time in a round, this player has a 30% (3/10) chance of getting 1 Blue Lilies, a 50% (5/10) chance of getting 2 Mushroom, and a 20% (2/10) chance of getting 3 Short Grass.

Note: Only items that are within a certain radius can be picked up. The default distance is 3 meters, to change the distance, see Inventory.

Setting item dropping

Now it's time for you to set up your drop points and items before playtesting in Play Mode!