Multiple Inventory Items: Difference between revisions
From Sierra Wiki
Jump to navigationJump to search
No edit summary |
m (1 revision imported) |
(No difference)
|
Latest revision as of 23:34, 2 June 2024
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:
<syntaxhighlight lang="agi">
- include defines.txt
if (moss > 0 && !has("moss")) { get("moss"); }
if (moss == 0 && has("moss")) { drop("moss"); }
</syntaxhighlight>
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");
).