Setting loot dropping at a drop point¶
In this tutorial, you will learn how to set loot dropping at a drop point by using the Loot Drop component.
Select an object in the scene to be an loot 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.
Add an Loot Drop component to the object by choosing + Feature>Gameplay>Loot Drop. Then the component's pane appears in the Properties window.
Configure the drop point in the Loot 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.
You can also find the trigger box displayed in the Properties window:c Configure basic drop settings:
- Repeat: We set this to 1st time in one Round, so the loot drops once only when a player enters the trigger box the first time in a round.
- Expire: We set the time period to 1min so the loot will expire after 1 minute if not picked up.
- Drop Mode: We choose Weight Function to let the loot 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 Loot Drop.
In the new Drop Settings property configure the loot to be dropped:a Click + New Loot to start configuring the dropped loot.b Select an item or equipment to drop. If you haven't created any before, click My Resource>Gameplay library 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 loot amount to be dropped. We set it to 1.d Set the drop weight. We set it to 3.
We complete setting the loot 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.
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 the loot that is within a certain radius can be picked up. The default distance is 3 meters, to change the distance, see Inventory.
Now it's time for you to set up your drop points and the loot before playtesting in Play Mode!