Our discipline array was pretty simple, just a few things to set and keep track of, none of which are going to change over the course of the game. Equipment is going to be a lot harder. There are multiple equipment slots, different items that do different things, and the player is going to pick up, put down, and use them at random intervals. I'm not actually looking forward to this part...
Here are the rules from the book:
Equipment
You are dressed in the green tunic and cloak of a Kai initiate. You have little with you to arm yourself for survival.
All you possess is an Axe (note under Weapons on your Action Chart) and a Backpack containing 1 Meal (note under Meals on your Action Chart). Hanging from your waist is a leather pouch containing Gold Crowns. To find out how many, pick a number from the Random Number Table. This number equals the number of Gold Crowns you possess at the start of the adventure. (Note the number in the Belt Pouch section of the Action Chart.)
You discover amongst the smoking ruins of the monastery, a Map of Sommerlund (note under Special Items on the Action Chart) showing the capital city of Holmgard and the land of Durenor, far to the east. You place the Map inside your tunic for safety.
You also find one of the following:
• 1 = Sword (Weapons)
• 2 = Helmet (Special Items). This adds 2 ENDURANCE points to your total.
• 3 = Two Meals (Meals)
• 4 = Chainmail Waistcoat (Special Items). This adds 4 ENDURANCE points to your total.
• 5 = Mace (Weapons)
• 6 = Healing Potion (Backpack Item). This can restore 4 ENDURANCE points to your total, when swallowed after combat. You only have enough for one dose.
• 7 = Quarterstaff (Weapons)
• 8 = Spear (Weapons)
• 9 = 12 Gold Crowns (Belt Pouch)
• 0 = Broadsword (Weapons)
To discover which of the above you find, you must pick a number from the Random Number Table and find the corresponding article on the list. Note this on your Action Chart, under the heading given in brackets, and make a note of any effect it may have on your ENDURANCE points.
How to Carry Equipment
Now that you have your equipment, the following list shows you how it is carried. You don’t need to make notes but you can refer back to this list in the course of your adventure.
• 1 = Sword—carried in the hand.
• 2 = Helmet—worn on the head.
• 3 = Food—placed in the Backpack.
• 4 = Chainmail Waistcoat—worn on the body.
• 5 = Mace—carried in the hand.
• 6 = Healing Potion—carried in the Backpack.
• 7 = Quarterstaff—carried in the hand.
• 8 = Spear—carried in the hand.
• 9 = Gold Crowns—carried in the Belt Pouch.
• 0 = Broadsword—carried in the hand.
How Much Can You Carry?
• Weapons - The maximum number of weapons that you may carry is two.
• Backpack Items - These must be stored in your Backpack. Because space is limited, you may only keep a maximum of eight articles, including Meals, in your Backpack at any one time.
• Special Items - Special Items are not carried in the Backpack. When you discover a Special Item, you will be told how to carry it.
• Gold Crowns - These are always carried in the Belt Pouch. It will hold a maximum of fifty crowns.
• Food - Food is carried in your Backpack. Each Meal counts as one item.
• Any item that may be of use and can be picked up on your adventure and entered on your Action Chart is given capital letters in the text. Unless you are told it is a Special Item, carry it in your Backpack.
How to Use Your Equipment
Weapons
Weapons aid you in combat. If you have the Kai Discipline of Weaponskill and the correct weapon, it adds 2 points to your COMBAT SKILL. If you enter a combat with no weapons, deduct 4 points from your COMBAT SKILL and fight with your bare hands. If you find a weapon during the adventure, you may pick it up and use it. (Remember you can only carry two Weapons at once.) You may only use one Weapon at a time in combat.
Backpack Items
During your travels you will discover various useful items which you may wish to keep. (Remember you can only carry eight items in your Backpack at once.) You may exchange or discard them at any point when you are not involved in combat.Special ItemsEach Special Item has a particular purpose or effect. You may be told this when the item is discovered, or it may be revealed to you as the adventure progresses.
Gold Crowns
The local currency is the Crown, which is a small gold coin. Gold Crowns can be used on your adventure to pay for transport, food, or even as a bribe! Many of the creatures that you will encounter possess Gold Crowns, or have them hidden in their lairs. Whenever you kill a creature, you may take any Gold Crowns that it has and put them in your Belt Pouch.
Food
You will need to eat regularly during your adventure. If you do not have any food when you are instructed to eat a Meal, you will lose 3 ENDURANCE points. If you have chosen the Kai Discipline of Hunting as one of your five skills, you will not need to tick off a Meal when instructed to eat.
Healing Potion
This can restore 4 ENDURANCE points to your total when swallowed after combat. There is only enough for one dose. If you discover any other potions during the adventure, you will be told then of their effect. All Healing Potions are Backpack Items.
The biggest problem is that there are so many ways to do inventory. I'm going to try to come up with a few different systems, so I can show you guys what's possible, and so I can find what feels the best/ easiest to me.
Let's start with one of the simplest to track, money.
You start with a belt pouch that holds your Gold Crowns. It starts with a random number between 0 and 9. It can hold a maximum of 50.
One way I came up with to do the gold involved including another passage. I'm going to write this in a way I've seen before - since this code goes across multiple Passages, I'm putting the Passage titles after “::” and then the code for that Passage. (ex, ::Passage1 code ::Passage 2 code ::etc ::etc) - I believe it's called 'Twee notation'...
::Inventory Tracker
<<set $Gold = 0>>
Let's go [[Find Stuff]]
::Find Stuff
<<set $newgold = random (1,10)>><<include [[Change Gold]]>>
::Change Gold
<<nobr>>
<<linkreplace "You see $newgold Gold Crowns.">>
You pick up $newgold Gold Crowns,
<<set $Gold = $Gold + $newgold>>
<<if $Gold > 50>>
<<set $Gold = 50>>
but your Belt Pouch only holds 50 Gold Crowns,
<</if>>
you now have $Gold Gold Crowns.
<</linkreplace>>
<</nobr>>
<<set $Gold = 0>>
Let's go [[Find Stuff]]
::Find Stuff
<<set $newgold = random (1,10)>><<include [[Change Gold]]>>
::Change Gold
<<nobr>>
<<linkreplace "You see $newgold Gold Crowns.">>
You pick up $newgold Gold Crowns,
<<set $Gold = $Gold + $newgold>>
<<if $Gold > 50>>
<<set $Gold = 50>>
but your Belt Pouch only holds 50 Gold Crowns,
<</if>>
you now have $Gold Gold Crowns.
<</linkreplace>>
<</nobr>>
So we tell the player that there is money to be had...
When they click on that, they pick up the money and we tell them their new total...
But the limit is 50, so we let them know if they go over that and drop any extra...
This is one way to do inventory, as well as other stuff, by using a Passage to store the code and then calling that Passage when needed. In this case we define our gold in the "Inventory Tracker" Passage, this is going to be the one place we put everything the player is carrying (once we finish adding everything else). From there we go to another Passage, which would be somewhere in the story but for the moment is a test area titled “Find Stuff.” Then we have something neat, instead of writing the code to add to the player's gold, we include another Passage. “Change Gold” is a Passage that just has the mechanics of handling the gold, we set a variable of how much gold to add and it does all the rest. That way, instead of re-writing the code to add gold in every Passage, we just set our variable and reference the “Change gold” (heh, did you see that, I mixed the cases in that last title - which would be an error, I should have said “Change Gold”) Passage. That will cut down on the amount of typing we have to do.
Speaking on cutting down typing, re-reading the SugarCube documentation (yet again, I will say that I think Harlowe has the better online reference - but I'm committed to SugarCube at this point) made me hit myself realizing there is the <<linkreplace>> macro. Since that does everything my clumsy <span><<click>><<replace>> macros were doing, in fewer characters, I'm going to start being smart and using that instead (again, you're riding along on my learning process).
So, in the “Change Gold” Passage we're taking the variable for how much gold to add, adding it, but our belt pouch does have a maximum of 50, so we we're checking to make sure we don't go above that, and then telling the player how much new gold they have. Easy. Well, okay - this works to add gold, but what if we need the character to spend it or to lose it? We'll have to fiddle with things for that.
Let's go with the idea of losing gold, there is no way to buy anything in the book (and that's a bit more complicated, we'll tackle it next). So we could make another Passage just for losing gold, but it's easier to keep this one and just check if the $newgold value is positive or negative. If it's negative we'll change our description text a little, and since you can't go below 0 gold we'll set that as a bottom-limit. Code looks like this:
::Change Gold
<<nobr>>
<<if $newgold >= 0>>
<<linkreplace "You see $newgold Gold Crowns.">>
You pick up $newgold Gold Crowns,
<<set $Gold = $Gold + $newgold>>
<<if $Gold > 50>>
<<set $Gold = 50>>
but your Belt Pouch only holds 50 Gold Crowns,
<</if>>
you now have $Gold Gold Crowns.
<</linkreplace>>
<<else>>
<<linkreplace "You lose $newgold Gold Crowns.">>
You have lost $newgold Gold Crowns,
<<set $Gold = $Gold + $newgold>>
<<if $Gold < 0>><<set $Gold = 0>><</if>>
you now have $Gold Gold Crowns.
<</linkreplace>>
<</if>>
<</nobr>>
<<nobr>>
<<if $newgold >= 0>>
<<linkreplace "You see $newgold Gold Crowns.">>
You pick up $newgold Gold Crowns,
<<set $Gold = $Gold + $newgold>>
<<if $Gold > 50>>
<<set $Gold = 50>>
but your Belt Pouch only holds 50 Gold Crowns,
<</if>>
you now have $Gold Gold Crowns.
<</linkreplace>>
<<else>>
<<linkreplace "You lose $newgold Gold Crowns.">>
You have lost $newgold Gold Crowns,
<<set $Gold = $Gold + $newgold>>
<<if $Gold < 0>><<set $Gold = 0>><</if>>
you now have $Gold Gold Crowns.
<</linkreplace>>
<</if>>
<</nobr>>
Oh no, losing money...
New total...
If we lose big-Vegas-style...
We still can't go below 0 (no debt allowed in this fantasy world)...
How do you get rid of the minus sign from the $newgold variable text when you lose gold? I don't know, a quick check didn't turn up any easy answers - so frankly I'm going to ignore it for now. This all looks simple for you guys reading along (I'd imagine), and I'm sure it really is easy if you know what you're doing - but this is a chore for me (already been down a couple of dead-ends while working on this section, I tinker a lot while I work on this). I'm going to stay focused on getting the numbers to work right and I'll come back to this in my final presentation cleanup.
Okay, we don't need it for the book, but how would you buy something? In essence this is the same basic system, take your gold and subtract the price. You also have to add another variable, for the thing you're buying, and you have to check to make sure you have enough money to buy it in the first place.
Could we use this same Passage? Well...I think we could. We could add another variable, $IsBuying, and change the code a little (like add another if-block to check the price and give you the item) and I think that would work. This sounds like it would be better in it's own Passage though,so let's make a new one and play with some code.
Okay, well you usually buy things from the store, so let's make a Store Passage. It's possible to ask the player how many items they want to buy and get them in bulk, but it's easier to have one “Buy Item” Passage that goes back-and-forth to the "Store" Passage (I think). Buying only one thing is boring, so let's add Health Potions and Swords to our inventory...
New code for the Inventory Tracker and find Stuff Passages.
::Inventory Tracker
<<set $Gold = 0>>
<<set $HealthPotions = 0>>
<<set $Swords = 0>>
You are currently carrying:
$Gold Gold Crowns.
$HealthPotions Health Potions
$Swords Swords
Let's go [[Find Stuff]]
::Find Stuff
<<set $newgold = 20>><<include [[Change Gold]]>>
Now that you have some money, let's [[Go to the Store->Store]]
<<set $Gold = 0>>
<<set $HealthPotions = 0>>
<<set $Swords = 0>>
You are currently carrying:
$Gold Gold Crowns.
$HealthPotions Health Potions
$Swords Swords
Let's go [[Find Stuff]]
::Find Stuff
<<set $newgold = 20>><<include [[Change Gold]]>>
Now that you have some money, let's [[Go to the Store->Store]]
We have our code to get gold, which we'll re-use and add the link to the store.
And we're going to need some money to spend at the store...
So we arrive at the store. First, here's the code block for this Passage.
::Store
You are at the store.
You have $Gold Gold Crowns.
You have-
$HealthPotions Health Potions.
$Swords Swords.
The store has the following for sale-
Health Potion - 5 Gold Crowns (heals 4 Endurance)
Sword - 10 Gold Crowns (increases Combat Skill if proficient)
[[Buy a Health Potion->Buy Item][$buyitem = "Health Potion"]]
[[Buy a Sword->Buy Item][$buyitem = "Sword"]]
You are at the store.
You have $Gold Gold Crowns.
You have-
$HealthPotions Health Potions.
$Swords Swords.
The store has the following for sale-
Health Potion - 5 Gold Crowns (heals 4 Endurance)
Sword - 10 Gold Crowns (increases Combat Skill if proficient)
[[Buy a Health Potion->Buy Item][$buyitem = "Health Potion"]]
[[Buy a Sword->Buy Item][$buyitem = "Sword"]]
So, we show the player his inventory at the top, then we have the list of things to buy and prices and game effects. Then the links to buy items. Now, this is another one of those places where there are lots of different ways to do the same thing. What I'm going to do here is pass a variable that says what item the player is buying, then go to a “Buy Item” Passage. That Passage will check the item, buy it, then come back to the shop, which will update the inventory at the top.
So, our “Buy Item” Passage.
::Buy Item
<<switch $buyitem>>
<<case "Health Potion">>
<<if $Gold - 5 < 0>>
You do not have enough Gold Crowns to afford a Health Potion.
<<else>>
<<set $Gold = $Gold - 5>>
<<set $HealthPotions++>>
You buy a Health Potion for 5 Gold Crowns.
You now have $Gold Gold Crowns.
You now have $HealthPotions Health Potions.
<</if>>
<<case "Sword">>
<<if $Gold - 10 < 0>>
You do not have enough Gold Crowns to afford a Sword.
<<else>>
<<set $Gold = $Gold - 10>>
<<set $Swords++>>
You buy a Sword for 10 Gold Crowns.
You now have $Gold Gold Crowns.
You now have $Swords Swords.
<</if>>
<</switch>>
<<return "Back to shopping">>
<<switch $buyitem>>
<<case "Health Potion">>
<<if $Gold - 5 < 0>>
You do not have enough Gold Crowns to afford a Health Potion.
<<else>>
<<set $Gold = $Gold - 5>>
<<set $HealthPotions++>>
You buy a Health Potion for 5 Gold Crowns.
You now have $Gold Gold Crowns.
You now have $HealthPotions Health Potions.
<</if>>
<<case "Sword">>
<<if $Gold - 10 < 0>>
You do not have enough Gold Crowns to afford a Sword.
<<else>>
<<set $Gold = $Gold - 10>>
<<set $Swords++>>
You buy a Sword for 10 Gold Crowns.
You now have $Gold Gold Crowns.
You now have $Swords Swords.
<</if>>
<</switch>>
<<return "Back to shopping">>
We're going to use a new macro,
<<switch>>
; which looks at a variable and does different things depending on that variable's value. We could do the same thing with a bunch of nested <<if>>
macros, but this is easier and quicker to type. So we'll look at our $buyitem
variable and determine what item it is, how much it costs, and update our inventory with it. Since this is all in one Passage, again we can call it from anywhere - but it does mean every merchant will sell things for the same prices (though we can have them sell different items). I'm okay with that for right now; trying to make a more dynamic system that could handle any item and price combo did not work out too well - so I'll take what I've got and make a note to research this further down the road :)And, of course, if we can't afford something it'll tell us...
Well, we're getting the beginning of an inventory system here. We have money, can gain and lose money, and we can shop for different items. Not too bad, not too bad at all. But, of course, what we need is quite a bit more complicated than that :(
So with what I've got right now I can make a variable for every item in the game, and track how many of each item the player has. There's a catch though - each item uses a certain ‘inventory slot’ or container. Remember, you can only have 2 weapons, 50 gold crowns, 8 backpack items, and such. So before we let the player go and buy an item, or pick one up, we need to know if they have enough room for it. How to do that?
Maybe we can use another of those
<<switch>>
macros,now that we're thinking of them? Stay tuned for part 5...
No comments:
Post a Comment