Skip to content

Inventory code implementation #42

@culacant

Description

@culacant

Inventory scripting should be handled by an InventoryManager class.
This should contain a list of the items the player has, with the Id and amount of the item the player has in his inventory.
One item can be active/selected, think of keys to open doors. The bitmap for this item will show in the bottom-left corner of the screen.
If the player has a compass, this always shows a bitmap in the bottom-right corner of the screen.

The ITEMS.INI file contains the starting items, anything else will be handled by the map script.
The following functions need to be defined:

  • HaveItem(id) < returns 1 if the player has the item in his inventory
  • AddItem(id, amount) < adds amount of items to the inventory
  • ActiveItem() < returns the Id of the currently selected item
  • SelectItem(id) < sets the currently selected item
  • DropItem(id, amount) < Removes an (amount of) item from the inventory
  • DropAllItems() < same as DropItem but drops everything, used in catacombs when you lose everything
  • UseItem(id) < if the item has a use_script set, this will spawn an RGScriptedObject to run that script.

Investigation backlog:

  • ShowItem(id, UNKNOWN, UNKNOWN) < Same as inspecting item in the inventory; shows the 3D model an plays a sound
  • ShowItemNoRtx(id, UNKNOWN, UNKNOWN, UNKNOWN) < identical to above but without the sound

Way-backlog:

  • HandItem(id) < puts an item in the player's hand. Wielding stuff currently not implemented
  • ItemUsed(id) < never used in the scripts
  • PushItem(id, UNKNOWN) < never used
  • PopItem(id) < never used
  • SubItem(id, UNKNOWN) < never used
  • PushAllItems(UNKNOWN) < never used
  • PopAllItems() < never used
  • RemoveItem(id) < never used

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions