Resources for Builders

Here you can find a number of resources for builders that I am posting as I come across them. To a certain extent, this is my own personal development journal, but I'm posting it with the idea that others may find it useful.

If you have suggestions, requests, questions, etc. please let me know.

Registration is open to all and only requires a verified email address. If you are an authenticated user, you can contribute to the resource book by clicking the "Add child page" link. These contributions will go into the moderation queue for review.

Authenticated users can post comments, but all comments must first be reviewed for approval. Comments may be promoted into the body of the page, then cleaned up for legibility, or incorporated as child pages.

Please remember that the goal is to create a concise and easy-to-use reference that brings together as much of the knowledge-base from the community as possible. And thanks in advance for your contribution!

Getting Started

Here you will find resources and tutorials for getting started.

Official documentation

The official nwn2 documentation can be found in the "Documentation" folder of your Neverwinter Nights 2 folder. So if you installed it in the default location, you would find it at:

C:\Program Files\Atari\Neverwinter Nights 2\Documentation\nwn2toolsethelp.html

NWN2 Toolset: Getting Started

NWNmaster over at nwn2toolset.com has a great set of tutorials for getting to know the toolset. His current list of topics include:

Navigate around the Toolset
Toolset Controls
Create an Area
Interiors
All about Terrain
Texturing
Grass
About Water
How to add a Start Location
Create Door Transitions
Add Placeables
Walkmesh
Baking
How to link up areas

Head on over to nwn2toolset.com to check it out:
http://www.nwn2toolset.dayjo.org/ToolsetTuts/gettingstarted.html

The Don't Panic guide

Another great resource you should check out is Gilthonym's Don't Panic: The Hitchhiker's Guide to First Opening the NWN2 Toolset.

Here's his intro:

Overwhelmed by the toolset?

Don't Panic: read this guide and get to grips with the basics of the toolset.

The guide assumes no knowledge, and is written for anyone, whether they have experience with the Neverwinter Nights 1 Toolset or not.

The guide currently covers:
The general interface
Creating external and internal areas
Placing trees, buildings and doors
Camera controls
Day/Night lighting
Editing properties
Selecting music for an area
Tinting objects
Rotating objects
Laying down interior tiles
Creating transitions between areas
Installing plugins
The external terrain tools
Baking and walkmeshes
Chests and inventories
Creating custom characters
And more...

There are plenty of screenshots so you can easily follow the tutorial.

I hope this guide helps people to create the adventures they want to share. I encourage you to leave feedback for me so I can keep improving it.

Head over to the vault to grab the Don't Panic guide:
http://nwvault.ign.com/View.php?view=NWN2Tutorials.Detail&id=14

The Tome of Building

Another great tutorial is Stebby Surehand's Tome of Building.

The NWN2 Tome of Building (ToB) is an on-line help compilation of existing NWN2 documentation. It contains the Obsidian documentation for the Pre-Release Toolset as well as tutorials and tips developed by the Community. I converted their documents into on-line help. Please read the 'Welcome' topic in the Tome for information about how the documents in the Tome differ from the originals. I did not write any of the toolset-related content and I provided full credit to the original authors. Where possible, I also included links to the original document files so you can easily vote for them and leave comments for the authors.

While the Tome of Building is an on-line help file, I did not have time to add hyperlinks to every cross referenece. This first edition of the ToB does contain some hyperlinks within the text, but mostly it is a convenient compilation of existing documentation. It is also easily navigable, thanks to the hyperlinked table of contents and powerful search feature.

The Tome is divided into two main sections, Obsidian Documentation and Community Documentation. There is also a Welcome section that introduces you to the Tome and explains how the Tome differs from the individual documents and how to navigate through the help file.

Recently, several new tutorials have appeared on the Vault. I decided to release this version of the Tome so people would have what it contains now, if they wanted it, and I will update the Tome with the new tutorials for the "Second Edition".

Head over to the Vault and get it:
http://nwvault.ign.com/View.php?view=NWN2Other.Detail&id=10

Folders and formats

The number of file formats, and where those files go, can be a bit confusing. Here is some basic information. More will come.

The Basics

All user data is meant to go in your My Documents folder. The default place for this is "C:\Documents and Settings\Sean\My Documents\Neverwinter Nights 2"
(more to come)

All game data is meant to go in your Program Files folder. The default place for this is "C:\Documents and Settings\Sean\My Documents\Neverwinter Nights 2."

All the files for the Official Campaign (OC) are also in your Program Files folder. This is a big change from NWN1 and it has confused some people. Generally, you don't have to get into this directory, but the BIG exception is the plugins folder in the NWN2Toolset folder. Here's the rundown:

  • The Ambient folder - This folder holds the wav files for background noises. These elements are available across all modules. Note that when trying to decide what background sounds you want, you can play these directly from your preferred multimedia device, although I cannot say if there are any permissions issues when doing so with the Toolset open.
  • The Campaigns folder - The supporting campaign files (scripts, images, etc.) are in the campaigns folder. These are files that are available across all the modules in the OC. These resources are only available to the OC.
  • The Data folder - This folder consists of .zip files that hold data that can be used by the OC, and any other module, including those created by you. The 2da files, voice over wave, and many other resources are held here. These elements are available across all modules.
  • The dmvault folder - Unknown.
  • The Documentation folder - You should read this.
  • The Effects folder - Unknown, but at a guess these seem to be basic effects that the Toolset uses.
  • The hak folder - This contains your hak files. At this time, I am unclear if hak files go here or in the My Documents area.
  • The Localvault folder - This contains the basic characters that come with the game.
  • The Miles folder - Unknown.
  • The Miles folder - Unknown.
  • The Modules folder - The actual modules for the OC are in the modules folder. They are numbered and also have a descriptive name. These resources are only available to the OC.
  • The Movies folder - Contains the .bik files that use present the movies (The logos and the into, etc.)
  • The Music folder - This hold the bmu files for background music and combat music. These elements are available across all modules.
  • The NWN2Toolset folder - Contains the source for the Toolset. Note that this also contains the "Plugins" folder. This is where you put community created plugins so that they are available in the Toolset.
  • The Override folder - Will allow you to override some files, most probably in the OC. At this time, I am unsure what resources can be overridden.
  • The patch folder - I'm assuming this is used during the patching process.
  • The Servervault folder - Unknown.
  • The temp folder - Definitely used during the patching process. Unknown if it is also used during gameplay.
  • The UI folder - I think this is where you place your custom UI files, but I am not sure, as there is also one in the My Documents folder.
  • The Utils folder - Unknown what these are for.

There have been some reports of the Autosave corrupting various files when the modules

BMU

BMU stands for BioWare Music Unit. This is the file format for background music files. AFAIK, essentially, it's an .mp3 file with some tinkering done on the first few bits of the file and the extension changed.

Here are some tools to convert bmu files:

MP3toBMU 0.35
http://nwvault.ign.com/View.php?view=Other.Detail&id=225

Prince Rouse's Mp3toBMU and WinMP3Converter
http://nwvault.ign.com/View.php?view=Other.Detail&id=821

Using the tools above, you can convert all the music in the Music folder under Program Files to an mp3 and listen to them.

You can find information on the BMU format in this NWN1 tutorial on custom music. (Note that a good deal of this has changed for NWN2).
http://nwn.bioware.com/builders/sounds_bmu.html

At the time of this writing, there are still some complications with bringing your custom music into your module, and I remember seeing a post talking about improvements that will be coming soon. If anyone has any resources along these lines, please let me know.

ERF

ERF stands for Encapsulate Resource File. It is used when importing and exporting resources from one module to another.

Most people keep .erf files in a folder in their My Documents folder called erf. Note that you don't get an erf folder by default, so feel free to created one when you need it.

PFX

The .pfx file extension is for particle-based effects. As I understand it, these are used as resouces when creating .sef files. You can find some of them in C:\Program Files\Atari\Neverwinter Nights 2\Data\NWN2_VFX.zip.

SEF

The .sef files are special effects files for NWN2. Most of the ones that come with the game are located in C:\Program Files\Atari\Neverwinter Nights 2\Data\NWN2_VFX.zip

From the official documentation:

"Visual effects are composed of effect files, which are individual components of an effect (a particle system, a trail, a billboard, etc.), and SEF files, which point to the effect files and organize them into a more complex visual effect."

As I understand it, .sef files are what you create when you save a visual effect from the visual effects editor.

WMP

A .wmp file is created by the world map editor plugin.

The power of 32 characters

Before you do anything, save yourself a lot of time and make sure all your modules, areas, object tags, variable names etc. are less than 32 characters. Failure to do so will result in missing data, crashes and other unexpected behavior.

For example:

While I was working on the PRR scripts, some data was not being saved because my global variable names were more than 32 characters. Anything beyond character 32 was getting dropped. I ended up using a hash to store my variables, something that I'm still not quite sure is the right answer. (Hopefully, I'll work this out soon.)

Another example, is that recently Markus "Wayne" Schlegel, the builder behind the Pool of Radiance Remastered series, was having problems loading the next module in the series. After some testing, it came out that his modules were named with 39 characters, and would sometimes (usually when loading the third module) crash to the desktop.

So there you go. Keep the all-powerful 32-character limit in mind. When it doubt, it's better to stay below 32 characters then go over. You'll potentially save yourself hours of troubleshooting.

FRW Base Module

Lord Niah of the Forgotten Realms Weave has a great base module to help get people started. Not only is it a great way to get a head start on your module, it also serves as a clean example of the proper way to perform a lot of common tasks.

This module includes base scripts and items for the Forgotten Realms Weave (FRW) project, including a player starting area with a trainer and basic merchant.

Other features Include:

-- Wandering Monster and Rest tag system
-- Hardcore bleeding or OC death system
-- Chest-based Random Loot system w/ breakable items
-- Flavor text, ability, and skill check triggers
-- Demonstration companion and "Sunken Flagon" style Inn
-- Demonstration OOC (Out of Character) Start Area
-- Patcha's Sitable chairs

Note: This is currently tested for singleplayer only, but should work for non-persistent multiplayer.

Be sure to read through the documentation file, as well. It has a lot of useful information.

Go grab it here:
http://nwvault.ign.com/View.php?view=NWN2Scripts.Detail&id=55

Areas

Here you can find information on creating areas.

You may also want to check out this page concerning naming conventions when you are naming your areas: http://www.wendersnaven.com/node/46

Area lighting

