★ CODING ★ 16. BREAKDOWN OF WITCH HUNT ★ |
Writing Adventure Games on the Amstrad - 16 - Breakdown of witch hunt - Locations |
LOCATION 0 - THE GLOBAL LOCATION Many of the definitions in this location will be standard for most AKS scenarios. Commands which are usually explicitly coded in the Basic program of other adventure games, such as movement, inventory, get and drop, are defined in the AKS scenario global location. The explicit coding in AKS is associated with the action (A) statements not with the keywords which cause their execution. Witch Hunt defines the action of going east as: T,e,east,* This associates the keywords 'e' and 'east' with the action 'GO,E' so that when the player's command line contains either then word 'e' or the word 'east' AKS will perform the action of moving the player east. Supposing you wished to adapt Witch Hunt to print a message on the screen confirming the action, it is a simple matter to add an extra action to this trigger as follows: T,e,east,* No modification of the AKS program itself is required. In addition to allowing modification of the fundamental actions of an adventure game scenario, actions may be deliberately omitted from a scenario by omitting their definition from the global location. The way Witch Hunt implements the cat following the player around shows the flexibility of AKS triggers. From the above example, it can be seen that adding actions to triggers allows extension of an action. A brief examination of the Witch Hunt global location definition will reveal that it has two versions of every movement command. Both versions contain the same keywords but have different trigger conditions and actions. The first version will fire when flag 4, the 'player being followed by cat' flag, is set to true (ie. '*F4' evaluates to true). The second version will fire unconditionally and so if the first version does not fire the second version will. The first version, which fires when flag 4 is set to true, results in the player being moved by the 'GO' action and the object 12 (the cat) being Zapped In to the player's new location. The second version, which fires when version one fails to fire, just does a normal move player using 'GO1. To cause the cat to start or stop following the player merely requires setting flag 4 to true or false respectively. The global location in Witch Hunt also contains triggers for actions not fundamental to adventure games in general but which may be performed at any location in the Witch Hunt scenario. An example is the action of eating something. Commands containing 'eat loaf or 'eat bread' will cause 'Yummy yummy!' to be printed and the loaf (object 5) to be Zapped Out to nowhere; provided, of course, that the player is carrying the loaf (ie. '*C5' is true). A similar trigger exists for eating the cheese. However, if the player enters 'eat church' then neither of these triggers will fire and AKS will reach the 'T,eat,*' trigger and print 'No thanks'. The addition of these extra scenario specific commands helps to give the scenario credibility. The global location cannot be reached by the player and so requires no description or connection statements. Triggers which may occur in any location must be defined here. However, remember that triggers defined in the player's current location (local triggers) have priority over triggers defined in the global location (global triggers). If a local trigger is satisfied then the global trigger will never even be tested. This is illustrated in Witch Hunt by the global trigger 'T,n,north,*' and the local trigger defined in location 13, 'T,n,north,church, *-F4.012'. If the player is at location 13 and enters the command 'go north' then AKS try to match the local trigger first. The keyword 'north' will match and so the condition '*-F4.012' will be evaluated. When this evaluates to false, the trigger is not satisfied and so AKS continues to try the remaining local trigger statements; only when all these have been tried are the global triggers tried resulting in the firing of the unconditional 'T,n,north,*'. In the case where ' *-F4.012' evaluates to true, the actions immediately following the local trigger statement are executed and no further trigger testing is done; hence AKS does not reach the global trigger statement. In this way, the same keyword can be made to have different effects in different locations. Here, 'north' is made to cause an entirely different action in location 13 to the normal global one. 7690 DATA L,0 LOCATION 1 - GREEN MIDDLE This is the first real game location in the scenario definition. Witch Hunt starts the player off at this location. This location has two description definitions (D statements). The description the player is given will always start with the first of these which has no condition attached. The second description is only given when the player has not spent one game turn at this location (ie. not visited location 1, '*-V1is true). Being as the player starts at this location he will only receive the second description once — before his first move. In this way, Witch Hunt implements the usual introduction to an adventure game (ie. as the second description). The player is only allowed 100 turns in which to complete Witch Hunt. The counting of moves is done using one of the AKS counters (counter I). When the counter reaches zero event 1 will fire automatically and the actions defined in event 1 will be executed. These actions are described later in this chapter. However, for a countdown to be started, the player's first move must result in an initialise counter (IC) action. For this reason there is a trigger for each possible direction of movement from this location (N,S,E,W). In addition to the normal effect of moving the player (by 'GO,N 'GO,S', etc.) each of these triggers initialises counter 1 to 100 (by 'IC,1,100'). Although this would have the desired effect on the player's first move, if the player later returns to this location and moves off again then the counter will be reinitialised to 100. This would be fine if you wanted to implement something like a player holding his breath as he leaves a diving bell and having to return to the bell within 100 moves or drown, but we don't. Therefore a flag (flag II) is used to indicate whether the initialisation has been done or not. AKS automatically initialises all flags to false (F) at the start of a game. The movement triggers test for this flag not being true (by '*-F11') before firing and once fired they assign a value of true to flag 11 (by 'AF, 11 ,T'). Counter 1 will only be initialised by the player's first movement as these triggers will never fire again. Travelling east from this location will take the player to location 2 — the inn. The trigger keyword 'inn' allows the player to enter commands like 'go inn' or 'enter inn'. However, if the player has been banned from the inn (ie. flag 6 is set to T) then the trigger 'T.inn,*-F6' will not fire. Instead, the 'T,e,east,inn,'F6' trigger will fire and print a message saying that the player may not enter. The latter is another example of the local trigger having priority over the global trigger. 8400 DATA L,1 LOCATION 2 - INN BAR The bar in the Melbourne Inn has an unconditional short description and a long description for the first visit to the location implemented in the same way as for location 1. The long description mentions that the kitchen door is slightly ajar thereby giving a clue to the way of trying the hat on the innkeeper. A third description is given when the player has balanced the hat on the door. Triggers exist to allow the hat to be placed on the door and to retrieve it should the player fail to complete the puzzle. Two versions of calling the innkeeper allow him to enter the room when the hat is either on or off the door (flag 5). Notice that the nnkeeper object is never actually moved as the messages displayed make this seem to happen without having to genuinely move the object. When the innkeeper is called and the hat is on the door, the player discovers that the hat does not fit him, gains ten points for solving this puzzle (by Increment Score — 'IS,10'), gets thrown out of the inn with the hat and banned from returning (by 'AF,6,T'). 8670 DATA L,2 LOCATION 3 - INN KITCHEN The kitchen in the Melbourne Inn is the home for two puzzles — the cheese and the bread. The innkeeper will not allow the player to take either of these objects. Provided that the objects are present, local triggers will trap an attempt to 'get cheese' or any mention of the words 'loaf and 'bread'. Instead of performing the normal get action, a message is printed telling the player that the innkeeper has prevented his action. Both messages contain clues to a way of obtaining the appropriate object. In the case of the cheese, the clue is in the words “.. . openly trying to take . . .". The solution is to not try and take the cheese openly — 'steal' it. In the case of the bread, the clue is in the words . . last loaf. . ." and in the fact that on entering the inn bar the player is told that the innkeeper is broke. Giving the innkeeper a sack of flour from the mill allows him to bake some new loaves and so he gives the player the old one. This is implemented by the trigger "T,give,*010.05” which may fire when the player is carrying the flour (object 10) and when the innkeeper has the loaf to give away (object 5 is at this location). Although dishonest enough to accept stolen flour, he will not be interested in receiving money from the player because of the danger of being accused of stealing the woodcutter's gold. 8980 DATA L,3 LOCATION 4 - GREEN NORTH The north end of the village green is the location where the game can be completed. With the blacksmith in the stocks here for stealing the woodcutter's gold (flag 10 is set to T), the hat can be tried on the woodcutter and found to fit. The final twenty points are awarded for doing this (by 'IS,20') and the player clears himself. 9140 DATA L,4 LOCATION 5 - GRAZING LAND This location is a red herring. It is a very good way of losing bread and cheese to the goats. If the player is carrying either the cheese or the bread and tries to feed these (or any other object) to the goats then a goat will help itself to either cheese or bread. The order of triggers makes the goats prefer cheese to bread. In addition to this, any attempt to perform an action using either cheese or bread will result in the goats snatching one or the other. 9270 DATA L,5 LOCATION 6 - GREEN SOUTH 9360 DATA L,6 LOCATION 7 - POND The water in the pond is stagnant and may not be reached by the player. The pond does provide a means of releasing the goatherd from the spell which has turned him into a toad. Throwing the toad into the pond undoes the spell and so he turns back into a boy. Five points are awarded for this and a clue from the boy tells the player to try exploring the woods. The changing of the toad to a boy is only a change in the description of the toad object (object 2) brought about by setting a flag (flag 3) to true. This technique is explained in the description of the toad object later in this chapter. Feeding the ducks the bread from the inn makes the ducks move away from their nest and reveal the woodcutter's gold. Unlike the toad to boy change, the ducks to gold change involves a genuine substitution of objects. The ducks object (object 3) is Zapped Out to nowhere and the gold object (object 14) is Zapped In from nowhere. The reason for this alternative approach is that the gold object can be manipulated by the player whereas the boy object can not. Were the description switching technique used here, the player could create strange effects by referring to the gold as ducks. While not doing any harm in terms of the scenario, this would make the game appear rather stupid to the player. 9460 DATA L,7 LOCATION 8 - MEADOW 9630 DATA L,B LOCATION 9 - FORGE The description the player is given on the first visit to this location says that the blacksmith is well known for his all round handyman skills. This might give the player a clue as to who carved the intricate markings on the floor of the secret crypt. Showing the blacksmith anything other than gold coins, or accusing him of something when the coins (object 14) are not carried results in the player being told to go away. However if the player is carrying the coins the blacksmith will confess to stealing the woodcutter's gold and is dragged away by the villagers. The player is not told where they take him — to the stocks on the north of the green (by 'MO,16,4'). A flag is set (flag 10) to indicate that the blacksmith is in the stocks. Twenty points are awarded for completing this puzzle. 9690 DATA L,9 LOCATION 10 - CHURCH NAVE Once the player has managed to get the hat to land over the priest's head and shoulders as described in the next location explanation, the hat must be retrieved. The trigger which traps the keyword 'hat' when the hat is on the priest's head Zaps Out the priest (object 9), Zaps In the hat (object 1) and then does a Get to pick it up. 9010 DATA L,10 LOCATION 11 - CHURCH BELFRY The puzzle at this location is a two stage one, given that the player has already found the hat. The first stage is to ring the bell which causes the priest (object 9) to come from the crypt and stand in the nave (location 10) directly below you (by 'MO.9,10'). Setting flag 1 to true causes the priest's description to change to say he is looking up at the belfry. The second stage of the puzzle involves dropping the hat from the belfry onto the priest's head (indicated by setting flag 2 to T) to reveal that it is too large for the small priest and gain ten points. If the bell has not been rung when the hat is dropped (flag 1 is F) then it just falls onto the nave floor, as a result of the second 'drop hat' trigger statement. 9790 DATA L,11 LOCATION 12 - CHURCH CRYPT This is the location discovered by the player (before the game started) and where he was caught by the priest. The function of the crypt in the Witch Hunt scenario is to provide the player with clues to the identity of the witch, without providing any hard and fast evidence. The clues are obtained by examining the location. Examination of the markings on the floor reveals nothing of their meaning but the player is told that they are well carved. When the player first visits the blacksmith, he is reminded that the smith is well known for his all round handyman skills. This clue is a little vague whereas the clue given by examining the torches on the wall is very informative. Just mentioning torches says that they are firmly attached to the wall by brackets. The unwary player may take this to only mean that the torches may not be taken. However, this should prompt the player to examine the brackets and discover that they are made of iron. This points very strongly at the blacksmith's involvement. Notice that the markings, torches and brackets are not objects and so their examination requires explicit triggers in the crypt location definition; whereas objects have their examination details embedded in the object definition. 10200 DATA L,12 LOCATION 11 - CHURCH BELFRY The puzzle at this location is a two stage one, given that the player has already found the hat. The first stage is to ring the bell which causes the priest (object 9) to come from the crypt and stand in the nave (location 10) directly below you (by 'MO.9,10'). Setting flag 1 to true causes the priest's description to change to say he is looking up at the belfry. The second stage of the puzzle involves dropping the hat from the belfry onto the priest's head (indicated by setting flag 2 to T) to reveal that it is too large for the small priest and gain ten points. If the bell has not been rung when the hat is dropped (flag 1 is F) then it just falls onto the nave floor, as a result of the second 'drop hat' trigger statement. 9790 DATA L,11 LOCATION 12 - CHURCH CRYPT This is the location discovered by the player (before the game started) and where he was caught by the priest. The function of the crypt in the Witch Hunt scenario is to provide the player with clues to the identity of the witch, without providing any hard and fast evidence. The clues are obtained by examining the location. Examination of the markings on the floor reveals nothing of their meaning but the player is told that they are well carved. When the player first visits the blacksmith, he is reminded that the smith is well known for his all round handyman skills. This clue is a little vague whereas the clue given by examining the torches on the wall is very informative. Just mentioning torches says that they are firmly attached to the wall by brackets. The unwary player may take this to only mean that the torches may not be taken. However, this should prompt the player to examine the brackets and discover that they are made of iron. This points very strongly at the blacksmith's involvement. Notice that the markings, torches and brackets are not objects and so their examination requires explicit triggers in the crypt location definition; whereas objects have their examination details embedded in the object definition. 10200 DATA L,12 When the player goes north from here he trips over a black cat which will then follow him around for 20 moves before a crowd of villagers notice he has a black cat familiar and decide to burn him. The counting of moves is done using counter 0 and the villagers burning the player is event 0. The local trigger which traps an attempt to move north starts the countdown by the action 'IC,0,20'. In addition to this, a flag is set to indicate that the player is being followed by the cat (flag 4). This prevents the same trigger from firing again when the player tries to go north again and it allows firing of the alternative set of movement triggers defined in the global location. These alternative movement triggers move both player and cat. The way in which the player may get rid of the cat is described in the explanation of the mill location definition (location 16). It should be noted that the cat will appear again should the player return here and go north again after having got rid of the cat at the mill. However, the objects to get rid of the cat have been destroyed (Zapped Out to nowhere) at this stage in the game so the cat can not be disposed of again. 10320 DATA L,13 To prevent the player wasting many hours trying to give a hat full of stream water to characters other than the miller, a local trigger will fire as the player moves westwards carrying the hat of water. This trigger tells the player that he tripped and spilt it. The flag indicating that the hat is full of water (flag 8) is reset to F; thereby emptying the hat. LOCATION 14 - ROAD 10470 DATA L,14 LOCATION 15 - BRIDGE The player may not fill the hat at this location. If he attempts this then the trigger will say that he is unable to fill it here. A careless adventurer may take this to mean that the hat may not be filled instead of 'not filled here'. 10570 DATA L,15 LOCATION 16 - MILL There are two problems to be overcome at the mill. Firstly, the mouse must be caught. However, the player is not automatically told that there is a mouse here. Instead he is told that something is moving around in the rafters. Examination of the rafters or listening in this location will inform the player that he thinks that there is a rat in the rafters. If the player then mentions the keyword 'rat' or 'rats' he is told that it is a mouse not a rat. These triggers only fire when the mouse is in the rafters (ie. flag 7 is F). The mouse can be tempted from the rafters by feeding it the cheese or just dropping the cheese. When this happens, the cheese object is Zapped Out (by 'Z0,4') and flag 7 is set to T indicating the mouse is no longer in the rafters. The description of the mouse changes as a result of setting flag 7 and becomes a 'piece of cheese with a mouse attached to it'. An attempt to get the cheese when flag 7 is set to T results in a message saying that the mouse refuses to let go of it. If the player has the hat he may catch the mouse in it otherwise the mouse will slip through his fingers. From hereon the mouse and cheese may be manipulated as one object. The second problem faced by the player in this location is finding out if the hat fits the miller. This is solved by giving the miller the hat full of water. He will drink some of the water and then pour the rest over his head at which point the player sees that the hat would not fit the miller. Ten points are awarded for doing this. However, if the player has already done this once (ie. flag 9 is T) and tries a second time, the miller just smiles and says go away creep. When the miller took his drink, he put down the sack of flour (object 10) he was carrying and did not pick it up again when he started working again. The sack can now be picked up by the player. Previously, any mention of flour or sacks caused a trigger to fire which said the miller growls at you. 10630 DATA L,16 LOCATION 17 - STREAM Unlike the bridge over the stream and the pond this location allows the player to fill the hat with water. To indicate the hat is full of water, flag 8 is assigned the value T. Should the player be foolish enough to forget to take the hat off (ie. 'W1' is T) before attempting to fill it, he is told why his action failed. 10950 DATA L,17 LOCATION 18 - WOODS (a) This location is the first WOODS location the player reaches. When the player arrives here for the first time, the second description is given in addition to the main description as a warning to the player. 11060 DATA L,18 LOCATION 19..22 - WOODS (b) These locations all have the same description as location 18 making it difficult for the player to find his way around. To further complicate navigation of this maze, moving in a certain direction does not always take the player to the next physical location in that direction. Reference to the location map will quickly clarify this idea. 11110 DATA L,19 LOCATION 23 - WOODS (c) This is another location in the maze but, as the player arrives for the first time a second description tells the player that he thought he saw someone run away. The player finds the hat here. 11310 DATA L,23 LOCATION 24 - CLEARING The clearing in the woods exists to provide the player with a hint tor getting the woodcutter to try the hat on. One part of the location description says that the clearing is sheltered from the wind and the sun seems very hot. Wearing the hat removes this part of the description. The player must be wearing the hat when he first moves south to the woodcutter's house. Seeing that the player is wearing the hat, the overheating woodcutter takes it and tries it on for size to see if it will shade him from the sun. It does not fit so he replaces it on the player's head. The player is awarded ten points for solving this part of the scenario. 11370 DATA L,24 LOCATION 25 — WOODCUTTER S The woodcutter can be found here. Any mention of the woodcutter's hut results in the player being told off by the woodcutter. 11460 DATA L,25
|