Multiple Inventory Items: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
m 1 revision imported
Andrew Branscom (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<div align="center"><span style="font-size: 22pt">Multiple Inventory Items</span><br />
<div align="center"><span style="font-size: 22pt">Multiple Inventory Items</span><br />
''By [[agiw:Andrew Baker|Andrew Baker]]''</div>
''By [[Andrew Baker|Andrew Baker]]''</div>


&nbsp;
&nbsp;

Latest revision as of 19:14, 1 April 2025

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");).