Custom items

Adventures comes with a list of predefined items, but you can define your own custom items to use in your stories.

Items are defined in the configuration of the story. In Twine 2, in the view of your passages, click on the name of your story in the bottom-left of the screen then click on Edit Story Javascript. In it, you can put, for example:

window.config = {
    "items": [
        {
            "tag": "sword",
            "name": "Steel Sword",
            "x": 1, "y": 107
        },
        {
            "tag": "shield",
            "name": "Shield",
            "x": 2, "y": 71
        },
        {
            "tag": "red-potion",
            "name": "Health Potion",
            "x": 4, "y": 41
        }
    ]
}

The tag field is the “programming” name you will use in other function calls, you should only use lowercase alphanumeric characters and use - instead of whitespace. The name field is the “pretty” name that will be displayed in-game.

x and y represents the coordinates of the item in the spritesheet. You can use the Item chooser to find the coordinate of a specific sprite.

You can add as many items as you want (don’t forget the trailing , after each item’s closing }).