ciViLiZed posted the following links for day and night lighting options for areas:

Day/Night stages lighting is discussed here Click Here and here Click Here

Bloom

From the NWN2 Teakguides:

Bloom Effects: Bloom effects change the quality of the lighting to create a more saturated, richer and hazier looking game world. The screenshot comparison above demonstrates the difference between enabling or disabling this option in NWN2. If bloom is not to your taste, you can disable it to gain a few FPS, however aside from making the game world seem more vibrant, it also works to reduce the appearance of aliasing (jaggedness) at far less impact than enabling Antialiasing. Note that the more advanced HDR lighting can't be enabled in NWN2; even though there is a UseHDRIfAvailable setting it does not currently work.

Periodiko posted additional comments in this forum thread:

Technically speaking, if you crank bloom up then it will blur everything you see a little, but it will blur bright things far more than dark things. If you crank it really high it will create a dreamy sort of effect, where the bright lights are a little too bright and everything is a little blurry. If you turn it off then the area will seem darker and more sterile.

The main ways it's used in the Neverwinter Nights Toolset that I've seen is with the "hazy" effect. For example, the Githyanki house in the OC has the bloom cranked up really high so the whole area feels magical and dreamy. It is also cranked higher during daytime lighting settings to reproduce the haze of the sun. I think the default morning setting that you see first-thing when you don't adjust the time-settings has it running pretty strong.

ciViLiZed posted the following explanation of some of the settings:

BloomSceneIntensity (BSI) : Sets the overall brightness level of all lights. (With this, individual light intensity values in effect become relative rather than absolute.) As it brightens light, it will not brighten places where light does not reach. A setting of 0, eliminates all light except the highlights (see below). A negative value creates negative brightness which effectively darkens highlights. A BSI of 1, with other bloom settings set to 0, has the same effect as if bloom was disabled.

BloomHighlightThreshold (BHT): Sets the size and quantity of highlight hotspots. Models and tiles have defined zones (“hotspots”) where light causes highlights when it hits them. Different hotspots will be highlighted depending on the angle of the light (e.g. GroundLight vs SkyLight). A higher BHT value will result in bigger and more numerous hotspots. A negative value (regardless of the number) sets hotspots to their maximum. The minimum value at which hotspots appear seems to be about 0.5.

BloomHighlightIntensity (BHI): Sets the intensity of the highlights. Highlights will expand/flare more and more as the value is increased. A very high BHI value (e.g. 1000) with a low BHT (e.g. 0.5) will show clearly where the hotspots are located. Increasing BHI and BHT will eventually burn out the entire scene. A negative BHI value creates darker and darker highlights (eventually creating a negative effect if BSI is positive)

BloomBlurRadius (BBR): Multiplies each individual highlight and spreads these “clones” around the original, like petals of a flower in… bloom. (Original highlight size though seems to be reduced in this operation, making it seem that the highlight might be broken down and its pieces spread, rather than it being cloned.) A higher value increases the distance (i.e. radius) between the center of the original and the center of the clones/pieces. The clones/pieces are spread regularly in a flat grid pattern around the original highlight. Typically, 8 clones/pieces appear to be created. The angle of the flat grid remains perpendicular to the point of view, while the distance between the clones/pieces varies with viewing distance. BBR value is an absolute, so prefixing a negative has no impact. BBR, BHT and BHI combine to create a blur effect. Increasing the BBR up to a point where the additional highlights detach themselves from their model will result in a ghosting effect.

BloomGlowIntensity (BGI): No effect in interior areas. (In fact, the default interior DayNight stages settings have it set to 0.)

Ovocean added these also:

As I understand it, the bloom effect is a filter applied to each frame by the 3D card.
More precisely, it sorts of make a blured copy of the frame and mix it together with the original. (Consequently, dark parts of the frame spread around as much as bright parts (depending on the BHT). There is no direct link between light sources and the bloom effect.)
The toolset gives us some control over the blur filter and how the blured framed is mixed (I would say 'multiplied') with the original frame :

