How to define item required

This configuration defines required items for specific loot types. Players must have these items in their inventory to interact with certain lootable entities.

Purpose:

  • Adds realism and progression by requiring specific tools or items for interaction.

  • Limits access to certain loot types based on player readiness or inventory.

Example Configuration:

Config.lootTypeItemNeeded = {
    ['prop_loot'] = {items = "blowtorch", label = "You need a charged blowtorch to interact", remove = true},
    ['car_loot'] = {items = "wrench", label = "You need a wrench to search this car", remove = false},
}

Explanation:

  • items: The name of the item required to interact with this loot type (e.g., blowtorch or wrench).

  • label: The message displayed if the player does not have the required item.

  • remove: If true, the specified item will be consumed (removed from the inventory) after interaction.

Use Case:

  • A player cannot search a vehicle (car_loot) without a wrench in their inventory.

  • If they try to loot a box (prop_loot), they must have a blowtorch. The blowtorch can optionally be removed after use if remove is set to true.

Required Item Check:

  • The script checks if the player has the required item (e.g., blowtorch) specified in lootTypeItemNeeded['prop_loot'].

Last updated