Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
112 views17 pages

NWN Pack Animal Guide

This tutorial provides instructions for creating a pack animal in Neverwinter Nights. It describes creating a pack ox blueprint based on the existing ox model. It then creates an ox pack merchant object to serve as the interface for storing items in the pack ox's inventory. Finally, it creates an NPC animal trainer who can sell the pack ox to players. The goal is to have a fully functional pack animal that can carry items across areas and be accessed consistently by the player who purchased it.

Uploaded by

Juan Merk
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views17 pages

NWN Pack Animal Guide

This tutorial provides instructions for creating a pack animal in Neverwinter Nights. It describes creating a pack ox blueprint based on the existing ox model. It then creates an ox pack merchant object to serve as the interface for storing items in the pack ox's inventory. Finally, it creates an NPC animal trainer who can sell the pack ox to players. The goal is to have a fully functional pack animal that can carry items across areas and be accessed consistently by the player who purchased it.

Uploaded by

Juan Merk
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Pack Animal Tutorial

By Justin Gattuso

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

Introduction
By the end of this tutorial, we should have a fully implemented pack animal for our Neverwinter Nights campaign. Although it perhaps wont be the best or most efficient pack animal, it will definitely do what we want it to do. At the end of the tutorial we should have a pack animal that: Can be purchased from a vendor NPC Can only be commanded by the PC who bought it Will work consistently across area transitions Will let us store things in its pack Will follow on command Will stop on command It will be assumed you have decent working knowledge of the NWN editing toolset. If you have followed the official Module Construction Tutorial from Bioware, then you are definitely ready. I will not cover things that Bioware has already covered, as it would make this tutorial extremely long and redundant. If you have not already, I suggest you go through their tutorial first, then this one. I will be modeling the structure of this document from theirs to keep things consistent.

Step 1: Creating the Pack Animal Blueprint


Introduction
Having a Pack Animal blueprint will be extremely important later on when we want to dynamically create the animal after it is bought off an NPC vendor, without a blueprint this would be impossible. So first things first, we need a blueprint.

Goal
Create a blueprint of our pack animal, to set it off from the standard animals that shipped with the game. Then add it to the Custom palette for easy retrieval later.

Tutorial
The easiest way to accomplish our unique blueprint of a pack animal is to model it off the already existing animals in the game. For this tutorial I am going to be using the Ox, as it seems the most traditional pack animal in the game. Feel free to use whichever animal you want, however note that all my names and scripts are going to refer to the ox and not the animal you may choose, so if your worried about getting confused later on, stick with the ox, its not hard to change later. 1. Paint an Ox somewhere in your area from the standard palette of the Paint Creatures category. You will find the Ox by choosing Monsters > Animals > Other > Ox. 2

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

2. Right-click on the Ox and access its properties window. The Basic tab should be selected, now we need to change some of the properties of the animal. 1. Change the First Name to Pack Ox or something else you like, this will be the name that appears in the game for the animal. 2. Leave the Last Name blank, as chances are, the animal wont need a last name. However, you may do whatever you wish. 3. Change the Tag to something were going to remember like, PackOx. 4. Finally, check the little box at the bottom that says No interrupt as when we write the conversation for the animal, we dont want anything interfering with our exchange, it would be rude! With that our new Pack Ox is basically an Ox with a new name and a new tag, but this is important to differentiate the two in a game that might use both regular Oxs and Pack Oxs. You may want to change the description to suit something more about a Pack Ox, those are cosmetic changes up to you. I personally would change it to reflect something more akin to a Pack Ox it will add flavor to the gaming experience. Next were going to add our new Pack Ox to our own custom palette for easy reference later on, this is extremely important and you will see the reason we do this later on. To add the new Pack Ox to the custom palette: 1. Click Ok to save our changes to the Pack Ox and exit out of its property window. 2. Right-Click on the Pack Ox and select Add to palette. The same properties window will pop-up for the Pack Ox with the Advanced tab selected. However, now the editor wants you to make a name for the blueprint of our Pack Ox. We will also select where the new blueprint will go in the custom palette. 1. Choose a blueprint name that you can easily remember, but remember it must be unique. I would recommend packox as it makes the most sense. 2. Click on the Basic tab and the click Category. 3. Choose Monsters > Animals > Other 4. Click Ok to create the new blueprint of our Pack Ox based of the instance of the original Ox we edited. Click Ok to exit the creatures properties. With that, we have our Pack Ox in our custom palette and we can create dozens of copies of it very easily. From now on, when editing the Pack Ox, we will edit from the custom palette, so just delete the Ox we originally painted.

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

