Skip to content

Add an item

You add an Orange Soda, a drink copied from the soda that ships, then register it, put it in a loot table, give it to yourself and check that it survives a save. The how-to page Add an item lists every item field.

Steps

1. Duplicate the soda

  1. In the Content Browser, open Content/ZombieSurvival/DataAssets/Items/Childs/.
  2. Right-click DA_Item_Soda, Duplicate, and name the copy DA_Item_OrangeSoda.

The copy keeps the soda's floor mesh, icon, pickup sound and food definition. Start from a copy rather than a blank Data Asset: a blank one falls back on the class defaults without telling you.

2. Fill the fields

Open DA_Item_OrangeSoda and set:

Field Value What it does
DisplayName Orange Soda the name in the inventory row and in the tooltip
Description A can of orange soda. Sweet, and it quenches thirst. the tooltip text under the name
ItemSaveId OrangeSoda the id the save file stores, and the id you type after /give
ThirstRestore 30 what drinking it gives back

Leave Category on Drink. Save the asset.

Change ItemSaveId

The copy still has the soda's id, Soda. The id is all the save file keeps of an item, so two items with the same id cannot be told apart on load.

The copy also keeps FoodDef = DA_Food_Soda, so your drink ages like the soda. To give it its own shelf life, add a food.

3. Register it

  1. Open DA_ItemRegistry_Default, in the same folder.
  2. Add DA_Item_OrangeSoda to the ItemDefs array.
  3. Save.

An item that is not in this registry works in play but vanishes on save and load, and /give does not find it.

4. Put it in a loot table

Pine Hollow fills each container from a loot table the first time the container loads.

  1. Open Content/ZombieSurvival/DataAssets/Loot/Childs/DA_LootTable_Fridge. It already lists the soda.
  2. In Entries, add an element: ItemDef = DA_Item_OrangeSoda, MinCount = 1, MaxCount = 2, and the same Weight as the soda's row.
  3. Save.

A new table would also have to be listed in DA_LootSettings_Default.

5. Try it

  1. Open Content/ZombieSurvival/Maps/L_World and press Play.
  2. Press T, type /give OrangeSoda 3 and press Enter. Three cans land in your bag.
  3. Press Tab and hover the row: the tooltip shows your name and description.
  4. Left-click the row to drink one. The stack loses a can and your thirst gains 30.

6. Check that it survives a save

Play from the map does not save to a named world, so go through the menu.

  1. Open Content/ZombieSurvival/Maps/L_Boot. Start it as a Standalone Game (the arrow next to Play): in the editor's own Play, Esc stops the game instead of opening the pause menu.
  2. NEW GAME, START, create a character, PLAY.
  3. Type /give OrangeSoda 2 in the chat.
  4. Esc, SAVE GAME, MAIN MENU, then CONTINUE. The two cans are still in the bag.

7. Find it on Pine Hollow

Start another NEW GAME and search the kitchen fridges. The table is a weighted draw, so you may open several before you find a can. A world already played keeps what its containers drew.

The fridges have not been checked in play: only the new row of the table was checked in the editor.

If it does not work

  • /give answers "No item by that id.": the id you typed is not the ItemSaveId, or the item is not in ItemDefs.
  • /give answers "Only the host can do that.": you are a client.
  • The cans are gone after CONTINUE: the item is not in DA_ItemRegistry_Default. The Output Log says Item id '…' read from a save is not in the item registry.
  • No can on Pine Hollow: the world was created before your change, the row's Weight is very low, or the item is listed in ExcludedItems of DA_LootSettings_Default.