Grimlar - Guide To The Stone Of Recall

It is assumed that you have a basic understanding of the NWN scripting language and are somewhat familiar with the Aurora Toolset, i.e. you know how to create an area and place an object in it. If this isn't the case, please go and have a look at Celowins scripting tutorials and Bioware's module construction tutorial first.


Introduction


Love it or hate it the Stone of Recall is well known as a useful way to cut down on some of the legwork involved in completing various quests in the Official Campaign.


There have been criticisms that it was too cheap, usable too often and, in conjunction with the free healing available in the Temples Of Tyr, perhaps made the game too easy to beat.


Overall though, the thing most players remember is that it worked and generally improved the game.


As such it is a useful tool for mod builders to include in their own masterpiece. This tutorial is intended to show you how to do that.


Basics


At its heart the Stone Of Recall is nothing more than a simple item that when activated, checks to see if the player is in certain areas in the Official Campaign where different behaviour is expected, and if not teleports the player back to a specific location.


All you really need is a Stone Of Recall and a portal to return you to where you used the Stone.


And the best thing of all is that it can be done with virtually no knowledge of scripting. Oh you can alter things if you don't like how its set up, but pretty much all the major bits and pieces have already been done for you.


Details


Create a module with two small size areas (4x4), pretty much any interior tileset will do. Link the two area's with either a door transition or an area transition trigger. The reason for two areas is simply to give your character more space to roam in and try the Stone of Recall out.


(Since the Stone of Recall costs money to operate, you may wish to put a small pile of gold in one of the area's.)


Stone Of Recall


The Stone of Recall already exists in the game and can be found on the standard Items palette, in the 'Plot Items' section.


Since we are trying to keep things simple at the moment you should simply place the item on the ground, near the start point.


(You may want something more realistic, perhaps a NPC who will give the PC a Stone of Recall when they talk to each other. If that's the case see the notes at the end of the tutorial.)


To make the Stone of Recall actually work you need to add a script to your module, so open the 'Script Editor' from the 'Tools' menu at the top of the page. Then type in the following code:


#include "x2_inc_switches"
#include "nw_i0_plot"
void main()
{
    int nEvent =GetUserDefinedItemEventNumber();

    // * This code runs when the Unique Power property of the item is used
    // * Note that this event fires PCs only
    if (nEvent ==  X2_ITEM_EVENT_ACTIVATE)
    {
        //IsRecall is defined in nw_i0_plot
        IsRecall();
    }
}

When you've done that, click on the 'Compile' icon in the top left corner, you will be asked to give the script a name, so enter 'nw_it_recall' into the 'Resource Name' box and click 'Save'. You may get a warning at this point about a blueprint conflicting with a reserved namespace, don't worry about it, click on 'Yes' to indicate you wish to proceed.


(If you don't have HoTU installed on your machine you may not be able to use Tag based Item scripts like this. If that's the case have a look at the notes at the end of this tutorial for an alternative way of writing this script.)


That's it for the Stone of Recall itself.


Recall Portal


The Recall Portal is also nearly complete without you having to do anything.


It can be found on the standard 'Placeables' palette in the 'Visual Effects' category called 'Portal'. Place a copy of this 'Portal' where you want your PC's to arrive and depart from.


1) Right click on the 'Portal' and select 'Properties' from the popup menu.


2) On the 'General' tab, change the 'Name' to 'Recall Portal' and change the 'Tag' to 'NW_RECALL_PORTAL'. Then make sure that the 'Plot' and 'Useable' check boxes have been ticked. The 'Static' check box should become greyed out.


3) On the 'Scripts' tab, type 'nw_recall_portal' into the 'OnUsed' script box.


4) On the 'Advanced' tab type 'nw_all_feedback' into the 'Conversation' box.


(The conversation attached to the 'Recall Portal' mentions a 'cleric standing nearby' who you should talk to if you have just died. If you don't intend to have such a cleric or they are not nearby, then you will need to alter the conversation. Please see the notes at the end of the tutorial for details.)


5) Click on 'OK' to save the changes.


Finally


In order to make this all work you need to make one final change.


1) Select 'Module Properties' from the 'Edit' menu.