Step 2: Creating the Pack Animal Merchant


Introduction
The best possible interface I was able to come up with was to use the Merchant object to simulate the pack of the animal. This has a few advantages over its one primary disadvantage. The Merchant interface is the same interface used when the PC is purchasing items from a store) Advantages Automatically organizes items by basic type Can be accessed across different areas (extremely important) Disadvantage Requires that the PC essentially sell the Pack Ox the items it wishes to keep on the animal, and to buy them back when taking them off the animal. That disadvantage is a major drawback that I realize, however I played with a host of ideas to create the best possible interface and it is what I finally chose. (Besides, the fact that you can access a Merchant object across different areas is extremely important, it is what allows the PC to go anywhere and still access the same pack, otherwise anything the PC put in the pack, then area transitioned elsewhere, would all be lost, which is obviously really bad). The best solution to the problem then, is to set it so that the PC will spend 1% of the value of any item to buy or sell, so even a $100 item would only cost the PC 1gp, so I think this is a decently reasonable solution. (The editor locks you into 1%, if I could, Id have gone to 0, which would have been perfect, but it doesnt allow it.)

Goal
Create the Merchant that will allow the PC to access the Pack Oxs pack.

Tutorial
To create the pack for our Pack Ox: 1. Paint an NW_LOSTITEMS Merchant from the standard palette into the area. 2. Right-click the new Merchant and open its properties. 3. Change the Name to Ox Pack. 4. Change the Tag to OxPackStore. 5. Change Sell Mark Up to 1 for 1%. 6. Change Buy Mark Down to 1 for 1% and then click Ok. 7. Make sure the Buy Stolen Goods checkbox is checked and the Mark Down value for it is set to 0, this will ensure that anything the PC has obtained can be stored in the pack. 4

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

What we have done is created a new Merchant off the NW_LOSTITEMS which is what the magical pool in the Temple of Tyr used to fetch those lost items in the game. The reason we chose it here was because it is a Merchant object that already has an empty inventory which is exactly what we want for our Pack Oxs pack. We then change its mark up and mark down prices so they were 1% of the original value as thats as low as we can make it. All we have to do next is add the new Ox Pack merchant to our custom palette for easy retrieval and dynamic calling later, just as we did with the Pack Ox. 1. Right-click the Merchant object and select Add to palette. 2. Again the properties pop back up waiting for you to choose a new blueprint name. Make it oxpack. 3. Go back to the Basic tab and make sure that Category is set to Merchants. 4. Click Ok to save the changes and add the new Ox Pack to the palette. 5. Finally, delete the original instance in the area, as we dont need it any more. Now with that, we have our Ox Pack merchant in our custom palette ready for easy retrieval and editing later on. This will server as the store when interacting with the Oxs pack.

Step 3: Creating the NPC Animal Trainer


Introduction
In order for the PC to actually have their own Pack Ox they are going to have to obtain it somehow, and what better way than the local Animal Trainer? Originally, during development, I skipped this part until the end, and instead attached a script to a lever so I could easily call Pack Oxs on demand. This part is easy, were just going to create our NPC, this will slow things down and leave room for some creativity.

Goal
Create an NPC, Nadira the Animal Trainer.

Tutorial
For this simple relaxing little tutorial, were going to take the easy route and use the Creature Wizard under the Wizards menu item. Feel free to stray completely away from these instructions if you so wish. 5

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