BloomSceneIntensity : Controls how much of the original frame will be in the final mix (= it's luminosity). Set to "0", you'll only see the blured copy of the frame. "1" stands for "luminosity 100%".

BloomBlurRadius : Defines the radius of the blur (how far colors are spread).
Actually, the blured frame is made by mixing a great number (47, if I can trust my sight) of copies of the original frame, arranged in a repeating pattern. The greater the shift of a particular copy, the more transparent it is. The BBR defines the shift between each copy.
If this is not clear to you, try setting the BSI to 0 and play with great values for the BBR.

BloomHighlightIntensity : Well, now, it looks like there is even one more filter put somewhere in the process. This filter controls the luminosity of the blured frame and the BHI is the main parameter of it : it's the global luminosity value (of the blured frame).

BloomHighlightThreshold : This second parameter sets the (color's) intensity threshold beyond wich the colors are affected by the BHI. I don't know what threshold corresponds to what intensity, but when a particular pixel's intensity is under the threshold, it's luminosity is set to 0.

Finally, here are the settings I use when I want a bloom effect wich slightly blends the colors without modifying the overall luminosity of the scene :
BSI = 0.8
BBR = 10
BHI = 0.25
BHT = 2

PS : I've seen no effect for the BloomGlowIntensity.

Check out the full thread here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=564969&forum=1...

Exteriors

Information concerning exteriors.

Anduraga's area building tips

One of my favorite builders when it comes to textures is Anduraga. He's given some great tips for the Waterdeep project and other projects over at the Weave. He recently posted a great list of tips for people looking to build good exterior areas. Here's his intro:

I find that many people find area building a very difficult task, and when they do make areas, they are often basic, because of the lack of tutorials, tips, etc. I can relate that to somewhat in a different department. Scripting isn’t really my strong suit, but I can manage to do the basics. But anyway, to the point of this post/thread. I have designed this thread to help new builders, adept builders and even master builders with tips and tricks of the trade. I haven’t checked out many of the tutorials on the vault (Shame on me, I know), so all this stuff I’m throwing out here now might already have been covered.

Check out his list of tips here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=578694&forum=1...

 

DLA Tutorial: Exterior Area

BenWH over at DLA has posted a great tutorial on creating exterior areas in the DLA Toolset forums:

Trying out the NWN2 toolset for the first time? Here are the results of my explorations on building an exterior area, combined with the wisdom of several others…

Read the full tutorial here:
http://www.dladventures.net/vB/showthread.php?t=3791

FRW: Texturing a good grasslands area

Phoenixus posted a great tutorial on texturing a good grassland area. Check it out here:

http://nwcitadel.com/forums/showthread.php?t=858

jlf2n: Learning shading

jlf2n posted a great thread about how to reverse engineer methods for shading. In his post, shading refers to using the color brush to add shadows. You'll also see this sometimes refered to as "grayscaling." Here's his intro:

Being new to the NWN2 toolkit I set out in search of a tutorial to show me a terrain shadowing tricks. I couldn’t find any so I set to dissecting one of the areas that came with the main quest to see what I could see. The process I used was very helpful to me so I thought I would run through it here for you guys.

He goes on to walk you through opening an area from the OC, removing all the shading, and trying to recreate it. A great idea for learning how the people at Obsidian put some of the areas together.

Check out the thread on the nwcitade here:
http://nwcitadel.com/forums/showthread.php?t=1158

Layering textures and sounds

The layer with the highest percentage is the one that determines what sounds a creature makes when it walks on that area. Make sure you bake the area in order for the sounds to take effect.

NWN2 Mods: The Arena

Mike - aka Plane Walker, aka soulraven666 - over at NWN2 Mods has posted a step-by-step tutorial on creating a "roman Colosseum."

I thought I would detail the process I am going through in creating this Arena so this post is going to be an ongoing one that I continue to add to as I progress. Please feel free to reply with comments.

Head over to the NWN2 Mods forum and check it out:
http://www.nwn2mods.com/forums/index.php?showtopic=21

NWN2 Toolset: Areas

NWNmaster over at nwn2toolset.com has a great set of tutorials for creating areas. His current list of topics include:

Create an area
Interiors
All about Terrain
Texturing
Tips for creating an Area
Grass
About Water
How to add a Start Location
Create a waterfall
Create door transitions
Day and Night Settings
Walkmesh
Baking

Head on over and check it out:
http://www.nwn2toolset.dayjo.org/ToolsetTuts/area.html

NWN2 Toolset: Bridges

NWNmaster over at nwn2toolset.com has a great tutorial for placing a bridge.

After seeing a few people having problems with placing bridges I thought I would give it a go and see what the fuss was about. First thing I did was to create two raised areas like so:

Head on over and check it out:
http://www.nwn2toolset.dayjo.org/ToolsetTuts/placeables/bridge.html

TerraCoppa: Copying and rotating areas

A great tool for making changes to your area is TerraCoppa, by Tani. The most obvious benefit of this tool is being able to rotate areas, so that north matches with north. Here is Tani's description:

TerraCoppa is a toolset plugin allowing you to copy and rotate parts of one (exterior) area to another, including:

- terrain (heightmap)
- tinting (colors)
- textures
- gras
- water
- objects (creatures, placeables, ...)

of course you could copy objects via toolset as well, but it lacks the ability to copy or rotate terrain (heightmap).

Go grab the tool here:
http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=25

Documentation is a bit light, but here is a quick rundown on how I got it to work:

  1. Install the plug-in and restart the Toolset.
  2. Back up your module!
  3. Open your module and the area you want to rotate.
  4. Create a new external area, of the same size.
  5. Launch the plug-in from the Plug-ins menu.
  6. Set the first area as the source and the new area as the destination.
  7. Leave everything checked.
  8. Look for the dropdown at the bottom of the screen and choose the amount you want to rotate the area. (90, 180, 270).
  9. Click the green button and let it go.
  10. Make sure you bake afterwards.

For additional reading, here is a thread on the forum talking about "North Direction" and rotating the area.
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=558621&forum=1...

The walkmesh helper

The walkmesh helper is a tool created by Zarathustra217 and apparently quietly slipped into the 1.05 patch.

I came across this post by TheStoryteller01 asking about making creatures hover above terrain. Grinning Fool posted some really amazing looking screenshots that he created using the walkmesh helper.

The walkmesh helper is a tool on the vault by Zarathustra217. Here's the description:

This is a simple package intended to make a builder's life easier. It consists of simple squared invisible placeables with a walkable walkmesh. When scaled, the Walkmesh Helper objects are handy to use along with Walkmesh Cutters (found under trigger) to have more control of the walkmesh. This especially is evident when using a combination of placeables, like several bridges. Place the Walkmesh Helper just above the walkable plane of the placeables, scale it to properly cover the desired area, and cut away with Walkmesh Cutters as fit. You might get the best result by converting the placeables to environment objects, but it shouldn't be required.

It is intended to work as an override, and doesn't require that the end users of your module have this package in place. They will still experience the effect it has on the walkmesh without it installed.

Here's the link:
http://nwvault.ign.com/View.php?view=NWN2HakpaksOriginal.Detail&id=27

Here's an additional tutorial on using this that Feargus Urquhart posted in the developer blog:
http://forums.obsidianent.com/index.php?automodule=blog&blogid=2&showent...

As far as I can tell, the tool on the vault contains a flat plane and a ramp, while patch 1.05 adds two flat planes: a stone version and a wooden version (I'm guessing these are for the footfalls.)

Warning: At the time of this writing, putting the walkmesh helper files in your override seem to cause problems with the official walkmesh objects that came out in 1.05. Hopefully OEI will add the ramp objects soon.

For those of you looking to use it for those annoying house placeables that don't allow you to actually walk up the stairs, try the ramp with a scale of 2, 10, and 7. Getting in place can be a bit tricky, just because it is hard to see exactly where it is sitting. Try baking the area and viewing it with baked and surface mesh enabled and you should see a seamless yellow path onto the roof. I had pretty good results with house 1, but house 3 would only work if I created an additional plan on the roof.

 

Creating seamless areas

ScreminMemes and Miserere posted some great advice in the Toolset Q&A thread on the official forums on making seamless exterior areas:

Quote: Posted 10/13/06 02:03 (GMT) by ScreminMemes
The off limits area is there to create the illusion of seamlessness. All you need to to to make your areas seamless is copy one then move it to the side until the last two in-bounds rows from the original area are the first two out of bounds in the next area.

Quote: Posted 10/16/06 17:28 (GMT) by Terror2001
I've been looking for a way to copy sections of a map to create this seamless effect but have yet been unable to. I understand the copying of the map to a new map, but how do you select and move a group of tiles?

Don't try to copy sections of a map. Instead:
(1) Make a copy of the entire area (i.e. copy the area itself, not the terrain and stuff in it). Just select the area in the area list, right-click, and select copy.

(2) Identify the edge you want to carry over (let's say it's the North edge of the original area, so you want to preserve the *North* edge of the new area as well).

(3) Select and delete all objects that do not fall within the 4 tiles along the edge you are preserving (otherwise all those objects will collapse to the new edge when you do the next steps, which will screw up the areas you want to preserve). So in our example we delete all objects that are not within 4 tiles of the *North* edge of the new area.

(4) Use the Resize option (I think it's in the Edit menu, but I don't have the toolset in front of me right now) and reduce the size of the edge *opposite* the one you are preserving until you have only 6 tiles in width, total (4 of which will be off limit areas). The 2 off-limit areas from the other area will now be the walkable areas of the new area. In our example, we would remove most of the tiles on the *South* edge of the new area.

(5) Use the Resize option again to increase the size of the area back to what you want it to be, this time on the other edge. Now you have extended out the walkable area in the other direction and can build it up however you want. So, in our example we would add several tiles to the *North* edge. Et voila.

Think of the process as kind of inch-worming your way from area to area. You move to a new area (by making a copy), contract the area to eliminate the parts you are leaving behind, and then extending again in the direction you are moving. Does that make sense, or do I sound like I'm on crack?

Anyway, hope that helps. I've tried this and it works like a champ. Where this method falls apart is if you try to create four areas arranged in a square pattern, since the fourth area you make will only be able to "inherit" the edge of one of its two adjoining areas, not both. That's where you'd have to do some fudging.
_________________
Miserere
Project Lead (Retired)
Tales of the Pendragon (Defunct)

You can find the conversaion here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=502381&forum=1...

Interiors

Information on interior tilesets.

DLA Tutorial: Interior Area

BenWH over at DLA has posted a great tutorial on creating an interior area in the Toolset forums as a follow-up to his exterior area tutorial:

http://www.dladventures.net/vB/showthread.php?t=5016

Avoiding area corruptions

Most people have had better luck after patch 1.05, but apparently it is still happening. Here is some basic information to help:

Check out the Toolset Corruption thread on the Toolset forum.

Some things you can do

  • Don't just change the variables on objects. Delete the variables and re-create them, or better yet, delete the object, update it the blueprint, and replace it.
  • Don't leave areas open. Save and close, then back it up.
  • Turn autosave off if you are getting this a lot.
  • Run kivinen's check module script. (See the local page for more info)
  • Occasionally back up your areas to .erf files.
  • Remove any haks that could have scripts that are causing problems.

Tracking down the cause

One of the most common corruption problems comes when you don't properly set the variable type on a trigger. As a general rule, set the variable type first.

There seem to be additional problems when working with speak triggers. stg_why and mattaus have posted how to recreate these issues:

  • open an existing area
  • change an attribute of an existing object (or simply add a speaktrigger, although its not 100% of time for everyone causing corruption)
  • save , close toolset

- sgt_why

Some people are advocating turning off the auto save function because of this.

Corrupted backups

There's also an issue where some areas are getting corrupt and are not noticed until further down the development process.

Phil5000 posted some frustrations in the Toolset forum about this:

Hi there. Ever since my mod was corrupted and I lost half of it I've been saving backups regularly. Well it got corrupted again but in a different way. The game wouldn't load the mod but it seemed ok in the toolset. So I opened up every area to check and when I hit one particular one I got a 'program has caused error and must close' message.

So I loaded a backup and checked that same area and I got that same message! I know for a fact the area is ok having played it through several times. So what could have happened?

This time the game would load it though so I went in there to have a look. Everything is black. There's nothing in there at all. I can turn the camera around and access my inventory but the PC isn't there. It's just like a void in space.

The idea that your area could have been corrupt long ago will make any builder nervous.

Chris_Rocks posted a possible back-up strategy about exporting your areas as .erf files. While this may be a bit cumbersome and will require more space, it will definitely give you a good backup that you can easily bring into your module. Remember that there's never such a thing as backing up too much.

jackyo123 posted a comment suggesting that it's always a good idea to shut the area down when you are done building with it:

one thing that is ESSENTIAL to do -

I was in the habit, because of the ridiculous load times of anything to do with the toolset, of simply leaving my large areas open.

I would happily go along, making edits here, edits there, etc. Saving multiple backups, everything looks good.

Then, a night or 2 later, the toolset crashes. Ok, no biggie, i have a hundred backups. I open up the toolset, go to open my big area - NOPE. Gives me a CAST error or something. Ok, go back 1 version. NOPE, same thing. Go back 10 versions. Nope, same thing.

What was happening is that the area i had open the whole time had become corrupted, but i had not known about it, since it was open already in the toolset, and i didnt try to reload it.

So I no longer do this. I close down an area as soon as i am done working on it, then re-open it to verify its ok. THEN i close it again and move on to my next piece of work.

He also offeres some additional backup strategies:

Also, you need to be making backup copies of the DIRECTORY (usually has a temp^&^E%^%^%&&$modname associated witn it) by manually copying this directory to a safe place every once in a while. I copy the directory every 3 or 4 mod saves. I can often pull scripts, blueprints, etc out of there, and merge them with the last known 'good' copy of an area before it got trashed, and everything is ok.

Thanks to these fine people for their thoughts.

It may also be helpful to check out my stragety for versioning your modules when working with a campaign.

Kivinen: module debug tools

Kivinen has some great tools for working the the toolset on his site here:

http://www.kivinen.iki.fi/nwn/

check-module

One of the best tools for debuging your module is his check module tool, which can be downloaded here:

http://www.kivinen.iki.fi/nwn/exe/check-module.exe

You can find the documentation here:

http://www.kivinen.iki.fi/nwn/docs/check-module.html

Some have suggested you will actually need to save the module out to a directory.

update-ifo

After you find errors, you can try fixing them with his update-ifo tool:

http://www.kivinen.iki.fi/nwn/exe/update-ifo.exe

Here's the documentation:

http://www.kivinen.iki.fi/nwn/docs/update-ifo.html

He also has perl versions of everything, if you want more up to date options, but I've included the exe files since that's what most people will probably be grabbing.

Blueprints and Objects

This section deals with blueprints and objects (creatures, items, placeables, etc)

Creatures

This section deals with creatures.

Companions

Gnorian asked for help making companions in this thread and Dorateen came up with the following reply:

Credit to Celestian the Good:

Making a companion, step by step.

First create your companion NPC. I made a fighter/wizardlevel 1/1 and called him Melf the Elf. His Tagname is "melf" and his resref/template was gh_henchman_melf01.

Load up this new NPCs properties and select import properties->script set and load up "c_CompanionScripts.xml". If you do not have this file you can create it by loading the properties of one of the official campaings companions and selecting export properties->script set and save as "c_CompanionScripts.xml".

Next create a conversation.

Right click the root section, select add and for the text just say "Would you like a new companion"?
right click the line you just created and click add and for the text use "Yes, please join my group.".

Now, find and click the "Actions" tab below and add the following global action scripts:

ga_roster_add_object
ga_roster_selectable
ga_roster_party_add
ga_reset_level

Once you have all the scripts added and in the order above click "refresh" for each script to see the variable options. Once you see those enter in the following values:

ga_roster_add_object sRosterName:melf sTarget:melf
ga_roster_selectable sRosterName:melf bSelectable:1
ga_roster_party_add sRosterName:melf
ga_reset_level sCreature:melf bUseXPMods:1

Replace "melf" with whatever tag you used for your companion.

Save the conversation and then add it to your new companions conversation (under properties).

Place the NPC somewhere in your module and go talk to him. Hit the "yes" response and he should be your new best friend!

Further down, ByblosHex adds this advice:

Note that the NPC's tag must be 10 or less characters for these scripts.

Continue further in the thread for a discussion about how to structure companion conversations. I'll try to pull all of these elements together in a more coherent form at some point.

Check out the full thread:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=537485&forum=1...

NWN2Toolset: Companions

NWN2Toolset has released a short and sweet tutorial on creating companions.

Check it out:
http://www.nwn2toolset.dayjo.org/ToolsetTuts/merchants/companion.html

NWN2 Toolset: Creatures

NWNmaster over at nwn2toolset.com has a great set of tutorials for working with creatures and encounters. His current list of topics include: Create an NPC Adjust Creatures Inventory How to setup Generic Encounters How to setup Custom Encounters Head on over and check it out:

http://www.nwn2toolset.dayjo.org/ToolsetTuts/blueprints/creatures/creatures.html

 

Persistent Zombie

This is a quick to tutorial I posted to the Vault while exploring creatures and scripting in the toolset. It will show you how to:

  • Create a custom creature
  • Create custom items
  • Change properties on creatures and items
  • Edit a script for a creature.

Specifically we will create a new zombie that has the properties of a troll. Our zombie will regenerate and can only be killed by fire or acid, but we'll make a few adjustments to the script.

You can view it from the vault here:
http://nwvault.ign.com/View.php?view=NWN2Tutorials.Detail&id=37

Why is everyone injured?

Patch 1.04 is apparently responsible for making all the NPCs standing around the module injured. It has something to do with current hit points versus max hit points. Here's a thread talking about it:

http://nwn2forums.bioware.com/forums/viewtopic.html?topic=561730&forum=1...

Reports suggest that this only affects previously created module. New modules don't seem to suffer from this bug.

A suggested fix was to manually look at the characters' current and max hit points in the Toolset.

Placeables

Information on placeables.

Containers

Don't forget that containers (chests, dressers, long dead corpses to loot, etc.) should have the following flag set under the behavior section of the properties window:

Has Inventory?: TRUE
Static: FALSE
Useable?: TRUE

If you want dynamic treasure, make sure you define a treasure script for the On Death and On Open events. One option, gp_treasure_op_de, is documented here: http://www.wendersnaven.com/node/65

Leaving the faction to hostile will allow players to bash the object without any real repercussions. In NWN1, setting the faction to a neutral faction would cause any nearby members of that faction to attack the PC if certain events were triggered. If I recall, these were On Death and On Disturbed. I'm unsure what events trigger reactions in NWN2, but they are probably the same.

Converting to Environmental

Converting placeables to environmental objects reduces the size of areas. I think it also increases performance for players. Environmental objects do not cut into the walkmesh, meaning that players will be able to walk right through them. Sometimes this is not an issue, such as when they are out of the walkmesh anyway, but otherwise you will want to use the walkmesh cutter trigger to keep players from walking through your objects.

Caution converting Environmental to Placeables

johnbgardner posted this warning to other builders in the official forums:

I just noticed that when you convert an environmental object back to placeable the Current Hit Points, Hardness, and Hit Points are left at 0. Believe it or not this makes the placeable unuseable regardless of the Useable setting. It was driving me crazy that one placeable could be used while another with identical properties (except for the above which I had ignored) wouldn't. Setting those properties back to the default values made the object useable again. Wierd.

See the thread here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=535748&forum=1...

Lights

I opened one of the OC areas to see what settings they defined for realistic firelight (torches, candles, fireplaces, etc). Based on that, these are the settings I am using for basic light sources:

Behavior

  • Lerp: False
  • Flicker: TRUE
  • Flicker Variance: 0.05
  • Flicker Rate: 18
  • Flicker Type: Jumpy

Shadows

  • Cast shadow?: True
  • Shadow Intensity: Between 0.3 and 0.6 depending on how it looks.

You may also want to nudge the colors just a bit towards red and orange. Not to the point of being overpowering, but just enough that it's not plain white and gives a subtle red/orange undertone.

nwn2toolset: lighting tutorial

Nwn2toolset posted this great tutorial on using lights by Geethree. It covers shadows, lerp and some other great items that you might have missed on your first pass through the lighting options.

Check it out here:
http://www.nwn2toolset.dayjo.org/ToolsetTuts/blueprints/lights/light.htm...

Variables

You can set variables on blueprints and objects by clicking on the "..." icon in the "Variables" field under the "Scripts" section of the Properties window. Choose the variable type that you will use (string, integer, etc) and place the value in the appropriate field.

This allows you to set flags that scripts can read. This is how switches work.

There have been some reports that setting a value without setting the type will result in a corrupted module. Hopefully this will be fixed soon, but in the meantime, make doubly sure you set the type when assigning variables.

Conversations

Information about conversations.

Tutorials

There are a lot of good tutorials out there on basic conversation creation. Here are just a few that I've found useful that deal explicitly with tutorials.

Also be sure to check out the conversation sections in the more general tutorials listed in the Getting Started section of this site.

Machinations: Conversation Tutorial

BetterThanLife over at Machinations.org has posted a tutorial on conversations. This tutorial teaches you how to implement conversations, and then goes into some of the more advanced details of creating different types of dialog conversations. The included module, gives three distinctly different examples. An explanation of the use of 'static cameras' is also given and shows how they aren't as 'static' as many think.

Download the zip file with a pdf and example module here: http://www.machinations.org/NeverwinterNights2/ConversationTutorial.zip

(Thanks to Usheen for pointing out the new, working link.)  

NWN2Toolset: Conversation Tutorial

NWN2 Toolset has a great section on conversations.

You can find it here:
http://www.nwn2toolset.dayjo.org/ToolsetTuts/conversations.html

Cutscenes

Cutscenes in NWN2 generally happen through a combination of conversations, conversation switches, and camera control. I'll try to expand this more later, but here is a general procedure:

  1. Create your area, creatures, effects, etc.
  2. Create your conversation. Check with the other guides and tutorials listed on this site for more information about how to create a conversation. The one key thing to remember is that every conversation node is basically a camera shot.
  3. Set up your OnClientEnter cutscene script for the area, remembering to attach it to the area. You can make the speaker either the main NPC who will be doing the talking, or create an Ipoint to act as the speaker.
  4. Next place your static cameras. Check out this page on camera control for more information.
  5. Finally, bring it all together with a conversation switch script that you can reference on each node to control the action.

Cutscenes, multiplayer and OnClientEnter

Kid Gloves asked a great question on the official forums about cutscenes and multiplayer. Nimdolf gave this answer:

Well after playing the OC with my friend online, it works like this. Whoever triggers the cutscene gets to control it, pick what to say, etc. and all of the other players see the cutscene also and what choices you choose. If you join the game midway through a cutscene however you must wait until it is over to do anything.

Check out the thread:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=521668&forum=1...

jackyo123: Cutscene Tutorial

jackyo123 posted a cutscene tutorial here:
http://nwvault.ign.com/View.php?view=NWN2Tutorials.Detail&id=65

This tutorial document (in rtf format, for those who hate MS-Word) and associated .MOD file walk a basic toolset user through their first cutscene, with animations, movement, etc.

It explains:

- Triggering cutscenes
- Setting up cutscenes that the Player isn't part of (NPC to NPC)
- Camera controls
- Animations
- Basic use of included scripts
- Some snags that you can avoid, that are associated with Cutscene creation

There is *no* scripting in this tutorial, and no scripting knowledge is required. But you should have a basic familiarity with the Toolset.

 

nwn2toolset: How to make cutscenes

NWN2 Toolset has this tutorial, which might help those trying to figure out cutscenes: How to make cut scenes by Montgomery Markland of Rogue Dao Studios.

An overview of setting up a cinematic-style cutscene conversation

What you will need:

1) A conversation
2) A blocking script
3) A way to begin your cutscene (either a speak trigger, an on_client_enter script or something else)
4) Plus the area, npcs etc., etc., etc.