2) On the 'Basic' tab, change the 'Tag' to 'Chapter1'. This makes certain scripts behave as they would in Chapter 1 of the Official Campaign, including the scripts that determine how much using the Recall Portal costs. ('Chapter2' and 'Chapter3' are valid alternatives and change the fee for using the portal.)


3) Click on 'Ok' to save the changes.


4) Build, save and test your module.


Notes


These are the additional instructions if you wish to change things a little bit.


How To Change The Conversation Used By The Recall Portal


1) Open the 'Advanced' properties tab of the 'Recall Portal' just as you did before.


2) Click on the 'Edit' button located next to the conversation box.


3) Click on the 'Save As' icon, fifth from the left at the top of the screen, and give the conversation a new name, 'conv_recall'. ('nw_all_feedback' is an official Bioware conversation and should be saved as something else before we make any changes.)


4) Next we delete all those lines that have nothing to do with the 'Recall Portal', the first three lines are all to do with doors and can be deleted.


5) The next line refers to a magical pool of liquid, and therefore can also be deleted.


6) You will have already chosen which 'Tag' to give your module, 'Chapter1', 'Chapter2' or 'Chapter3', these correspond to fees of 50, 150 or 400 gp respectively. The lines of dialog related to the chapters you didn't choose should also be deleted. So if you chose a fee of 50gp, ('Chapter1') you can delete the lines where the fees of 150gp ('Chapter2') and 400gp ('Chapter3') are mentioned.


(If none of these prices are what you want, then you will need to look closely at the scripts used by the line of dialog that most closely matches the fee you want and come up with your own.)


7) Change the text of the dialogue to reflect that there is no cleric nearby.


8) Click on the 'Save' icon, fourth from the left at the top left of the screen, then click on 'Done' to exit.


9) The 'Conversation' box should have changed to reflect the change in name for the conversation file, so click on 'Ok' to save the changes and exit.


How To Set Up An NPC To Give The PC A Stone Of Recall


1) Place a 'Neverwintan Militia' near the start location. They can be found on the standard 'Creatures' palette in the 'Human' section.


2) Open the properties for the npc to the 'Basic' tab, type 'conv_guard' into the conversation box at the bottom of the page. Click on the 'Edit' button to the right of the conversation box.


3) Add a couple of lines of dialog to the conversation. Keep it simple like, "Here Citizen, you'll need one of these." To which the player can reply "Thanks."


4) Then on the 'Actions Taken' tab of the "Here Citizen..." line, you click on the magicians hat to start the wizard.


5) On the 'What Actions Would You Like To Perform' page, select the 'Give Rewards' option and click on 'Next'.


6) On the 'Give What Rewards?' page click on the button with three dots on it "..." which is just to the right of the 'Give item (by resref)' box.


7) On the 'Select Resource' page open the 'Plot Item' Category and scroll down to 'Stone of Recall', select it and click on 'OK'. The 'Give item (by resref)' box should now contain 'nw_it_recall'. Click on the 'Add' button.


8) Click on 'Next' and give the script a name, something like 'at_giverecall' so you'll be able to remember what the script does. Click on 'Finish' to return to the conversation editor.


9) Click on the 'Save' icon at the top of the screen, (fourth from the left,) then click on 'Done' to exit the conversation editor.


10) Click on 'Ok' to save the changes you have made to the npc.


How To Write An Item Activation Script If You Don't Have Tag Based Item Scripting.


If you can't take advantage of Tag based item scripts, you need to change how you write item activation scripts.


So for our Stone of Recall we would need to do the following instead.


1) Select 'Module Properties' from the 'Edit' menu.


2) On the 'Events' tab, enter the following in the 'OnActivateItem' script box, 'items_oa' to remind you of the purpose of the script.


3) Click on the 'Edit' button to the right of what you just typed in. Click 'Ok' on the warning dialog. In the 'Script Editor' window that opens type in the following code:


#include "nw_i0_plot"
void main()
{
    //IsRecall is defined in nw_i0_plot
    IsRecall();
}

Then click on the 'Compile' icon in the top left of the screen, if there are no errors, click on the 'Exit' button in the bottom right of the screen.


Then click on 'Ok' to save the changes to the modules properties.


A demonstration module is available from here.




 author: Grimlar