Multiple Inventory Items

From Sierra WikiNew
Jump to navigationJump to search
Multiple Inventory Items
By Andrew Baker

 

To give the player the ability to carry around more than one of each particular item, first the name of an item is added as a variable in defines.txt:

#define moss v60

A new logic is called from Logic.000 at the end of every cycle.

call(200);

In the body of the new logic:

Code:
#include defines.txt

    if (moss > 0 && !has("moss"))
    {
        get("moss");
    }

    if (moss == 0 && has("moss"))
    {
        drop("moss");
    }

For description in the view editor of the inventory:

You have %v60 pieces of moss.

The variable should be prefix with % to have it print out with the show.obj() description or to embedded it in a string (i.e. print("You have %60 pieces of moss");).