Inventory

From The DarkMod Wiki
Jump to navigationJump to search

Overview

This article describes how to set up inventory items and how they can be given to an entity. The purpose of the inventory is, to keep track of all items that are in an entities possessions. I delibaretly use "entity" here because, in principle, all entities can have an inventory, even though it may only make sense for AI and the player to actuall have one. For future improvements it might be usefull for other purposes as well though. Also included is a script interface, so that a mapper can interact with the inventory in a more sophisticated way, if the default implementation is not sufficient.

Definitions

The spawnargs can be either set in the def file as a default, or in the map file to override settings for specific entities. Naturaly this also means that they can be manipulated by scripts as well, since they are the standard way of configuring objects in Doom 3.

There are several terms and types of items that can be used in the inventory:

anonymous items Gold coins and all the other (mostly loot) items that are collected but not being used individually.

stackable items These are items that can be stacked in the inventory. This means that the player can acquire multiple instances of such items, but only one entry is shown in the inventory with a counter of how many currently are available. An example would be a health potion. The player can posses more than one health potion at a time and this would be indicated by the counter. Stackable items are identified by setting the stackable property. They also must always use the same name and category. If this doesn't match, they are considered to be of different types. This also allows for dealing out i.e. fake health potions which have no effect or deal damage instead (as an example).

An anonymous object means that it will not show up as a seperate item in the inventory. An example would be normal loot like coins or golden dishes. Since they should not be stored in the inventory as seperate items, they don't need to be displayed either. In this case they only count for the total of loot and are discarded afterwards. Anonymous items also can not be dropped after they went into the inventory because they essentially no longer exist. For the loot count it obviously doesn't matter wether an item is anonymous or not, as all are added up into the loot categories.

Category is a classification of items, to group them together. This allows the player to faster scroll through the inventory because he doesn't have to cylce through all the individual items. For example a category would be 'Readables' where books and scrolls are stored, and another Category would be 'Tools' where lockpicks and other items can be stored. Note that this category is entirely up to the mapper to decide and also is option. it doesn't has any consequence as to the playabillity and is only a convenience for the player. Categories can switched of on the HUD, so that the player can use the inventory also in the Thief style (which is the default).

Spawnargs

  inv_name : string
  describes the name that the object should display when it is activated in the inventory.
  example: "inv_name" "Health Potion"
  inv_icon : D3 path to icon
  Points to an icon that is to be displayed when the object is selected in the inventory.
  This entry also determines wether an object is to be considered anonymous or not.