|In this tutorial, we are going to walkthrough the quest that is available in the sample module Uninvited Guests.
The quest, if accepted is to kill the 2 lizardmen that have taken over poor Pitney's House. If the quest is accepted then Pitney will give you a club to help you dispatch the lizardfolk, his house key and if you succeed 150 experience points and a 1363 Havest Mead.
Firstly, if we were going to build this module from stratch then we would have to create a new area and add the necessary placeables and NPCs (especially Pitney and Ginni in this case):
Now we need to create a conversation for Pitney so that he can at least have the opportunity to give the quest to the player. Please click here if you need to find out how to write a conversation and click here to attach a conversation to a creature.
If you open up the module then you will see that Pitney's conversation is as follows:
Please open the conversation "01_pitney" to see it in more detail. I will explain each important step of the conversation as we go through this tutorial.
If you run the module, Pitney will come running up to you and initate the following conversation:
Note that I am not going to run through each node of conversation as 1) it will take too long and 2) once you get to grips with writing conversations you can flesh the conversation as much as you like and many nodes will probably have no actions or conditions attached to them
As you can see the player has the chance to tell Pitney, "Stay here, I'll deal with the Scaly Folk". If the player choses this option then they will follow these nodes of conversation:
The above picture maybe slightly different to yours as I have removed the conditions column as it is not needed at this point of the tutorial (Right click on any header of the table and then left click on Columns and then select to uncheck the Conditions column). As you can see from the above picture once you say, "Stay here, I'll deal with the Scaly Folk", Pitney will then have two lines to speak, the first one, "You mean it? That's mighty good of you. More than I deserve no doubt" has no actions apart from the Player has to press 1 to continue. The next line, "Here, take this. It's not much of a weapon, but my old Dad swore there wasn't nothin' better for crackin' lizard skulls." has an action assigned to it. Before I mention how to add an action you will notice that some of the lines of conversation have "pipes" surrounding text i.e. | Give cudgel |. This is not shown to the player during the game, but a reminder to the builder what happens at this node of the conversation.
To add an action, you must first add your line of text, so in this example, "Here, take this. It's not much of a weapon, but my old Dad swore there wasn't nothin' better for crackin' lizard skulls." and then with this line selected, click on the actions tab:
Now click on the Add button:
You will then see a line added below and where it states Script click on the downward arrow and then select the ga_give_item script and then click on the refresh button and you will see the following:
You can see we have 3 parameters sTemplate (String), nQuantity (Int) and bAllPCs (Int) and if you take a look at the ga_give_item script it actually mentions what the parameters mean:
string sTemplate = Item blueprint ResRef
int nQuantity = Stack size for item (default: 1)
int bAllPCs = If =1 create item on all player characters (MP)
These are self explanatory, so all we need to do is to let the script know which item to hand over and also how many like so:
So you can see the script will give the player one item with a Item Blueprint ResRef of Cudgel. The player will then be prompted to click or press 1 to continue the conversation and then you will see the journal being updated and also the player is given another item (a key). We now know how to give players an item, but how do we add a journal entry?
To learn how to add a Journal entry please click here.
The journal entries from the Uninvited Guests look like:
Now that we have added our journal entries, we now have to add scripts to the conversation to trigger these journal entries. The next part of the conversation Pitney says, "And, ah... best of luck, stranger." and then the journal is updated and also he gives the player his house key. To see how this is done, click on that line in the conversation and you will see that in the quest column we have a value of 01_lizardfolk (20), which was added via the Node tab:
In the Node tab you will see the following:
Under behaviour you can see we have a Quest field with the value 01_lizardfolk (20), which is corresponds to our journal entry with the same ID so "Pitney Lannon and his family have been evicted from their home by a pair of lizardfolk. The creatures are still in his house, happily ransacking the place.
You agreed to get rid of Pitney's unwelcome guests... by whatever means necessary." will be added to the players journal at this point.
Under the action tab we have two scripts:
The first script is the 01_lizman_journal comprises of
// When the lizardmen die, advance the journal state to 30.
// EPF 8/17/06
const string GROUP_LIZMEN = "grplizmen";
Basically, what this script does is to group together 2 lizard creatures (these are located inside Pitney's house) who have a tag 01_lizman1 and 01_lizman2 together and if this group dies then the Journal ID is now set to 30, which corresponds to the journal entry "You slew the two lizardfolk who were ransacking the Lannon house.
All that remains is to inform Pitney Lannon of the good news..."
The second script is the ga_give_item which I explained earlier how that works. The player of course is given the option to refuse to take the quest as you can see in the conversation node "That remains to be seen. I'll think it over." and the Journal Entry ID is 10, which corresponds to the Journal Entry "Pitney Lannon and his family have been evicted from their home by a pair of lizardfolk.
Pitney begged you for help, but you refused."
You will see the next node "You change your mind, stranger? 'Bout helpin' us, I mean?", this has a condition attached to it, which is checked by the gc_journal_entry script. The sQuestTag must = 01_lizfolk and the sCheck = 10 before this node of conversation is available to the player.
Once you have killed the Lizardmen you now should go back and speak to Pitney who will say "We heard all the screamin', but we couldn't tell if it was you or them! Gods! Are they dead?". The reason he says this is if you look at that node in his conversation it will only appear if your Journal ID = 30 (which it does as a script fired off when you killed the 2 Lizardmen and made the Journal Entry ID = 30).
The conversation continues and then the two NPCs (Pitney and Ginni) when they enter a conversation between then. To have a conversation between two NPC, click on the Node tab and make sure the NPCs tags are stated in the Listener and Speaker fields:
The last thing we need to do is to wrap up this quest, which Pitney does in the "Mph. Very well. You did save our lives, after all. Jus' promise you'll save it for a special occasion." conversation node. As you can see we have two actions:
The ga_give_quest_xp has a sQuestTag value of 01_lizardfolk which is 150 (remember the XP value that was entered in the XP column of the journal entries). We are now fimilar with the ga_give_item script?
You will also see in the Quest column that the 01_lizardfolk = (40) in the conversation node, which corresponds to 40 in the Journal Entry ID, which is also an Endpoint, which will complete the quest.