1. Select the Wizards menu and then select Creature Wizard. 2. Click Next and select Elf and click Next again. 3. Delete that Wizard class and then select Ranger and add that class to the character, it only makes the most sense. Click Next. 4. We want a female character, so select Female and then select for the Appearance the Elf, Female option, as it looks much better than the basic model. 5. Next select a portrait; Id have to suggest the one in the bottom-left corner. Click Next. 6. For her Faction choose Commoner and click Next. 7. For her First Name, Im using Nadira and for her Last Name Animal Trainer so PCs can easily see what it is she provides. Click Next. 8. Next I suggest putting her in the NPC > Elves category in your custom palette. 9. Next it will give you a little breakdown of her character, just click Next after reviewing it. Then click Finish. If youve followed my suggestions, youve got a little blonde elf woman with a portrait that suggests a brunette. Ah well long as it works right? (Actually, in order to really customize an NPC you create, choose the base model, for elves it is simply Elf, then open its properties and click on the appearance tab, you can change just about every part of the model you want to, to perhaps match up the portrait with the model, again this is cosmetic and totally up to you). Now that weve got the three basic entities we need: The Pack Ox, the Pack Oxs store (the animals pack) and Nadira the Animal Trainer who the PCs may talk to in order to purchase the animal. Next were going to have to start linking the three together. The first step to doing this is to create the dialogue for the Pack Ox and then the dialogue for Nadira.

Step 4: Creating the Conversation for the Animal Trainer


Introduction
In order for Nadira to be of any use to the PC, she must have some mechanism that allows her to gain information from the PC and vice-versa. The perfect interface for this is obviously a conversation.

Note
Writing conversations can be tricky at first, Im saying this cause even after following the Module Construction Tutorial from Bioware I still felt a little overwhelmed at what exactly was going on in the conversation editor. So Ill try

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

to be a little more explicit with my instructions and also try to explain it a little more. Also note from here on out, were going to be doing some scripting, the total scripting required for the pack animal really doesnt amount to much, but I may be biased in saying that due to the fact that programming comes naturally to me and Ive had a good amount of experience with it. I know this is not true for a lot of people and I know how daunting programming and scripting can be at first. So, I will have all the scripts in this document so you can easily copy and paste them where they need to go. I would still encourage you to look through them and try your best to read them even if you dont have any experience. This is really the best way to learn scripting. Again these scripts are by no means all that long or complex. However if you have never programmed before and do not know some of the basic concepts it can and will look like another language, if you are interested in learning how to script, I suggest you purchase the Builders Guide at your local software store as it has a nice little introduction to the C programming language and how it works. The guide itself is also a nice reference, I dont think its required, as if you are just learning, the scripts in that book can be extremely daunting, but there is an appendix that does a nice job of explaining some basic foundation programming concepts. Also check the Bioware NWN Scripting forums as there are a slew of nice folks there who have been teaching people how to script since the game was released. If you already have experience with scripting and programming then youll probably be able to just skip any explanations I give.

Goal
Create a conversation for Nadira the Animal Trainer so the PC may purchase the pack animal.

Tutorial
First we need to open the Conversation Editor for Nadira the Animal Trainer. 1. Select Nadira in the custom palette we saved it to (NPC > Elves) and right-click to open her properties window. 2. Click edit at the bottom next to the Conversation box to open the editor. The editor should open and may at first seem daunting what with all the buttons and options going on. Basically, all we are going to need to do is use the Add button which is the one on the left toolbar at the very top. The Conversation Editor works like one large tree-diagram only turned on a 90 degree angle counter-clockwise. The start of the conversation in the game will begin at the root. Upon conversation initiation by the PC, the first person to

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

speak is always the NPC. That first statement they speak is whatever the root is. So the first thing we need to do is to create the greeting message for Nadira. 1. Click on the Add button in the top-left button toolbar. A modal-window will pop-up asking for the text we want Nadira to speak. 2. Enter, Hello <FirstName>, would you like to purchase a Pack Ox for 800gp? without the quotes. Then click Ok. 3. A red line of the text you just entered will appear for Owner (which means thats Nadiras speech). Next click Add again with that new line selected. Enter, Yes. And then click Ok. 4. Select the red line again, and click Add again, this time enter, No. and click Ok.

