Handling items in-game

Adventures comes with a list of pre-defined items you can use in your adventures. They are listed in the section below, and their corresponding tag must be used in the functions below to handle them.

To add an item (for example, a sword) to the player’s inventory, you’d write:

<%
character.inventory.addItem("sword");
%>

To remove an item (if the player has this item in its inventory):

<%
character.inventory.removeItem("sword");
%>

To check if a player has an item:

You approach the main gate of the city

<%
if (character.inventory.hasItem("sword")) {
%>

The soldier notices the sword hanging on your side.

%>
}
%>

In this example, the second sentence will only be displayed if the player has a sword in its inventory.

You can also spawn items in a small chest under the content of the passage. Those items will be draggable by the player to their inventory.

<%
// Those two lines will spawn one chest with two items:
// a sword and a shield
story.addLootItem("sword");
story.addLootItem("shield");
%>

List of items

Adventures comes by default with a list of pre-defined items that you can use in your stories, shown in the table below. The first column (tag) is the name you must use in the functions described above.

tagnameicon tagnameicon
daggerDagger
fire-daggerFire Dagger
bowBow
fire-bowFire Bow
axeAxe
fire-axeFire Axe
scepterScepter
fire-scepterFire Scepter
swordSword
fire-swordFire Sword
shieldShield
wooden-shieldWooden Shield
pavise-shieldPavise Shield
targeTarge
holy-shieldHoly Shield
golden-shieldGolden Shield
small-red-potionSmall Red potion
red-potionRed potion
big-red-potionBig Red potion
small-green-potionSmall Green potion
green-potionGreen potion
big-green-potionBig Green potion
featherFeather
bat-wingBat Wing
bird-beakBird Beak
long-bird-beakLong Bird Beak
bookBook
mapMap
scrollScroll