Skip to content

Add a loot table

On a map with a BP_ZoneManager, such as Pine Hollow, a container placed in the map is filled from a loot table the first time it loads. The table is picked by room, by furniture or both, and the draw is made once per world, scaled by the loot game options.

Steps

  1. In Content/ZombieSurvival/DataAssets/Loot/Childs/, create a Data Asset of the class PDA_LootTable, named DA_LootTable_<Name>. Nine tables ship there.
  2. Say where it applies: a room type, furniture, or both.
  3. Fill Entries and the number of draws.
  4. Add the table to Tables in DA_LootSettings_Default, in the same folder.
  5. For a new room type, declare a Room.* tag in Edit > Project Settings > Gameplay Tags and set it on the BP_RoomVolume of the rooms it names.
Field What it does
RoomType A Room.* tag, the room it applies to: Kitchen, Bedroom, Bathroom, Living, Garage, Office, Shop.Grocery, Shop.Hardware, GasStation or Outdoor. Empty for any room.
Furniture The furniture definitions it fills. Empty for any container.
Entries One row per item: ItemDef, Weight, MinCount, MaxCount.
RollsMin, RollsMax The number of draws.

A weight is relative to the other entries of the table. The game option of the item's category multiplies it, from 0 to 2: Sandbox.World.FoodLoot for food and drink, WeaponLoot for weapons and ammunition, OtherLoot for the rest.

An item you add to the game is found on Pine Hollow only once a table lists it. ExcludedItems, in DA_LootSettings_Default, lists what should never be found in a container: the key, which the houses and the cars place, the furniture you carry as an item, the generator, what only comes from fishing and foraging, and the five Farming books while the skill is not listed.

Which table wins

A table that names both a room and furniture wins over a table that names the room only, which wins over one that names the furniture only. A kitchen fridge takes Kitchen + Fridge if it exists, then Kitchen, then Fridge. With none, the container stays empty.

A container filled by hand keeps its contents. Do not fill a container of a large map by hand.

Test it

  1. Open Content/ZombieSurvival/Maps/L_Boot and press Play.
  2. Choose NEW GAME, pick Pine Hollow, and start a new world.
  3. Walk into a room of the type your table names, and search a container with E. Its contents come from your table.

The host fills at most LootPerTick (10) containers per tick, so a district that loads at once is filled over a few seconds.

If it does not work

  • A container holds what it held before your table: the world is not new. A world already played keeps what its containers drew.
  • No container is filled: the map has no zone manager. Its containers come from a spawn plan instead.