Now you should have a very small dialogue tree with Nadiras red greeting line and two blue lines. The two blue lines represent the options that will be displayed for the PC to speak to Nadira in order to answer her question about buying a Pack Ox. Whenever you add a new node when a red line is selected, you are creating the text for the PC to speak. Just remember, red lines are the NPC speech and the blue lines are the PC speech. You may also see gray lines in other tutorials, these are just copies of another line already in the conversation tree, they are used for more complex conversations, where you may want to loop back to a previous line of the conversation. Also, note the <FirstName> part of the initial greeting. This is what is called a Token which are little tags in the editor that pull information out of the game at runtime. This allows you to grab things specific to the currently running game so its more dynamic. You can see a host of these tokens by right-clicking in the little modal window where you enter text. There are a variety of different tokens that you can use to spice up and make your module a little more interactive to whoever is playing. What will happen with our token, is the game will automatically replace the <FirstName> tag with the PCs first name, so it might say Hello Tanis. (A node is a line in the conversation tree; they are the dots in connect-the-dots, which is essentially what we are doing). Now that we have the basic conversation all set up, we need to actually give the Yes and No PC responses, some meaning. We do this with a small script attached to the particular node in question. So, in order for the response Yes to actually purchase the Pack Ox, we will have to script it so it does just that. 8

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

You will notice a set of tabs at the bottom right of the Conversation Editor window; this is where you can assign different things to happen based on whatever node is currently selected. 1. Select the Yes. Node and the switch to the Actions Taken tab in the lower right. 2. Click the Edit button next to the script pull-down menu. 3. The Script Editor window should pop up. Simply cut and paste the following code into the window.
void main() { location lSpawn = GetLocation(GetPCSpeaker()); int iGold = GetGold(GetPCSpeaker()); object oPackAnimal; object oPackStore; if(GetLocalInt(GetPCSpeaker(), "ownOx") != 1) { if(iGold > 800) { TakeGoldFromCreature(800, GetPCSpeaker(), FALSE); SetLocalInt(GetPCSpeaker(), "ownOx", 1); oPackAnimal = CreateObject(OBJECT_TYPE_CREATURE, "packox", lSpawn, TRUE); oPackStore = CreateObject(OBJECT_TYPE_STORE, "oxpack", lSpawn); SetLocalObject(GetPCSpeaker(), "PackAnimal", oPackAnimal); SetLocalObject(GetPCSpeaker(), "PackStore", oPackStore); SetLocalObject(oPackAnimal, "Owner", GetPCSpeaker()); } else SpeakString("You do not have enough gold!"); } else SpeakString("You already own a pack animal!"); }

4. Then simply click the Save button at the top of the editor window and name it sc_pack_buy. The sc stands for script. 5. You should get a message telling you the script compiled successfully. If you do not, then try it again; be sure to just delete whatever is initially there.

Script Explanation
What this script does is checks to make sure the PC doesnt already own a Pack Ox as well as checks if the PC has the correct amount of gold required to purchase the Pack Ox, and if they do, takes it away and dynamically creates off the blueprints the Pack Ox as well as its pack. If they do not have the correct amount of gold, they are told so by a string of white text that appears above the

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

NPC in the game. Also, if the PC already owns a Pack Ox, they are informed of that fact. No money is taken and no Pack Ox is created. Another really important thing that occurs in this script is that a local integer variable I have named ownOx is stored on the PC with the value of 1 or True. This is basically used so that the PC cannot buy more than one pack animal, for the obvious possibility of a massive amount of animals all over the place. A local object is saved as Owner which holds the PC who is speaking, essentially the PC who now owns the animal. This is extremely important and is what makes sure nobody else is allowed to interact with the Pack Ox when we check it later. Two local object variables are also set, so that each PC is issued their own unique Pack Ox and corresponding pack store object. You can close the Script Editor window when you are finished going over the code. Then click Done in the Conversation Editor window and click the Save As button in the top set of buttons. Save the Conversation as simply nadira for quick reference later. Then close Nadiras properties.

Step 5: Creating the Conversation for the Pack Animal


Introduction
The only real way to obtain information from the PC is through the conversation interface, so in order to command your pack animal you need to speak to it. The original developers did the same thing with familiars. However were going to expand on it a little and allow the PC to do more interactive things with their pack animal than they could with their familiars.

Goal
Create a conversation that allows the PC to give commands to their pack animal that will allow the PC to access the animals pack, command it to follow them and command it to stop.

