How to define loot to entity?

This defines a list of entity models (props) that players can interact with for looting. Each model is mapped to a loot type, determining the kind of lootable rewards it provides.

Purpose:

  • Specifies which world objects can be looted.

  • Associates each object with a defined loot type in the configuration.

Example Configuration:

Config.LootAbles = {
    ['prop_box_wood01a'] = "prop_loot",
    ['prop_box_wood08a'] = "prop_loot",
    ['prop_rub_carwreck_3'] = "car_loot",
}

Lootable Check:

  • The script identifies the entity model (prop_box_wood01a) and matches it to the prop_loot type in LootAbles.

Explanation:

  • Keys: The model names of objects or entities in the game (e.g., prop_box_wood01a, prop_rub_carwreck_3).

  • Values: The loot type associated with the model (e.g., prop_loot, car_loot).

Use Case:

  • A wooden box (prop_box_wood08a) is lootable and uses the prop_loot rewards table.

  • A car wreck (prop_rub_carwreck_3) is lootable and uses the car_loot rewards table.

How It Works: When a player approaches an entity, the script checks if its model exists in the LootAbles list. If it does, the script allows interaction and determines the loot type.

Last updated