Items
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.
tag | name | icon | tag | name | icon |
---|---|---|---|---|---|
dagger | Dagger | fire-dagger | Fire Dagger | ||
bow | Bow | fire-bow | Fire Bow | ||
axe | Axe | fire-axe | Fire Axe | ||
scepter | Scepter | fire-scepter | Fire Scepter | ||
sword | Sword | fire-sword | Fire Sword | ||
shield | Shield | wooden-shield | Wooden Shield | ||
pavise-shield | Pavise Shield | targe | Targe | ||
holy-shield | Holy Shield | golden-shield | Golden Shield | ||
small-red-potion | Small Red potion | red-potion | Red potion | ||
big-red-potion | Big Red potion | small-green-potion | Small Green potion | ||
green-potion | Green potion | big-green-potion | Big Green potion | ||
feather | Feather | bat-wing | Bat Wing | ||
bird-beak | Bird Beak | long-bird-beak | Long Bird Beak | ||
book | Book | map | Map | ||
scroll | Scroll |