Tutorial #1: Adding Data, Part 1

By Jamis Buck (minam@rpgplanet.com)
doc version 1.0

This tutorial assumes that:

  1. You have read the Basilisk scripting documents, at the very least the documents about the data file format.
  2. You have copied the "dat/standard" subdirectory to a new subdirectory named "dat/tutorial".
The goal of this tutorial is to add a new weapon to the data set. The weapon has the following statistics:
Spiked Fist: 7 gp, 1d3 damage, critical 20/x2, 1 lb, tiny, piercing damage.
By the end of this tutorial, you should be able to add a weapon to the data file, and include it in the random weapon tables that the treasure generator uses to generate treasures.

All weapons are defined in the "weapons.bsk" file. The original file should be in the "dat/standard" subdirectory of your treasure generator directory, but you should be working on a copy of the data. Locate the weapons.bsk file and open it in a text editor or word processor. (Note that although a word processor will work for this, it is best to use a text editor, like notepad).

You will notice that this file begins with a big list of all the weapons. It should look something like this:

template in ( groupWeapon ) { name cost damage criticalRange criticalMultiplier weight size sources }
  weaponAdamantineBattleaxe { "adamantine battleaxe"  9310 gp  1d8  20  3  7 lb  medium sourcesCoreRules }
  weaponAdamantineDagger { "adamantine dagger"  3302 gp  1d4  19  2  2 lb  tiny sourcesCoreRules }
  weaponArrow { "arrow"  5 cp  $ $ $  3/20 lb  tiny sourcesCoreRules }
  ...
end
You will notice that, between the curly braces '{' and '}' is a list of "attributes". These attributes are properties that describe a weapon. Some weapons have more than this, and some weapons don't have all of these, but, in general, these are the attributes common to weapons. Here's what they each mean: Create a new line in the list, immediately after the line that starts with the word "template". The first word on the line (as on the other lines) is the weapon's "identifier". This is a one-word (no spaces) identifier that you are giving to this weapon, and by which it will be referenced in the data file. This is not the name of the weapon. You will note that all other weapons begin with the word "weapon" followed by the name of the weapon, with each new word capitalized and all spaces removed. You are encouraged to name your weapons the same way, although you do not have to. For this tutorial, name the weapon "weaponSpikedFist".

After the name, type an opening curly-brace '{'. This begins the attribute list of a thing. The first attribute, as mentioned above, is the name of the weapon, so type (including the quotes) "spiked fist". Following the name is the price (7 gp), then the damage (1d3), then the critical range (20), the criticalMultiplier (2), the weight (1 lb), the size (tiny), and lastly the sources . . . but this item does not come from any published source. You can either create a new source to describe your additions, or just omit the source from this thing. For this tutorial (and for the sake of simplicity) we will simply omit the source, so instead of a source name, just type the $ character. This makes Basilisk "leave out" that attribute. Be sure and close the attribute list with a closing curly-brace '}'.

You should have something that looks like this, now:

template in ( groupWeapon ) { name cost damage criticalRange criticalMultiplier weight size sources }
  weaponSpikedFist { "spiked fist"  7 gp  1d3  20  2  1 lb  tiny  $ }
  weaponAdamantineBattleaxe { "adamantine battleaxe"  9310 gp  1d8  20  3  7 lb  medium sourcesCoreRules }
  weaponAdamantineDagger { "adamantine dagger"  3302 gp  1d4  19  2  2 lb  tiny sourcesCoreRules }
  weaponArrow { "arrow"  5 cp  $ $ $  3/20 lb  tiny sourcesCoreRules }
  ...
end

Now, we need to categorize the weapon as a "piercing weapon". Near the bottom of the file, there is a category named "groupPiercingWeapon". It contains a list of all weapons that cause piercing damage. Remember the identifier for the new weapon we just added, the one with no spaces, that starts with the word "weapon"? You'll add that to this list. Just create a new line immediately after the line that says "category groupPiercingWeapon" and type "weaponSpikedFist". The category should now look something like this:

