Part 4: Combat
Presently there is really only 1 Fighting Fantasy combat function, albeit with 3 add-on functions (wrappers).
Single Combat
Most simply to make a combat in your adventure simply say:
<script script="&combat_1on1(x,y,1,'Goblin',6,7)" />
Replace x and y with the reference number instead of x and the combat number (on the reference) instead of y (usually just ‘1’ unless you have more than one combat in a reference)
This will create a combat against a Goblin with Skill 6 and Stamina 7, and allow the reader to Escape the combat if they so wish (change the 1 to a 0 if you do not wish Escaping allowed, or 2 if you want to allow Escape with automatic hit for fleeing). If you want more enemies in the fight just repeat the last 3 parameters filling them out with the stats for the enemy like so:
<script script="&combat_1on1(1,1,1,'Goblin',6,7,'Orc',8,9)" />
Which will do the same but with a Goblin AND an Orc to fight. The fight will be sequential, i.e. the reader must fight the Goblin first, then the Orc. However in most cases I have seen in Fighting Fantasy amateur books the rules are for enemies to attack simultaneously with the reader choosing which enemy to fight each round.
Multiple Combat
For this purpose there is the &combat_multi function like so:
<script script="&combat_multi(1,1,1,'Goblin',6,7,'Orc',8,9)" />
Both &combat_1on1 and &combat_multi are wrapper functions which merely provide a short and convenient interface to its more extensive base function &combat_full. Knowing all the parameters of (and therefore how to use) &combat_full allows a wide variety of modifications to standard combats, however it is too extensive to detail here – please either read the function details directly in the SEL editor, or since it is rather poorly documented for non-programmers, make a request in the forums for information on how to manipulate a combat to your wishes.
Checking Combat Status
Lastly, since it is rather pointless to have a combat where the reader can simply click past the combat to another reference there is a $combat variable that can be tested for victory (and thus prevent clicking out of a reference until the combat is won), like so:
<script script="&combat_multi(1,1,1,'Goblin',6,7,'Orc',8,9)" />
<if condition="$combat[7] eq 'won';" reval>If you win the fight <tt ref="123">turn to 123</tt></if>
A reader will have to win the combat to get the link to 123 to activate. Note it is important to remember the reval attribute of the <if> tag be present, since the condition needs to be re-evaluated every time the reader takes an action on the reference (there will be many with the combat in place).
$combat[7] is one element of the $combat array variable which holds all the data for all combats on a reference (and in fact retains that data until a new reference with a combat is encountered). There are a number of values that can be tested for greater flexibility of a combat and its status, see the SEL for full information, or again, ask on the forum.
Thank you for reading
That’s it for the first draft of the Creating a Fighting Fantasy Adventure guides. You now know how to generate an adventurer, create and use items, do standard FF operations like Testing Luck, and how to make a FF combat in your adventure. These are the standard rules requirements as detailed in the very first Fighting Fantasy book ‘The Warlock of Firetop Mountain’.
However there are many times that the standard rules are bent, broken or completely ignored. To this end I am working on a far more generic set of SEL functions for gamebooks and a specific FF library that will hopefully cover as many of these non-standard situations as I can manage – the PaperDoll library was the first attempt at such since it is a generic item inventory handling library and can be used for any gamebook system (FF or otherwise) here, though it is a bit scrappy and I hope to do a second version sometime. I am currently working on a ‘statistics’ library that will abstract a characters statistics into a set of routines and one array, which will hopefully allow for things such as items that give a bonus (modifier) that breaks the Initial Stat limit rule etc. (very common occurence).
And as always if you think something is not possible or you are wondering exactly how to get something done in your adventure never forget to just ask. I might not answer quickly (I live on the PC but I do go to the pub too), but it should get answered one day 🙂