Thursday, 11 October 2012

Varytale Tutorial: Statistics and Equippable Items

Well, it's been a while. It's always been a while between blog posts, mostly because I can usually fit what I want to say into a few tweets. I'm back and writing because I have a lot more than a few multiples of 140 characters.

I received an email today asking about the statistics and. inventory mechanics of Sixth Tower. It's been quite a while since I touched Varytale so have had to do a little study but I think I remember and understand what I did. Mostly, heh. Anyway, I could respond privately but why contain the knowledge? And I do vaguely recall I considered doing a tutorial on exactly this subject previously but thought that no-one would be interested.

What I do with Varytale is... odd. It's really not what the system is intended for but it's one of the great strengths of VT that it is possible to do all manner of weird stuff with it. I'll be using examples from Sixth Tower. This tutorial assumes at least a basic understanding of the tools and isn't recommended for new authors.  Frankly, I wouldn't recommend it anyone, myself included.

Enough blathering, here's the lesson!


Now would be a good time for you to open up Sixth Tower. Play up to 'A Something Introduction' at least if you haven't already.

You'll see something like this on the left. In the Book Settings document, this is written as:

page-area: C
title: Character
style: small, strong

page-area: C
title: Equipped

page-area: C
title: Talents
style: small

Character details are just Qualities set to various number values during the character prologue. Remember, quality names are defined with Value Sets (the standard, for displayed here, is @ranges). Here Gender (chargender) is 2. For example:

short-name: chargender
tags: character, attribute, gender
view-if: chargender > 0
initial: 0
in-sections: character 
Male or female? Sometimes it's anyone's guess. 
(1) Male
(2) Female
(3) Other
 Talents work the same way, but are even more simple. They are just qualities with no defined Value Set, which are set to at least 1 when a class is chosen.


In Sixth Tower there are three main types of items: usable, equipable and non-equipable.

In this inventory to the left, the Mobile is useable. The Pistol and Reading Glasses are equipable. Shards, the Empty Notebook, Package of Chalk and Currency are non-equipable.

The simplest, non-equipable items, are just a single quality which keeps track of how many of the given item a player possesses. They might be required for storylets or branches but otherwise there's nothing else that needs doing with them.

Usable items have two elements: the 'how many of these does the player have' quality like any other (which is NOT displayed, not ever) and an associated storylet which, instead of appearing in the main area (area A), appears in the Equipment list (under area C). That storylet includes actions to use, or perhaps examine, the item. You can use the same concept for books, notes or spells (teleport?) or perhaps memories.

There is significantly more involved in Equipable items. There are three elements required for an equipable item, described below. In brackets are (an example).

  • An 'item owned' quality (WeaponPistol)
  • An 'equipment slot' quality (EquippedHands)
  • The 'equip items' storylet (Equip Items)
As always, 'item owned' qualities merely keep track of how many of a given item the player owns. The 'equipment slot' quality keeps track of which item is current equipped. The storylet allows the player to manage which item in each slot is currently equipped.

The Equip Items storylet can get extremely complicated looking but for each item only two branches are required:
  • Equip item
  • Un-equip item
Let's have a look at those first two in detail. Firstly, how to Equip Item, specifically a pistol.
view-if: weaponpistol >= 1 and EquippedHands = 0
choose-if: EquippedHands != 11
quality-changes: EquippedHands = 11; powerelemental += 1
goto: choices 
*You have equipped a pistol.*
What is happening here is the branch is only displayed if the player owns a pistol and has nothing equipped in their hands; it is choose-able if a pistol is not already equipped (EquippedHands = 11 indicates a pistol is equipped); the branch equips the pistol and increases Elemental by 1 point. 'Goto: choices' returns the player immediately to the Equip Items menu, should they want to equip/unequip something else.

So, if a pistol is equipped and you want to instead equip some other hands-slot item? Unequip it.

view-if: EquippedHands = 11
quality-changes: EquippedHands = 0; powerelemental -= 1
goto: choices 
*You have un-equipped your pistol.*
And this undoes everything that is changed by equipping the pistol. ALWAYS double, triple check that unequipping an item undoes any changes equipping it makes, or you break the game by allowing the player to infinitely increase or decrease their stats.


I hope that is of some use and interest. If I've missed anything you would like me to cover, on this topic or something else you've seen done on my books, drop a request in the comments.

1 comment:

  1. i dont know if it was the length and detail of the video but I could have redrawn my weapons on all my sprites in about have this time. Might bloat the game size but pixel art takes long enough on its own; no need to spend another multiple hours calculating the offset of every frame. imho. great tut though. bookmarked for later.