Tutorial
First we need to open the conversation editor for our Pack Ox. 1. Select the Pack Ox where we saved it in the custom palette. (Monsters > Animals > Other > Pack Ox) 2. Right-click on it and select Edit. We are going to edit the actual blueprint even though its not actively in the area. 3. The Basic tab should be selected; at the bottom is the conversation box. Right now there is no conversation, click edit so we can make one.

10

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

After clicking Edit we are again presented with the Conversation Editor. 1. Click Add to create the Oxs initial and only node. Enter What is your command? without the quotations. Click Ok to save the changes. 2. Click Add while the first node is selected and enter Access Pack. 3. Click Add with the first node selected again and enter Follow Me. 4. Finally click Add once more with the first node selected and enter Stay Here.

The above image has a fifth node, Set Pack Animal Free. Which we have not covered yet. This is added on more towards the end of the tutorial and deals with the clean up that is required when the animal is destroyed. For now we wont worry about it. The conversation tree for our Pack Ox is now complete. Again just as we did with Nadira we need to implement the correct behavior of the game based on the responses of the PC. 1. Select the Access Pack node and change over to the Actions Taken tab. 2. Click Edit to open the Script Editor window. 3. Copy and paste the following script into the window just as we did with Nadira.
void main() { object oStore = GetLocalObject(GetPCSpeaker(), "PackStore"); if(GetObjectType(oStore) == OBJECT_TYPE_STORE) OpenStore(oStore, GetPCSpeaker()); else ActionSpeakStringByStrRef(53090, TALKVOLUME_TALK); if(GetLocalInt(GetPCSpeaker(), "isFollowing") == 1) { object oPC = GetPCSpeaker(); object oOx = GetObjectByTag("PackOx"); ActionDoCommand(ActionForceFollowObject(oPC, 1.0)); } }

Save this script as sc_pack_access.

Script Explanation

11

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

First the OxPack Merchant store is checked to make sure its a valid store object, this is done as a safety precaution. If it is, then the store is opened to the PC who is currently speaking with the Pack Ox (which happens to be the one who owns it). Otherwise, let the PC know that no such store exists. Finally, the script checks to see if the Pack Ox is currently following the PC based on a local variable we will set in the Follow Me node next. If it is equal to 1 (which means True) then we want to make sure the Pack Ox continues to follow after the conversation ends. The reason we need to do this is because that actions are wiped from a creature or NPC when a new conversation response is selected, this is something that seems to be hard coded by Bioware, so we just save a variable well call isFollowing in another script and check it here to solve the problem. This is not necessarily needed; it is added as a convenience to the PC. Next we need to create the script for the Follow Me node. 1. Select the Follow Me node and click Edit in the Actions Taken tab. 2. Copy and paste the following script into the editing window.
void main() { object oPC = GetLastSpeaker(); object oOx = GetObjectByTag("PackOx"); SetLocalInt(GetPCSpeaker(), "isFollowing", 1); ActionDoCommand(ActionForceFollowObject(oPC, 1.0)); }

Save the script as sc_pack_follow.

Script Explanation
This is a simple script that creates the local variable isFollowing, we were previously talking about and sets it to 1 so we can save the state information of the Pack Ox. We then simply tell the Pack Ox to follow the PC at about a meter behind them. Finally the last script for our Pack Ox the simplest script in the whole tutorial! 1. Select the Stay Here node and click Edit in the Actions Takens tab. 2. Copy and paste the following script into the editing window.
void main() { SetLocalInt(GetPCSpeaker(), "isFollowing", 0); }

Save this simple script as sc_pack_stay.

Script Explanation
12

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

We dont actually have to explicitly tell the Pack Ox to stop, because as I explained before, when a conversation option is spoken to an NPC it clears any action the NPC was previously doing, so simply saying Stay Here actually does the trick with absolutely no script! However, we set that local variable isFollowing to 0 (or False) to let the sc_ox_access script know that it is not currently following the PC, in case the PC access its pack after telling it to stop. Again, this is not needed; it is simply added for convenience to the PC. The last script we need to attach to the Pack Oxs conversation is the one that will make sure that the PC who purchased the animal in question can only be commanded by that person. 1. Select the, What is your command? node. 2. Select the, Text Appears When tab and the click Edit. 3. Copy and paste the following script into the editing window.
int StartingConditional() { if(!(GetLocalObject(OBJECT_SELF, "Owner") == GetPCSpeaker())) return FALSE; return TRUE; }

