Loot Rewards and Chances

Chance Explained

  • Each item in the loot table has a chance value. This is the probability (in percentage) of the item being selected during the looting process.

  • The chance value for an item represents the likelihood that it will appear, compared to other items in the loot table.

For example:

{name = "drink_water", chance = 15, min = 1, max = 3},
{name = "308win", chance = 5, min = 1, max = 2},
{name = "bag_camper", chance = 20, min = 1, max = 1},
  • "Drink water" has a 15% chance of being selected.

  • "308win" has a 5% chance of being selected.

  • "Bag camper" has a 20% chance of being selected.


Why the Total Chance Cannot Exceed 100%

The total of all chance values in a loot table must not exceed 100%. This is because the system generates a random number between 1 and 100 to decide which item will drop. If the total chance exceeds 100%, the logic becomes inconsistent, leading to errors or unintended behavior.

Example of Correct Configuration:

{name = "item1", chance = 30, min = 1, max = 3},
{name = "item2", chance = 50, min = 2, max = 4},
{name = "item3", chance = 20, min = 1, max = 2},
  • Total chance: 30% + 50% + 20% = 100%. This configuration works as intended.

Example of Incorrect Configuration:

{name = "item1", chance = 60, min = 1, max = 3},
{name = "item2", chance = 50, min = 2, max = 4},
{name = "item3", chance = 20, min = 1, max = 2},
  • Total chance: 60% + 50% + 20% = 130%. This exceeds 100% and will cause errors.

When the total chance is below 100%, the system will generate "empty" slots for the remaining percentage. For instance, if the total


How to get empty loot?

When the total chance is less than 100%, the system fills the remaining percentage with "empty" slots. These empty slots represent unsuccessful loot attempts, simulating a more realistic and less predictable looting experience.

Example with Empty Slots:

lConfig.LootRewards["prop_loot"] = {
    loop = 2,
    refreshTime = 5,
    {name = "drink_water", chance = 40, min = 1, max = 3},
    {name = "308win", chance = 30, min = 1, max = 2},
}
  • Total chance: 40% + 30% = 70%.

  • Thereโ€™s a 30% chance of finding nothing in each iteration.


The loop Feature

The loop feature controls how many times the loot logic runs for a single loot interaction. Each iteration of the loop gives players another chance to receive an item. This creates the possibility of receiving multiple items from a single lootable entity.

  • How it works:

    • The script runs the loot logic loop times.

    • For each iteration, the system checks the item's chance and decides whether the item will drop.

Example:

luaKodu kopyalaConfig.LootRewards["prop_loot"] = {
    loop = 3,  -- Run the loot logic 3 times.
    refreshTime = 5,
    {name = "drink_water", chance = 30, min = 1, max = 3},
    {name = "308win", chance = 15, min = 1, max = 2},
}
  • In this case, the loot system will run 3 iterations.

  • On each iteration, the script will randomly decide whether to drop "drink water" (30% chance) or "308win" (15% chance).

Purpose of the loop Feature:

  • Increases the chances of obtaining multiple items during a single loot interaction.

  • Adds variability to looting outcomes, making the process more dynamic and rewarding.


Combining loop with loopIncrease

The loopIncrease feature works with predefined zones (Config.lootIncreaseZones) to give players even more chances to loot additional items.

Example:

luaKodu kopyalaConfig.LootRewards["prop_loot"] = {
    loop = 3,           -- Default iterations: 3
    loopIncrease = 2,   -- Add 2 more iterations in lootIncreaseZones.
    refreshTime = 5,
    {name = "drink_water", chance = 30, min = 1, max = 3},
    {name = "308win", chance = 15, min = 1, max = 2},
}
  • In regular zones, the loot logic runs 3 times.

  • In lootIncreaseZones, the script adds loopIncrease to the default loop value, making it 5 iterations.

This makes looting in specific zones more rewarding and encourages players to explore high-risk or high-reward areas.


Refresh Time

The refreshTime determines how long (in minutes) it takes for a lootable entity to reset and become lootable again.

Example:

Config.LootRewards["car_loot"] = {
    loop = 2,
    refreshTime = 10,
    {name = "loot_escrap", chance = 100, min = 1, max = 3},
}
  • Players can loot car wrecks every 10 minutes.

  • After being looted, the entity enters a cooldown period where it cannot be interacted with.

Adjust refreshTime Based on Importance:

  • For common loot types, use shorter refresh times (e.g., 5 minutes).

  • For rare or valuable loot, increase the refresh time to limit over-farming.

Last updated