Check it out here:
http://www.nwn2toolset.dayjo.org/ToolsetTuts/blueprints/staticcams/cutscenes.html

FRW: Conversation Tips by David Gaider

Some time ago, Papermonk posted some tips about conversations from David Gaider. I recently ran across it and thought it might be good to revisit. Here's a quote from his intro:

I assume most of you know who that is - if not, he's one of the big design boys at Bioware and had his hand in BG2 a LOT, among other things.

Mr. Gaider joined CODI briefly (before being pulled back to insane grinds at BW) but before he left he really helped us figure a few things out.

Rylock's Conversation Tips

1) If you have a large character to write, TEMP dialogue is your friend.

Don't worry about getting caught up in the details right at the beginning. You'll get bogged down with how something is said rather than just getting the structure together... which is important when the NPC has a lot to say. Write a single line that covers each starting condition ("This is what I say when you first meet me!") and then write really quick lines afterwards that cover only the basics of what you're trying to get across. You can go back afterwards and flesh the lines out and add "flavour" routes in the dialogue later.

2) Write comments.

Even if you're doing the scripting yourself, write comments... write comments whenever scripting is needed, either for a starting condition, somebody's supposed to perform an action, a variable should get set here and so forth. You will thank yourself later.

3) Don't repeat yourself unless you have to.

Too many times we get newbie writers here who will have dialogue where the same information comes up numerous times... and they'll write that information up each separate time. A little differently, to be sure, but it's the same info.

Don't do this to yourself. And don't delude yourself into thinking this makes better dialogue. Always recycle whatever you've already written if it's at all possible. One of the most common ways this is done:

"You want to ask me something, you go right ahead."
1 - PC question #1.
2 - PC question #2.
3 - PC question #3.
4 - I don't have any more questions.

After each question is answered, you loop back to the first line (the "You want to ask me..." or even a new line like "You want to know something else?" that has the same response links). Only when the PC is done with his questions and picks #4 will you then go back to the rest of the information the NPC has.

Recycling sub-menus like this will make your structure much, much simpler to understand (especially for you) than trying to have each separate question flow into everything else the NPC might have to say or do. If you do that, I guarantee you will run into situations where the player wanted to ask something else but the question is no longer available to him.

4) Don't use more Starting Conditions than you have to.

Now, this can be taken in one of two ways. While it can be good writing to have multiple starting conditions when the NPC is clicked on (he says something different based on updated circumstances and so forth), a good rule of thumb would be to include everything that the character needs in a single sub-menu as often as possible.

What do I mean? Another example:

"Greetings once again, <FirstName>. Missed something the last time we spoke, didja?"
1 - Do you know your way around this area?
2 - You mentioned that you lived in the building next door...
3 - I was told the building next door is brand new. Are you lying to me?
4 - You come to this bar often?
5 - What do you know about the other patrons here?
6 - So what's there to do for kicks around here?
7 - Want to play some cards, old-timer?
8 - I got that money that Traul owed you.
9 - I should go.

Now... obviously the player's not going to see all of these PC responses at the same time. You can look at that list and see clearly that some of these responses require some foreknowledge that the PC may or may not have. So you add Starting Condition scripts to them all.