Script Explanation
This is a simple script that basically secures the Pack Ox from outside intervention. We check the Owner local variable against the PC attempting to converse with the animal, if they own the Ox, the object saved in Owner will be the same object as the PC currently trying to initiate conversation. If they are not equal, conversation is not allowed to happen. This is an absolute necessity if the pack animal is going to be used in an online multiplayer environment. Close the script editor window, then click Save As and save the conversation as ox.

Finishing Touches
Finally, to finish off the Pack Ox we need to do two more things. First we need to make the Pack Ox a plot creature. 1. To do that that you simply open up its properties, select the Advanced tab and make sure the Plot checkbox is checked. 2. Click Ok to save the changes weve made to the Pack Ox. Next, we need to create a separate Faction for the Pack Ox and perhaps any other pack animal you may decide to create. 1. Open the Faction Editor by clicking on Tools > Faction Editor. 2. Click the Add Faction button on the right. 3. Name it Beasts of Burden and select Commoner as its parent faction and then click Ok to save the changes. 13

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

4. With all the factions checkboxes checked on the right side, select Beasts of Burden a bunch of bars should show up. Drag each bar so that it is bright blue and is at 100. 5. Next click on each faction other than the Beasts of Burden and drag the bar that corresponds with Beasts of Burden so that it too is bright blue and at 100. 6. Click Ok to save all the changes. 7. Go back into the Pack Oxs properties and select the Advanced tab. Change its faction to Beasts of Burden then click Ok to save the changes. By making the Pack Ox a plot creature we are forcing it to be immune to any and all kinds of attack; it can never die or be destroyed. The Faction editing we did, ensures that nobody takes advantage of an indestructible creature. By making every other factions standing to Beasts of Burden (which happens to be only our Pack Ox right now)100 we are making it friendly with everyone else, and everyone else friendly to it. If we didnt do this, it would be possible for a clever PC to take advantage of the indestructible creature by allowing it to lure enemies to it, while the PC fought them from a distance with no worry in the world. By making it friendly to everything, we force evil creatures to simply ignore it. The only thing left to do now, is to simply place Nadira the Animal Trainer somewhere in your world, so players can purchase their very own Pack Ox, which they can then travel with around your campaign.

Conclusion
At this point, you should have a fully implemented Pack Ox for use on your own module. Weve accomplished all of the things we set out to accomplish and hopefully youve learned a lot of new things about Neverwinter Nights editing, or at the very least, honed things you already knew. If for any reason something doesnt work correctly when you try it out in your game, refer back to the area that isnt working and see if you missed something. One last final comment, after completing this tutorial, you should know that it is very easy to make a pack animal out of any creature in the game now. If youre so inclined, you can make that Green Dragon your own personal beast of burden, although I certainly wouldnt recommend it! By assigning the ox conversation to the creature in question, you can easily create another pack animal, as it is all contained in that file. Just a little heads up for everyone who wants a greater selection of animals, and the guy on the forum who wanted his pack chicken to store his sling bullets in its beak.

Final Thoughts
14

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

The pack animal is far from done in my humble opinion. For one, there needs to be some way of selling the animal back or issuing a command to set it free (both very easy to write scripts) in case a PC no longer wishes to have their pack animal. An extremely important thing that MUST be handled if/when this is implemented is to make absolutely sure when the pack animal is destroyed its corresponding pack is destroyed as well, this is easy to overlook as you never actually see it in the game, but it is there. If we were to not clean up after ourselves, we could overload a server with too many store objects. Also, I think there are a few more commands we could possibly give the pack animal to make it even more interactive. I had previously allowed the animal to help attack in combat, but after being forced to making it a plot creature that had to be taken out. If anything, perhaps we can implement a simple Play Dead script for sick comical value. * * *