category groupPiercingWeapon
  weaponSpikedFist
  weaponDagger weaponPunchingDagger weaponSpikedGauntlet weaponHalfspear 
  weaponShortspear weaponLightCrossbow weaponDart weaponHeavyCrossbow 
  weaponJavelin weaponLightLance weaponLightPick weaponShortSword 
  weaponHeavyLance weaponHeavyPick weaponRapier weaponTrident 
  weaponHalberd weaponLongspear weaponRanseur weaponScythe weaponShortbow
  weaponCompositeShortbow weaponLongbow weaponCompositeLongbow 
  weaponHalflingSiangham weaponSiangham weaponGnomeHookedHammer 
  weaponSpikedChain weaponDwarvenUrgosh weaponHandCrossbow weaponShuriken
  weaponRepeatingCrossbow weaponMightyCompositeShortbow1 
  weaponMightyCompositeShortbow2 weaponMightyCompositeLongbow1 
  weaponMightyCompositeLongbow2 weaponMightyCompositeLongbow3
  weaponMightyCompositeLongbow4
end
Since a spiked fist is a melee weapon, we also need to add the identifier to the groupMeleeWeapon category, so be sure to do that, too, in the same way that you did the groupPiercingWeapon category. Be sure to save your changes!

Congratulations! The Spiked Fist is now a weapon in the Basilisk file! However, before the item will actually be used by the treasure generator as a valid weapon in a treasure, you need to modify the random weapon tables and add the weapon there. The random weapon tables are located in the mundane.bsk file, so you'll need to open that file next.

As the Spiked Fist is not a common melee weapon, we should probably add it to the uncommon weapons category. Look for a category named "groupUncommonWeapons". There will be a big long list of many different weapons, with a number in front of each identifier, in square brackets '[' and ']'. It should look something like this:

category groupUncommonWeapons
  [ 3] weaponOrcDoubleAxe
  [ 4] weaponBattleaxe
  [ 3] weaponSpikedChain
  [ 2] weaponClub
  [ 4] weaponHandCrossbow
  [ 3] weaponRepeatingCrossbow
  ...
The number before each identifier is that item's weight. The greater the weight, the more likely the item is to be selected. No item can have a weight that is less than 1, and all items must be integers (for example, 3.5 is not a valid weight, but 3 and 4 both are).

We now need to decide how likely it is to randomly find a spiked fist. This will vary from campaign to campaign, but for now we choose 3, making it about as likely as a spiked chain or a repeating crossbow. We add a new line at the top of the list, first with the number 3 in square brackets, followed by "weaponSpikedFist". The result should look like this:

category groupUncommonWeapons
  [ 3] weaponSpikedFist
  [ 3] weaponOrcDoubleAxe
  [ 4] weaponBattleaxe
  [ 3] weaponSpikedChain
  [ 2] weaponClub
  [ 4] weaponHandCrossbow
  [ 3] weaponRepeatingCrossbow
  ...
Lastly, we just need to compile the new data file and generate treasures! To do this, open the treasure generator, select "Compile Database" from the "Tools" menu, and press the "..." button to browse until you find the "index.bsk" file in the "dat/tutorial" directory. Add the "dat/tutorial" directory to the list of directories in the bottom half of the dialog box, and then click "Compile". If you made any errors in typing the data in, they will show up in the console window, otherwise you will get a message box saying that the data compiled successfully. Now, generate a few treasures and see if you can come up with a magical spiked fist!

You will probably notice that the spiked fist will be very rare. To make it more common, you can move it from the "groupUncommonWeapons" category to the "groupCommonMeleeWeapons" category, and/or give it a greater weight. Experiment and see what you get!

Back to the tutorial index


Last modified on 14 Feb 2001 by Jamis Buck (minam@rpgplanet.com)