1 - No script. It's always available. During the answer the NPC mentioned he lived in the building next door... set a variable on the PC to indicate that info is known.
2 - Only shows if the variable mentioned in #1 has been set.
3 - Only shows if the variable mentioned in #1 has been set AND another variable indicating the PC has spoken to someone else about the new building is also set.
4 - In this one the NPC will mention that yes, he has been coming here a while. Set another variable on the PC. #4 no longer shows once that variable has been set.
5 - Only shows if the variable mentioned in #4 has been set (or if you figure it's a generic enough question, scratch the variable and both 4 and 5 can always show). In the dialogue resulting from this, the NPC could mention that Traul owes him money and he hasn't been able to collect... whether or not the PC agrees to get the money, set a variable on him (he should at least know about it and be able to ask Traul).
6 - In this one the NPC mentions he likes to play cards and challenges the PC to a game. Set another variable on the PC. #6 no longer shows when this is set.
7 - Only shows when the variable in #6 is set. Goes directly to a game of cards.
8 - Only shows if the PC was able to collect money from Traul (after the variable was set in #5).
9 - Always shows.

...and so on. The benefit for doing all this? At the end of every section of dialogue for the NPC (and keep in mind each of these could go into its own sub-menu with separate questions and routes) you do not have to sit around and weigh exactly which PC responses apply in that situation. Link to them ALL and the dialogue will both sort itself out and flow naturally... and save you a lot of time.

5) Make sure the goods are readily available.

What do I mean by that? Simple... don't bury a good piece of writing somewhere where nobody will ever find it. Unless you intend for something to be an Easter Egg, don't give your NPC's specialized dialogue that will only show up once in a blue moon. If you want to add it later, then fine... but finish the damn thing first or you never will.

6) You can always add more later.

Yes, we are all perfectionists. We want the dialogue to include everything possible the very first time through. Well, suck it up, sister, because that isn't going to happen. Don't over-plan the dialogue... get in what you need, first, and add more stuff in later. And keep in mind not every NPC needs to know or tell everything imagineable.

Here are two additional points by Sethai:

7) Limit your text.

I don't know how it will work in nwn2, but in nwn it is best to limit your text to about 2.5 lines, so each section of dialogue never comes past the npc's portrait. Overflow into another node if need be. Huge blocks of text just look unproffessional and discourage the player from reading them. I try to follow the OC conventions, because it makes the game more immersive when you're not distracted by the little things.

8) Most obvious responses first

When, ordering your responses, try and put the most expected, non consequential response first (stuff like "continue" or "could I ask some questions?"); you don't want people to be 1ing through, and accidentally attack the quest giver. Put your "Goodbye" option at the bottom of the list so people know where to find it.

Here's the original post on the FRW forums:
http://nwcitadel.com/forums/showthread.php?t=227

 

Multiplayer and NWN1 vs NWN2 style

sgt_why asked a great question about writing conversations that are multiplayer friendly. Check it out for yourself here:

http://nwcitadel.forgottenrealmsweave.org/showthread.php?t=1175

A decent amount of this comes down to the options on a conversation. Open a conversation and check the options window and you'll see several items of interest. The mains ones here are Multiplayer Cutscene and NWN1 style.

Here is a response that I wrote up for that thread and decided to repost here: 

