How do I make a chest in which I can store items and get them back later?

From OHRRPGCE-Wiki
Jump to navigation Jump to search
Revise.png
This article does not meet the standard of quality we would like to have. Feel free to revise it and make it better by using the edit link at the top of the page. This tag should be removed when an editor feels it is of high quality.

There is no built-in feature for item storage.

However, if you are willing to learn a lot of plotscripting, it is possible to fake this feature. You will need to set aside global variables for storing a reserve of each possible item. Since there are 255 possible items, it would probably be better for you to use read global and write global rather than using normal named global variables. Here is some example code for moving an item into a global variable (note, this example does not work by itself! it is just an example of the kinds of commands you will need to understand!)

define constant(50, itemvars) # store items in globals 50 thru 305

script, store item, item=0, how many=1, begin

  # do not proceed unless you actually have the item
  if(inventory(item)) then, begin

      # if your inventory is less than the amount to move, just move them all
      if (inventory(item) << how many) then (how many := inventory(item))

      # remove the item from your inventory
      delete item(item, how many)

      # add the item to the storage global variable
      write global(itemvars+item, read global(itemvars+item) + how many)

  end
end

The above script is only a small part of the solution for this problem. You also need a similar script to retrieve items from storage, and far more difficult, you need an user-interface so the player can choose which items to store and retrieve. The problem of creating a user-interface for item storage is related to the problem of creating a user-interface for a unique battle system.

See Also[edit]