Because the destruction is an important feature, Ive written and tested a small script that does the trick, all you have to do is create a new node on the pack animals conversation that allows the PC to set it free and attach the following script to the action taken when it is chosen.
void main() { object oPackAnimal = GetLocalObject(GetPCSpeaker(), "PackAnimal"); object oPackStore = GetLocalObject(GetPCSpeaker(), "PackStore"); location oSpawn = GetLocation(oPackAnimal); SetLocalInt(GetPCSpeaker(), "ownOx", 0); SetPlotFlag(oPackAnimal, FALSE); DestroyObject(oPackAnimal); SetPlotFlag(oPackStore, FALSE); DestroyObject(oPackStore); CreateObject(OBJECT_TYPE_CREATURE, "nw_ox", oSpawn); }

This will make sure the animal gets destroyed correctly and for added effect a new generic Ox will spawn in its place to signify that it is free. I added this because it was needed. Obviously you could attach something similar to the Animal Trainer so the PC could actually sell it back for some money. Remember though, once its deleted it is gone, remember to get all your things out of its pack before destroying it. FreakyFerret must be noted for solving a previous problem of the deletion of the pack causing problems. He brought to my attention the SetPlotFlag() function that allows us to turn off an object being a plot object, which apparently causes problems with deletion. Adding those two SetPlotFlag() functions, one for the

15

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

animal and the other for the pack solved the problem and allows us to delete both gracefully. Again, all of this is extremely important, as we are essentially freeing resources we no longer need. (This is exactly the same as the new statement in C++, we need to make sure we clean up after ourselves). It may very well be that the game does this on its own, but I would venture to guess that it doesnt, so well do it ourselves, after all, we are the programmers here. * * *

I can already see a few things that would need further implementation. It is not good to totally destroy the creature by selecting one option, we should add a new node to make an, Are you sure you wish to set me free? option just in case they accidentally click that Set me free option. This should be easy to do by now so I will not go into specific instruction on how to do it. After a lot of testing I believe this script to be secure enough to run on a persistent server. Full integrated secure ownership of each pack animal and corresponding pack has been implemented and tested. By releasing this tutorial I hope to garner a lot more play testing of the entire project and to hopefully inspire others to contribute in any way they can to the overall project.

Final Notes
This was a small project I started roughly the end of the week that Bioware released their Module Construction Tutorial on Wednesday June 26th, 2002. This was actually a small personal test of what the Aurora Toolset was truly capable of. I wanted to add more functionality to Neverwinter Nights by adding the feature of a pack animal. In under a week, I was able to test out various ideas and then settle on one and fully implement my original goal of creating a usable pack animal. Throughout most of my work, I garnered a lot of help from the Bioware Builders NWN Toolset forum. I got a good amount of support from the various interested members who all had an idea or two, and I think I can say most of which ended up being used in this tutorial in one way or another. Many thanks to those people who had some suggestion, some question that made me think long and hard about a particular problem, or those who just wanted to support the creation of a pack animal in NWN. I appreciate all the support and positive criticism Ive received. I would also like to give special thanks to FreakyFerret on the forum who probably helped me out the most, both in suggestions and ideas, as well as being a full supporter all week long. He also saved me time by procuring three of

16

BioWare Aurora Neverwinter Nights Toolset

Pack Animal Tutorial

the primary scripting documents floating around out there which were all great assets and allowed for the fairly quick development time. I would like to thank the people at Bioware for bringing such a great game to the world. I have never seen a stronger editor anywhere, and I really must commend the people who decided to use C as the scripting language for Neverwinter Nights. They deserve a lot of credit for coming up with such a sophisticated scripting system that is far beyond the scope of absolutely any other game to have ever been on the market to date. I hope other companies take notice of how user-friendly and extremely powerful a game editor can be. I am interested in hearing any suggestions and/or comments about this tutorial or my pack animal idea. If anyone has any better implementations of anything Ive done here, I would be very interested in seeing it. I will definitely give credit to anyone who wishes to contribute to the pack animal project in a positive way. I can be contacted via email at [email protected] or on the Bioware NWN forums by my screen name, BetterThanLife.

Special Thanks
FreakyFerret phpphreak Other Supporters Bioware Mountain Dew Tool

17

You might also like