The multi-player flag got a bad wrap because it was over used in the OC. If you don't have it set to multi-player, you should have it set to use the NWN1 style of conversation. A good rule of thumb seems to be:

  • If it's a cut scene where you want everyone to stay in place because people are moving around and there's a lot of scripting (or just because it's an important plot point and you want everyone to pay attention), use NWN2 style and make it a multi-player conversation.
  • If it's a standard dialog where you don't have scripting and don't need to "pause the game", leave multi-player set to false and use the NWN1 style.

Here is a good description by Nimdolf a while back on how multiplayer works in the OC:

"Well after playing the OC with my friend online, it works like this. Whoever triggers the cutscene gets to control it, pick what to say, etc. and all of the other players see the cutscene also and what choices you choose. If you join the game midway through a cutscene however you must wait until it is over to do anything."

Again, that is with the options set to NWN2 style and multi-player. If you don't have multi-player set to TRUE, they are not involved, but I think they are stuck in limbo. If you have the style set to NWN1 and multi-player set to FALSE, players can run around and talk to whomever they want.

Another point is to watch your conversation triggers. All too often you end up with rogues and rangers doing the talking because they are scouting ahead and there is no way to "hand off" the conversation. Usually this is fine. In important conversations where a party might elect a different PC to do the talking, however, let them start it on their terms and you'll take care of a lot of this.

 

The Journal

Here are some things to note about the journal:

1. If you are using campaign, you have to use a campaign journal. The module-level journal will not work.

2. You can either update the journal using the script ga_journal, or you can use the "Quest" field on the "Node" tab to browse and find your journal entry.

3. The players will not automatically get the XP defined in the Journal when they hit an endpoint. You have to manually award the XP by attaching the script ga_give_quest_xp to that dialog node.

 

Camera Control

Tips and tricks for controlling the camera during conversations.

Here is BetterThanLife's section on the camera from his tutorial on machinations.org:

Static cameras are basically cameras that you can place directly into the game
world and position like any other object. If you press the ‘Preview’ tab next to the
properties tab, you will get a rendering of what the camera is seeing, then you
can move it around to carefully position much like a director. You then use static
cameras by attaching them to lines in conversation dialog through the use of the
Node tab as explained in the previous section. You need to give your static
camera a tag name and then link it to the Node. From there you have the ability
to make the camera stationary (default), pan or track. While a static camera
might sound like it doesn’t move, if you use pan or track, it will either always face
the target (pan) or move along with the target (follow). Obviously in order for this
to have any use, the target would need to be moving. This is where the Action
tab comes into play. You might have a script that makes the actors walk as they
are talking, and have static cameras positioned about, following their movement,
so as to create a cut scene. (The camera’s target will be whoever the speaker of
the dialog line is). You can even choose the shot angle of the static cameras,
though I haven’t experimented with it, the names should be obvious as to what
they will do.

You may also want to check out this page concerning the conversation switch script template and how it works with camera control.

Static Camera Orientation

UPDATE: Patch 1.07 and MotB changed the way you interact with the camera. Now you just hold down the right mouse button and you can control both turn the camera and control the pitch. 

Kephisto posted a great set of instructions in the Toolset forum concerning the camera:

Holding down the control and shift keys then right dragging should roll the camera while holding down alt and shift with right clicking will pitch the static camera up and down.

You can rotate it towards the left and right like other objects as well. To raise and lower it hold down the alt button while moving them. All together you can put it in just about any position and angle you want.

If there are any problems it could be, just guessing, that your keyboard shift and alt and control keys may have a different configuration, but in general play around with those three keys when the static camera is selected and you'll discover a feel for it.

In case you may be wondering, I've already placed many static cameras behind NPCs, across treetops and roofs, angled upwards from the ground, and even upside down viewing a monster.

When you're ready to have even more fun, Inder, right click on the static camera and select properties in new window - which, believe it or not, will bring up another properties window of which you can select view and actually see exactly what the camera does, in real time.

From there it is a matter of selecting a line of a conversation and selecting that static camera. Overall, I hope you enjoy using them.

And further down:

Each line in a conversation, whether spoken by the player or the NPC, has its own properties. For example, please highlight any line in a conversation and look at the bottom left, which should have the four tabs : Conditions, Actions, Node, Animations.

While you have a line in your conversation highlighted (selected) please click on the bottom tab named Node. In the Node panel that comes up in the bottom left should be a wondrous amount of options, divided into three main categories : Behavior, Camera Settings, and Line. Click the left (plus) sign of the Camera Settings category.

Now you should see many options for the Camera Settings, for that one specific line of conversation alone. You are now able to set if you want the camera settings to be random or want the Movement Type to be None, Pan, or Track, or even if you want that line of conversation to use any of your Static Cameras or even if you want the visual shot to be a Close Up, Walk-by, Medium, Over the Shoulder, or even more.

Even without using a static camera, just about all the above options (and more) are still available. So if you want to have a specific part of a conversation have a certain look to it, you can merely select a specific option and leave it at that.

When using Static Cameras all that is needed is to place the desired static camera’s tag in the Static Camera field, which is listed in the Camera Settings of the Node panel. There is probably a better way to say all this but I hope at least this information helps.

And a follow-up by LysanderReturns:

Perfect summation Kephisto. Just to add one last step, you need to set the mode field on the node to "static camera" if you want to use a static cam or "user defined" if you want to choose one of the preset cams (like worms eye or walk by or whatnot).

Check it out: http://nwn2forums.bioware.com/forums/viewtopic.html?topic=514512&forum=1...

The invisible cameraman

You can use an invisible cameraman to control where the camera is facing and make the static cameras pan and track to follow the action.

Creating your cameraman

First create your invisible cameraman. Go to blueprints > creatures > special to find the "Attach Spell Node" creature. Place him in the area and give him the following attributes:

  1. First create your invisible cameraman. Go to blueprints > creatures > special to find the "Attach Spell Node" creature. Right click and choose "Copy Blueprint" > "Module" to create a module level blueprint.
  2. Change the new creature blueprint's identification fields to "c_cameraman." The full list would be:
    • Comment: {c_cameraman}
    • Template Resref: c_cameraman
    • Resource Name: c_cameraman
    • Localized Description: leave blank
    • Tag: c_cameraman
    • First Name: {c_cameraman}
  3. Make the creature a plot element by changing "Plot" to "True." This is just in case he gets stuck in a fireball or something, so that he won't start attacking the party.
  4. Place the creature in the area. (You can also spawn him in later via a script using CreateObject(). This would also allow you to change his tag.)
  5. Give the placed creature object a unique tag. If you are following campaign naming conventions, this might be in the form of "c_" + area_id + "_cameraman". If you have serveral cameramen in one place, consider using and "A," "B," or "C" at the end.
  6. Consider giving the placed creature object a name in brackets so you can easily find him in the toolset. You may want to use the tag as the localize name so it is easy to locate him in the creature list.

Using your cameraman in a conversation

Now you can select the cameraman via GetObjectByTag() in a conversation switch. This will allow you to move him around using AssignCommand() calls.

Place a static camera in the area and give it a unique tag. To get the camera to follow him we will use the Node tab on the conversation nodes. To do this open your conversation and go to the node you want perform a moving camera effect on. Follow these steps:

  1. Under the camera settings expandable field, click in the "StaticCamera" field to get a dropdown. Use this to find your camera and choose it. You can also just paste in the tag for your camera.
  2. Set the "Mode" field to "Static Camera"
  3. Go down under the "Line" section and set the speaker to be the tag of your cameraman. Note that this is the tag of your placed creature object, not your blueprint.
  4. Finally, go back up under the "StaticCamera" section and we will set the "MovementType." There are three types to choose from.
    • None - The camera will not focus on the speaker for the duration of the conversation node, but will alsi not move. Good to use if you want an establishing shot that doesn't focus on the speaker.
    • Pan - The camera will swivel left or right to follow the speaker. It will also pitch up and down. This is a nice way to follow the action from a static point. You should note, however, that the camera will level out to the horizon when you choose this, meaning that any custom orientation you gave the camera when you placed it (such as having the camera on an angle) will be lost.
    • Track - The camera will change position to follow the creature. Custom orientations seem to be kept with this option, but I have not played with this one as much. I'll follow up once I have more information.

References

Thanks to Deist who suggested the use of the Attach Spell Node creature. Originally I was trying to use the ScriptHidden flag, but found that the camera does not follow the creature if this is on.

Check out the full thread:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=535548&forum=1...

Panning the camera to the sky

Here's a threat talking about how to pan the camera up towards the sky:

http://nwn2forums.bioware.com/forums/viewtopic.html?topic=535097&forum=1...

Scripting

Jassper posted a great list of resourced for those looking to get more familiar with scripting: Noobs Corner is laid out to help the newbe scripter. Also, here are some links from nwn1 scripting/toolset which can relate to nwn2:

Check out the full thread where he posted these:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=521085&forum=1...

Thanks also to Grumpy Badger who recently let me know about this stickied thread on the NWN2 forums:
Helpful Scripts - http://nwn2forums.bioware.com/forums/viewtopic.html?topic=573084&forum=1...

 

Variable scope

KublaKhan1797 asked a question about variable scope on the official boards, and ScarfaceDM gave a nice summary:

A standard variable defined outside (and above) any function or void main will be global within that script, a standard variable defined within a function or void main will not be global within that script, it will be usable within the function or void main that it was defined in.

A local variable is stored on an object and is retrievable from any script as long as it exists, they are not persistent unless stored on items in a PCs inventory and then the PCs character exported.

A global variable is not persistent in any way, it is simply 'global', it is not stored on any object thus making it retrievable via its sVarName and not from an object.

A campaign variable is stored in the database folder in your NWN2 directory and also not on any object, and is persistent and retrievable from any script as long as it exists.

The thread is here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=539873&forum=1...

Campaign variables

These get get saved to the Bioware Database, which is included in NWN2. They can be accessed via the SetCampaign* and GetCampaign* functions. This is a physical write to the hard drive, and can bog down servers if there are a lot of requests happening at once.

It is worth noting that variable names cannot be longer than 32 characters, or the setting of the variable will fail.

A good system for managing campaign variables is Knat's NBDE.

Globals

Globals get saved to a globals.xml file that gets placed in your save game directory when you save the game. You can set and get global variables with the SetGlobal* and GetGlobal* functions.

These variables exist at a level similar to the campaign folder, meaning they exist in the context of a saved game and can cross from one module to another. They are not physically written to the xml file until a save happens, however.

A good way to check that your variables are getting saved correctly is to save the game an open the file.

One important thing to note is that global variable names can have spaces, but they cannot be more than 32 characters long.

Add From Template

Here are the script templates you can add by right clicking in the Scripts window and choosing "Add From Template." I found it nice to have them available outside of the Toolset for ease of reference.

I'll be adding the rest later.

Conversation Switch

Use this template when you are creating a script that will control actions during a conversation. Pass the variable nAction from the conversation to tell the script which case you want to perform. For instance, pass 100 as the nAction argument to execute the code for case 100.

If you need more information on what a case statement is, see the Wikipedia entry on case statements.

A common way to control the action in conversation switches is with ActionPauseCutscene() and AssignCutsceneActionToObject(). A cut scene action is an action that has a special flag that tells the pause function to resume once the action has been complete. An example from the OC would is:

ActionPauseCutscene(1000, FALSE);
AssignCutsceneActionToObject(oRegulator, ActionWait(1.0f));

This example uses a regulator because the example it comes from (a romance script in module 3500) needed to keep both speakers available for other actions. For best results, a regulator is an Ipoint speaker, which can be found under Blueprints > Placeables > Misc Props. I found that removing the heartbeat from the Ipoint and also using it as the speaker is a good way to make sure that you don't run into conflicting action assignments.

Once you have the pauses set and you static cameras place on your converations nodes, you can add custom functions in the case that will control the movement of other characters. For instance, in the following example you can see that there are a number of custom functions that are included in the file that get referenced.

		case 6:
			ActionPauseCutscene(15000, FALSE);
			AssignCutsceneActionToObject(oRegulator, ActionWait(15.0f));
			MoveCameraman1Again();
			PlayRomanceStinger();
			MovePC();
			DelayCommand(11.0f, FadeOut());
			break;	

and further down:

void MoveCameraman1Again()
{
	object oCameraman = GetTarget("3501_cameraman1");
	object oWP = GetTarget("3501_wp_camerman2");
	
	AssignCommand(oCameraman, ClearAllActions(TRUE));
	DelayCommand(1.0f, AssignCommand(oCameraman, ActionForceMoveToObject(oWP, FALSE)));
}

Note that I usually use GetNearestObjectByTag instead of GetTarget, but that's just because I'm not sure what GetTarget really does.

Obviously you can go pretty crazy with this. Here is the base code from the template for reference:

// 
/*
    master script for conversation X
*/
// 

#include "ginc_actions"


void main(int nAction)
{
    object oPC = GetPCSpeaker();

    switch ( nAction )
    {

        case 100:	//
			break;

        case 200:	//
			break;

        case 300:	//
			break;

        case 400:	//
			break;

        case 500:	//
			break;
    }

}

Area OnClientEnter Cutscene

The onClientEnter cut scene script is a great way to start a cut scene conversation. Create either an Ipoint with a new tag or use a creature as the main speaker. Also create a conversation. Then plug these two into number three (below).

The condition to play and the additional cutscene scripting are great places to use variables, either on the module or campaign level, to control whether the cut scene should fire. For instance, if you set a quest tracking variable called "sidequest2" to be 10 when the party got the quest, and you wanted to test for condition sidequest2 == 10, you'd place that in step two below. Then in the additional cut scene scripting you'd update the quest tracking variable to 20 so that the game knew not to play this cutscene again.

// Area OnClientEnter Cutscene.nss
/*
	Area OnClientEnter event handler template. Setup cutscene(s) to fire when the party enters a new area.
	This script will execute after a group area transition using JumpPartyToArea().
	bCutsceneCondition will determine if a cutscene should play, but each cutscene is restricted to play only once.
	
	HOW TO SETUP A CUTSCENE:
		0. Copy and paste script block into "CLIENT ENTER CUTSCENES"
		1. Specify a title for your cutscene
		2. Replace (FALSE) with condition to play cutscene
		3. Specify Speaker and Dialog of conversation
		4. Add additional cutscene scripting
	
		// Cutscene: 1. Example Title
		if (GetIsCutscenePending(stCI) == FALSE)
		{
			bCutsceneCondition = (FALSE);	// 2. Replace (FALSE) with condition to play
			sSpeakerTag = "";				// 3. Specify Speaker and Dialog
			sDialogName = "";

			stCI = SetupCutsceneInfo(stCI, sSpeakerTag, oPC, sDialogName, bCutsceneCondition);	

			if (GetIsCutscenePending(stCI) == TRUE)	
			{
				// 4. Additional cutscene setup
			}
		}
*/
// BMA-OEI 2/3/06
// BMA-OEI 2/7/06 added speaker == PC check
// ChazM 2/7/06 modified implementation
// ChazM 2/7/06 moved funcs to ginc_cutscene
// BMA-OEI 2/7/06 support multiple cutscenes
// BMA-OEI 2/7/06 revert original controlled char
// BMA-OEI 2/8/06 added comments, Group Area Transition restriction

#include "ginc_cutscene"

int StartingConditional()
{
	// Do not execute if OnClientEnter was not fired from a group area transition
	if (FiredFromPartyTransition() == FALSE) return (FALSE);

	// Get party leader, force control of owned PC
	object oPC = GetFirstEnteringPC();
	object oLeader = GetFactionLeader(oPC);
	oPC = SetOwnersControlledCompanion(oLeader);

	// Initialize temp CutsceneInfo
	struct CutsceneInfo stCI;
	stCI = ResetCutsceneInfo(stCI);
	int bCutsceneCondition;
	string sSpeakerTag;
	string sDialogName;

	// *** START CLIENT ENTER CUTSCENES ***

		// Cutscene: 1. Example Title
		if (GetIsCutscenePending(stCI) == FALSE)
		{
			bCutsceneCondition = (FALSE);	// 2. Replace (FALSE) with condition to play
			sSpeakerTag = "";				// 3. Specify Speaker and Dialog
			sDialogName = "";
	
			stCI = SetupCutsceneInfo(stCI, sSpeakerTag, oPC, sDialogName, bCutsceneCondition);	
	
			if (GetIsCutscenePending(stCI) == TRUE)	
			{
				// 4. Additional cutscene setup
			}
		}
	
	// *** END CLIENT ENTER CUTSCENES ***

	// Cue cutscene or revert control to original character
	if (GetIsCutscenePending(stCI) == TRUE)
	{	
		FireAndForgetConversation(stCI.oSpeaker, oPC, stCI.sDialog);
	}	
	else
	{
		SetOwnersControlledCompanion(oPC, oLeader);
	}

	// If cutscene is pending, fade to black
	return GetIsCutscenePending(stCI);
}

Common Tasks

Here are some common scripting tasks.

Ambient Animations

A good place to start with general animations is the switches page here:

http://wendersnaven.com/node/43

The short answer is that you can set the following variables on a creature:

Ambient Animations
X2_L_SPAWN_USE_AMBIENT = 1

Immobile Animations
X2_L_SPAWN_USE_AMBIENT_IMMOBILE

With no waypoints, "X2_L_SPAWN_USE_AMBIENT" includes the familiar wandering around near their spawn point and doing some basic interactions with other NPCs. "X2_L_SPAWN_USE_AMBIENT_IMMOBILE" causes them to do the same interactions (waving, force talking, etc.), but they stay in one place. They will turn to face other NPCs, however.

There are a few waypoints that cause additional behaviors. From x0_i0_amins:

Creatures will move randomly between objects in their
area that have the tag "NW_STOP". (I think there is a % chance of them doing this or the standard wander around.)

UPDATE:  After some testing, it appears the behavior in the next two paragraphs does not work. Generally speaking, waypoints across areas don't work at all in NWN2. They tended to be inconsistent in NWN1, also. Begin incorrect documentation:

 Creatures who are spawned in an area with the "NW_HOME" tag
will mark that area as their home, leave during the day,
and return at night.

Creatures who are spawned in an outdoor area (for instance,
in city streets) will go inside areas that have one of the
interior waypoints (NW_TAVERN, NW_SHOP), if those areas
are connected by an unlocked door. They will come back out
as well.

End incorrect documentation. 

There is a good conversation about ambient animations scripts happening here:

http://nwcitadel.forgottenrealmsweave.org/showthread.php?t=1184

Death and Respawn

There are a number of options out there for dealing with death, but when dealing with respawn, there is one very important thing to know:

The death and respawn event scripts never on Respawn fire when you use the GUI_DEFAULT_DEATH_SCREEN with DisplayGuiScreen. This is the call for nwn_o0_death, the default script for death events.

Both nwn_o0_death and nwn_o0_respawn contain respawn code, but the gui actually uses a callback script named gui_death_respawn. Opening this file through the File > Open script/conversation menu, you'll see that the default death script is:

// gui_death_respawn.nss
/*
Death GUI 'Respawn' callback: wake up groggy
*/
// BMA-OEI 6/29/06


#include "ginc_death"


void main()
{
// Resurrect PC
object oPC = OBJECT_SELF;
WakeUpCreature( oPC );
RemoveDeathScreens( oPC );

// Apply Groggy penalty
effect eGroggy = EffectDazed();
//eGroggy = EffectLinkEffects( EffectSlow(), eGroggy );
ApplyEffectToObject( DURATION_TYPE_TEMPORARY, eGroggy, oPC, RoundsToSeconds( 2 ) );
}

This results in the character standing up right where the died. Generally, it is better to send them to a safe place, such as a standard waypoint with the tag "NW_DEATH_TEMPLE".

For example, here is how Lordniah did his respawn callback script in the FRW base module.

// gui_death_respawn.nss
/*
Death GUI 'Respawn' callback: wake up groggy
*/
// BMA-OEI 6/29/06


#include "ginc_death"


void main()
{
// Resurrect PC
object oPC = OBJECT_SELF;
WakeUpCreature( oPC );
RemoveDeathScreens( oPC );

// Apply Groggy penalty
effect eGroggy = EffectDazed();
//eGroggy = EffectLinkEffects( EffectSlow(), eGroggy );
ApplyEffectToObject( DURATION_TYPE_TEMPORARY, eGroggy, oPC, RoundsToSeconds( 2 ) );


//Jump respawner to temple waypoint if it exists
object oTemple = GetObjectByTag("NW_DEATH_TEMPLE");

if(GetIsObjectValid(oTemple))
{
ClearAllActions(TRUE);
ActionJumpToLocation(GetLocation(oTemple));

}

}

Thanks to Lordniah for putting that comment in his k_module_respawn script that it never fires. Hopefully this info will help someone else out there.

GetGoldPieceValue()

Thanks to cdaulepp and loudent2 for pointing this one out:

When you are using GetGoldPieceValue() on an item to get the value, if the item is not identified the function will return 1.

See the full post here:

GetGoldPieceValue() Does it work correctly?

 

Lugoun's Find and replace a word in a string

Lugoun posted this handy script in the Helpful Scripts thread in the official forums. It allows you to do a find and replace on a string. Just pass in the text you want to perform the find and replace on, the string to find and the string you want to replace it with. His script is below and I've added comments.

// Returns a string based on sStartString where sCurrentWord is replaced by sNewWord 
string FindReplaceSubString(string sStartString, string sCurrentWord, string sNewWord)
{
int nLength = GetStringLength(sStartString);
int nCurrSubLoc = FindSubString(sStartString, sCurrentWord);
string sLeftSide = GetStringLeft(sStartString, nCurrSubLoc);
int nCurrentLength = GetStringLength(sCurrentWord);
int nLeftSideLength = nCurrSubLoc + nCurrentLength;
int nRightSideLength = nLength - nLeftSideLength;
string sRightSide = GetStringRight(sStartString, nRightSideLength);
string sNewString = sLeftSide + sNewWord + sRightSide;
return sNewString;
}

So for instance, you can do a call like this:

string sStartString = "the quick brown fox is quick";
string sNewString = FindReplaceSubString(sStartString, "quick", "slow");

Which would assign sNewString a value of "the slow brown fox is slow".

Making a creature lay down

You can make a creature lay down by placing the following two commands on a dialog node:

ga_play_ca_snd with the sAnim set to "laydownB"
ga_play_custom_animation with the sAnim set to "proneB"

Make them stand up by using:

ga_play_custom_animation with sAnim set to "standupB"

Note that this only work for NPCs you can select via a tag.

Thanks to John B. Gardner's Animation Viewer, where I figured out how to do this.

Making an invisible object cast a spell at the PC

In this thread, puiwaihin was trying to figure out why his invisible creature couldn't cast spells at the PCs. In the end they figured out that anything that is invisible or hidden can't do it.

jackyo123  suggested making the creatures super small instead.

Check it out here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=576056&forum=114

NWScript: Giving gold in a conversation

Bemmu over at NWScript.com has created a tutorial that will take you through creating a basic conversation with an attached script to give the PC Speaker some gold.

Tutorial level: very basic

Following along with this tutorial should only take a few minutes. The goal will be to create a new Neverwinter Nights 2 module with one creature in it that you can interact with to receive gold from it.

Click here to view the tutorial:
http://www.nwscript.com/how-to-make-an-npc-give-you-gold.php

NWScript: Levers and doors

Bemmu over at NWScript has created a tutorial for attaching a script to a lever that will open a door.

Tutorial level: very basic

The goal in this tutorial is to create a lever that will cause a door to open when pulled. Following along should be very easy and there will only be about three lines of nwscript (the scripting language in Neverwinter Nights 1 & 2) involved.

Head over to NWScript to check it out:
http://www.nwscript.com/making-a-lever-operated-door.php

NWScript: Object Creation

Bemmu over at NWScript.com has created a tutorial for creating multiple objects in a line using vectors. The object in question happens to be beer!

Tutorial level: basic

A nice feature of virtual worlds is that things can be created out of thin air without cost. In this tutorial we will play a bit with this by creating a sort of beer vending machine, where pulling a lever will add a new beer bottle to the end of an endlessly expanding row of them.

Head over to NWScript to check it out:
http://www.nwscript.com/infinite-beer.php

Sitting

Patcha posted a script to let PCs sit on objects.

I'm providing you the way to let object be "sittable" and the script that allow PC to sit on them!

The file contains:
- the script (in a .erf to import)
- the English tutorial to bring "sittable" objects
- the Italian tutorial (the same)
- a module with many brench and chairs, to test this mothod

Check it out on the vault:
http://nwvault.ign.com/View.php?view=NWN2Scripts.Detail&id=43

Starting a conversation with a placeable

This apparently still uses the old "nw_g0_convplac" from NWN1. Follow these steps:

  1. Start by copying the placeable you want to use. Right click on it and choose "copy blueprint > module". Find it at the bottom of the list and click on it to access its properties.
  2. Change the name, tag, resref as needed in order to keep track of it.
  3. Under the behavior section, set the following:
    • Plot = TRUE (optional, but suggested)
    • Static = FALSE
    • Useable? = TRUE
  4. If you have not already done so, create your conversation file and give it a name. Return to the behaviors section and either paste that name into the "Conversation" field, or use the dropdown to choose it from the list.
  5. Finally, under the Scripts section, set the On Used Script to "nw_g0_convplac"

Test it out and your should get your conversation when you use the placeable.

Treasure

The default treasure generation script seems to be gp_treasure_op_de. It seems to check variables set on the container it is called from. It includes some of the X2 scripts from HotU. I spent some time walking through how this all works.

Note: After playing with this system a bit more, I've found that:
1. The base chance is 50%. This means that unless you set the base chance on an area, you'll get just a few gold just over 50% of the time.
2. The magic treasure type tends to give one or two +1 weapons for a level 1 PC. This may be a bit over-powered for low-level mods.
3. For better customization, consider lordniah's FRW base module's implementation of the NWN1: SoU treasure scripts (For more see http://www.wendersnaven.com/node/98).

gp_treasure_op_de

Here is the header comment, which explains the basics:

// gp_treasure_op_de
/*
    Spawns in general purpose treasure and gold based on variables:

	TreasureClass - one of three values.  Default is low
		const int X2_DTS_CLASS_LOW     = 0;       //Treasure Class Low
		const int X2_DTS_CLASS_MEDIUM  = 1;       //Treasure Clas Medium
		const int X2_DTS_CLASS_HIGH    = 2;       //Treasure Class High

	TreasureType - add desired types together.  For example, gold + disposable = 5
		Defualt is 5 (gold + disp)
		Note that you cannot add the same type more than once (i.e. no gold+gold).
		const int X2_DTS_TYPE_DISP 	= 1;
		const int X2_DTS_TYPE_AMMO	= 2;
		const int X2_DTS_TYPE_GOLD	= 4;       	// actually gold and gems
		(not allowed) const int X2_DTS_TYPE_ITEM	= 8;        // char specific Item (ignores treasure class)
		const int X2_DTS_TYPE_MAGIC	= 16;       // random magic items
		const int X2_DTS_TYPE_MUNDANE = 32;     // random mundane items

	This script should be placed in the container's OnOpen and OnDeath events.
	If bashed, disposeable will be dropped and broken item generated.
	If no treasures are generated, 1d20 gold will be created.
*/

This allows module authors to quickly create random treasure of different types by setting both the "TreasureClass" integer variable and the "TreasureType" integer variable on the container. "TreasureClass" uses a simple 0, 1, or 2. "TreasureType" uses a single number that adds up the type values you want for the container. For example, ammo (2) + gold (4) + magic items (16) would be a value of 22.

An important thing to note is that X2_DTS_TYPE_ITEM (8) is not allowed. Here is the reason given in a comment further down in the script: "these don't scale and are to dangerous for balance reasons to have in the standard treasure generation."

x2_inc_treasure

Our script then calls DTSGenerateTreasureOnContainer(), which is located in "x2_inc_treasure." This script first calls gets a random number of items to create based on the call to DTSGetMaxItems().

Looking at DTSGetMaxItems(), we see that it first looks for the module-level integer variable "X2_DTS_MAXITEMS." If it can't find it, it uses a default of 2. Note that this variable is not set in the switches file or in the default "On Module Load" file, which means the value will be 2 unless you have specifically set it.

Returning to DTSGenerateTreasureOnContainer(), the next step is to call DTSGenerateTreasureItems() for each item we are going to create. This function checks the chances for each of the types of items we told it to create with the variables set on the container. The chance is defined by DTSGetBaseChance(). The default is defined as 50 in the constants at the top of the file, but these can be overridden at the area and module level with the variable "X2_DTS_BASECHANCE." If a class and chance condition is met based on a randomized number, an item is created by DTSGetRandomItemResRef().

Looking at DTSGetRandomItemResRef(), we see that we first have to get the name of the .2da file we want to reference using DTSGet2DANameByType(). This file looks for a module-level string variable, and uses a default if it can't find one.

The variables it looks for are:

  • X2_DTS_TYPE_DISP
  • X2_DTS_TYPE_AMMO
  • X2_DTS_TYPE_ITEM
  • X2_DTS_TYPE_GOLD
  • X2_DTS_TYPE_MAGIC
  • and X2_DTS_TYPE_MUNDANE

(Note that these match the constants uses for the treasure type.)

The default .2da files that will be used are:

  • des_treas_disp
  • des_treas_ammo
  • des_treas_gold
  • des_treas_items
  • des_treas_magic
  • des_treas_mundane

Remember that all these files can be found in Data/2da.zip, in your NWN2 programs files ("C:\Program Files\Atari\Neverwinter Nights 2\Data" by default). Extracting the .zip files to your desktop and opening the .2da files in Microsoft Excel, will reveal how these are laid out. For example, looking at the random magic .2da file (des_treas_magic.2da), will show that the low class items are all +1, the medium class items are +1 and +2, and the high class items are +2, +3 and +4. There is also a very high column, which is probably left over from the epic levels in NWN1: HotU.

Wandering Monsters

Controllore posted a concise answer to using the old HotU "wantering encounter while resting" script.

View the module properties, in the On Module Load event you will see "x2_mod_def_load". Uncomment the line (around 123)

SetModuleSwitch ( MODULE_SWITCH_USE_XP2_RESTSYSTEM, TRUE )

Then where you see

SetWanderingMonster2DAFile( "des_restsystem" )

uncomment it and change "des_restsystem" with any other name you choose.
"des_restsystem" is the name of the 2da file that will be used for the wandering monsters (type, percentage of appearing at daytime/nighttime).
Edit des_restsystem.2da, do your changes and save it with the name you used in x2_mod_def_load.

That should do it.

Edit:
Into your areas, insert a variable named X2_WM_ENCOUNTERTABLE of type string. Its value must be the name used for the TableName in the des_restsystem.2da.

Read the full threat here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=535148&forum=1...

Companions

Here's some helpful resources for working with companions... (more cominig soon)

Companion Influence

The companion influence system used in the OC is not available by default in new modules. To get them, copy all of the kr_influence* scripts from "C:\Program Files\Atari\Neverwinter Nights 2\Campaigns\Neverwinter Nights 2 Campaign." You can then paste them into your own campaign. Note that you will need to edit the constants and companion names across all scripts to match your own companions.

FRW: suggestions for dealing with companions

In a conversation between Wayne and Lord Niah over in the FRW forums Lord Niah had some good suggestions for working with companions.

Here are some rules of thumb for dealing with companions and the roster. I don't recall some the exact names for commands and do not have acces to the toolset at the moment.

#1 You should only have one instance of a companion placed within your campaign and you should never spawn that companion using CreateObject.
#2 If you want to destroy a companion, then use the despawn command (not the DestroyObject command)
#3 If you want to spawn your companion back in, use the spawn command instead of CreateObject
#4 If you want to add your companion to the roster, but don't want players to see them in the GUI selection screen, then just mark them as Campaign NPCs. Don't waste time adding/removing the companion from the roster every time they join or leave the party. Once they are in the roster, you just have to add/remove them from the party.

Check out the forum here:
http://nwcitadel.com/forums/showthread.php?t=873

Henchmen

Henchmen are companions who the player cannot directly control or adjust inventory for. Thanks to sgt_why for this explanation on how to set them up.

Here's his post from http://nwn2forums.bioware.com/forums/viewtopic.html?topic=545390&forum=1...

for this example;
string sTag = "c_human"

// is this a henchmen ? TRUE or FALSE
gc_henchman(sTag)

// this adds them to your party as henchmen, not companion
ga_henchman_add(sTag);
/*
note: this has (4) actual parameters ... the last flag can be very useful.
sTag - tag of the creature you want to add
bForce - if set to 1, sTarget will be added even if player already has maximum henchman
sMaster - The Creature you are adding the henchman to (default is PC Speaker)
bOverrideBehavior - if set to 1, sTarget's event handlers (scripts) will be replaced with henchman ones.
*/

// removes the henchmen from the party
ga_henchman_remove(sTag);

- - - - -
I put all of these into the conversations and seems to work great. In fact, think if the henchman dies .. they are removed from the group as well.

And you cant click on them and change thier inventory .. although I did notice there appear to be scripts out there to make the henchman show you his inventory and such, like a companion. But it would need to be during a conversation or such. (I think?)

I wanted to add a couple "friendly"(s) in my areas .. that if the PCs save them, will offer to help out for a short time .. as well as award 50xp for not letting the mobs kill them off.

Following his directions, I was able to create a few henchmen and get them to work with very little setup. Some quick things I noticed:

  • A "guard this area and I'll come back for you" dialog option with the ga_henchman_remove script on it worked great to when you want to temporarily ditch them.
  • Use unique tags for each creature. If, in his example, you have a set of friendlies standing around, each one needs it's own conversation and tag. It helps to write the conversation first, then duplicate it. This will lead you to creating more distinctive NPCs anyway.
  • Set the bOverrideBehavior = TRUE if you didn't do anything with the scripts on your henchmen, or they won't follow the PC.
  • Commoner NPCs won't attack, which worked just how I wanted. I was able to create a lost little girl that the party could escort home. Thankfully, she didn't run up and try to punch people in the groin.

Kudos to OE on making such an easy to use system, and thanks again to sgt_why

Naming Conventions

It's important to name your scripts in a consistent manner so that you know what they do and you know where to find them when you need them. Here is some information to help with naming.

CODI naming conventions

Barry The Hatchet posted a good roll up of the script naming conventions the CODI project came up with in NWN1. Here's the link: http://nwcitadel.forgottenrealmsweave.org/showthread.php?t=1131

Here's the actual list:

Include Scripts
Include scripts should be prefixed with INC_

Event Driven Scripts
Following the prefix for EVENT driven scripts, this is the majority; you have 1 letter denoting the object type that has the event this script goes in, they are as follows:
* N - NPC
* M - Monster/Creature
* A - Area
* O - Module
* P - Placable
* T - Trigger
* D - Door
* R - Trap
* C - Conversation
* E - Encounter
* I - Item - This script is not placed on an item per se, but called by module level scripts.
* X - No Object - Use this for a script that is called by other scripts. Executable scripts.

This character is followed by a two character short for the event it goes in, by category:

* N, M
o CO - onConversation
o DI - onDisturbed
o PA - onPhysicalAttacked
o SP - onSpawn
o UD - onUserDefined
o SC - OnSpellCastAt
o BL - onBlocked
o DM - onDamaged
o HB - onHeartbeat
o DE - onDeath
o CR - onCombatRoundEnd
o PE - onPerception
o RE - onRest

* A
o EN - onEnter
o EX - onExit
o HB - onHeartbeat
o UD - onUserDefined

* O
o CE - onClientEnter
o CL - onClientLeave
o PR - onPlayerRest
o RS - onRespawn
o DY - onPlayerDying
o DE - onPlayerDeath
o LE - onPlayerLevelUp
o IA - onItemActivated
o IQ - onItemAquired
o UI - onUnaquireItem
o ML - onModuleLoad
o HB - onHeartBeat
o UD - onUserDefined
o EI - onEquipItem

* P
o US - onUsed
o HB - onHeartBeat
o DE - onDeath
o AT - onAttacked
o SC - onSpellCastAt
o DM - onDamaged
o OP - onOpen
o OC - onClosed
o DI - onDisturbed
o LO - onLocked
o UL - onUnlocked
o UD - onUserDefined

* T
o CL - onClick
o EN - onEnter
o EX - onExit
o HB - onHeartBeat
o UD - onUserDefined

* D
o AT - onAreaTransitionClick
o OC - onClosed
o DM - onDamaged
o DE - onDeath
o FO - onFailedToOpen
o HB - onHeartBeat
o LO - onLocked
o OP - onOpened
o AT - onAttacked
o SC - onSpellCastAt
o UL - onUnlocked
o UD - onUserDefined

* R
o DI - onDisarmed
o TT - onTrapTriggered

* E
o EN - onEnter
o EX - onExit
o OE - onExhausted
o HB - onHeartBeat
o UD - onUserDefined

* C
o AT - Actions Taken
o AP - Appears When (StartingConditional Script)
o AB - onConversation Aborted
o EN - onConversation end

* I
o US - Called when the item is used.
o AQ - Called when the item is Aquired.
o UA - Called when the item is UnAquired.

Prefix examples

Module OnClientEnter script prefix: OCE_
Area OnEnter script prefix: AEN_
Placeable OnUsed prefix: PUS_
__________________
Just bend the pieces 'til they fit.

Official Documentation: Script Naming Conventions

buried in the official Toolset documentation is a section about naming conventions for scripts. I've replicated it here for easy reference.

All scripts in NWN2 are are prefixed with one of the following:

  • “g” for global scripts
  • “i_” for item related scripts (these are also global)

Item Scripts

Use the following for item scripts:

i_<Item Tag>_ac

script to execute when item activated

i_<Item Tag>_aq

script to execute when item acquired

i_<Item Tag>_ua

script to execute when item unacquired