Here you will find some useful information regarding testing.
Here's a general thread discussing some good ways to make testing and debuging easier in a large module:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=572072&forum=1...
The debugger, debug messages, debug creatures with conversations set up to help you test and the console are just a few of the tools you have at your disposal.
So far this section mainly deals with scripting. See the links below:
Getting the debug messages to print to the log or the screen can really help when trying to track down a problem in your module. Following up on some leads from jackyo123 and a few frustrating google searches, here's how I got it to work:
I'm not entirely sure this is needed or how this affects module, but it's also useful for using the ScriptDebuggerServer, so I have it on.
This one took me a while to find, partly because the documentation for DebugPostString() says you need to edit nwn.ini instead of nwnplayer.ini.
Add your PrettyDebug messages where you want them. You'll notice that you'll get a lot of messages from the regular scripts, as well. These are great when you trying to figure out why the script that seems to be saying it should do something, isn't doing what you want.
You can do this in the game or you can do this via the ini file.
In game:
In the nwnplayer.ini:
If you are sending debug information to your logs, they will appear at:
C:\Documents and Settings\Sean\Local Settings\Temp\NWN2\LOGS\nwclientLog1.txt
If you are sending debug information to the screen, they will appear up by the mini-map.
Thanks to jackyo123 for pointing this out. If you type in "logscriptrun" in the console while in debug mode, your log will fill up with all the scripts that are being called. It can be a bit much to wade through, but sometimes it's good to see if something was run.
The debug server is a way to walk through your scipts step by step. It creates a debug window that let's you see the path your script is taking, and is useful for figuring out why something is happening, or how something works. In programming, this is similar to breakpoints. Here's how I got it set up:
When it gets to where you placed the SpawnScriptDebugger(), the game will freeze and wait for you to tell the debugger to continue. Keep clicking "Step Into" until you have finished the script. At this point play will continue as normal.
There are some other options in the debug window that I didn't play with, so experiment.
| Cheat | Effect |
|---|---|
| dm_givegold # | Gives the desired amount of gold |
| dm_god | Invincibility |
| dm_unlockcamera | Allows you to use the camera with better scrolling and the such |
| givefeat # | Add the feat to your currently selected character (use #'s 2 through around 500) |
| giveitem [item tag] # | Gives active player item |
| givespell # | Gives a spell identified by it's id number to the character. |
| givexp # | Gives the desired amount of XP to your character. |
| givexp [-ve number] | Decreases your experience points by the value entered |
| irolltwenties | 20 in every statistic. |
| polymorph # | Turns your controlled character into a different creature. |
| removefeat # | Remove the feat corresponding to that number |
| resetlevels | Delevel you if your experience points is near to 0 |
| rs ga_alignment(-1,0) | to move one point towards evil |
| rs ga_alignment(-1,1) | to move one point towards Chaos |
| rs ga_alignment(1,0) | to move one point towards good |
| rs ga_alignment(1,1) | to move one point towards Law |
| rs ga_influence (x,y) | Raises influence level for that companion. |
| rs ga_party_limit(6) | Raises the amount of party members you may have at once to 6. Default is 3 in Act 1 and 4 in Acts 2 and 3. |
| rs ga_time_advance(Hours,Min,Sec,Milli) | replace Hours, Minutes, Seconds and Milliseconds with how much time you want to advance. |
| rs kr_influence | A simple influence editor, in the form of a dialogue. |
| rs kr_roster_edit | Opens a debug dialogue with an option to open the party roster to switch party members in and out at any time. (Use caution with other features there) |
| Set Appearance # | Makes your character have the appearance of the # in the res ref table of the 2da appearance file...*Note this is just appearance* |
| SetCHA # | Set charisma to given number. |
| SetCON # | Set constitution to given number. |
| SetDEX # | Set dexterity to given number. |
| SetINT # | Set intelligence to given number. |
| SetSTR # | Set strength to given number. |
| SetWIS # | Set wisdom to given number. |
| unpolymorph | Returns your controlled character to normal. |
| rs gr_dm | Spawns a Dungeon Master NPC who will allow you to spawn items, add journal entries, open stores, add/remove party members, and teleport. |
Tweak guides has a full list of debug commands posted on their fantastic NWN2 TweakGuide section.
The command console in Neverwinter Nights 2 allows users to apply various tweaks or changes to the game 'on the fly' while playing. To open and close the console, press the '~' key (or the key above TAB and/or below ESC) on your keyboard. To implement a console command, simply type its name along with any parameters required. Importantly, for many commands to work, you will need to first enable debug mode by entering the following into the console then pressing ENTER:
DebugMode 1
Note that console commands are case sensitive, so entering debugmode 1 for example won't work, it needs to be exactly as shown, i.e. DebugMode 1. The full list of console commands is provided further below in alphabetical order, however I provide full descriptions for the most useful commands first:
showfps - Toggles the frames per second (fps) display on/off.
trees - Toggles the rendering of all trees on/off. Useful for temporarily improving FPS in outdoor areas.
renderwater - Toggles the rendering of water on/off. Useful for temporary FPS boost in areas with water.
rain [0,1] - Toggles rain effects on if set to 1, off if set to 0.
daynight - Toggles the day/night cycle.
wireframe - Toggles wireframe mode on/off, useful for seeing the amount of detail actually being rendered/calculated in any area, even if it's not directly visible on screen.
gfxoptions - Brings up a special Graphics Options dialog box with a multitude of graphics-related settings you can change, including shadow intensity, toggling the day/night cycle, toggling rain on/off and altering the Bloom lighting parameters.
rs kr_roster_edit - Opens the NWN2 Companion Roster Editor, with a proper interface for adding, removing and altering various parameters for companions.
SetSTR, SetDEX, SetCON, SetINT, SetWIS, SetCHA [Value] - Right-click select a target, and use these commands to alter the relevant attribute to the value you wish. For example, right-click select your own character and use SetSTR 18 to give him/her 18 Strength.
givefeat [ID or all] - Select a character then use this command with the appropriate feat ID/name to give them that feat, or use 'all' to give them every feat.
giveitem [ID] [Number of items] - Select a character then use this command to give a particular item to the character, along with how many of that item to give. The list of ID tags for items can be found by launching the NWN2 Toolset, going to the Plugins menu item, selecting 'Universal Blueprint Changer', then selecting Items in the new dialog box and finding the appropriate name under the Tag column.
givespell [iD] - Select a character then use this command to give a particular spell to the character. The spell IDs can be found by launching the NWN2 Toolset, going to the View>2DA File menu option, then selecting the Spells file and using the number under the Name column.
givexp [value] - Select a character then use this command to give them the specified number of experience points.
dm_givegold [value] - Right-click select a character then use this command to give them the specified amount in gold pieces.
dm_god - Enables God mode, meaning you can't be killed.
The following are all the 181 console commands for Neverwinter Nights 2. Aside from DebugMode needing to be enabled for most of them to work, remember that many of them require you to either be the active character, or right-click select a particular character to apply a command successfully.
aabboxes
ambient
anim_blend
animation
animglod
animlod
anims
attachcamera
auditfeats
auditspells
automemorize
axes
base
blurradius
border
bugreport
c2
c3
camera_debug
camera_debug_full
camera_debug_los
capsules
clientstats
creatures
cutscene
cutscene_override
daynight
daynightscale
daytime
debugcam
DebugMode
debugtext
depthbatch
depthbatchindex
diffuse
DirShadowDepthBias
DirShadowSlopeScaleDepthBias
dm_givegold
dm_god
dm_jumptopoint
dropshadows
dumpmemory
dumptextures
emo_blend
EnableCombatDebugging
envshadows
exportchar
ffxbase
flicker_lights
fog
frecam
frusta
full
gfxoptions
givefeat
giveitem
givespell
givexp
glowintens
glows
hiliteintens
hilitethresh
hookpoints
irolltwenties
island
killgui
lights
loadgame
loc
loggameeffects
logrunscript
logserverai
lokkat
memstats
minimapsave
mipfilter
mousepick
mousepos
NetProfile
NetProfileReport
normals
obb_all
obb_cdoor
obb_sdoor
obb_water
obboxes
occlusion
partyadd
partyremove
paths
pbn
perception
physics
playbyname
PointShadowDepthBias
pointshadows
PointShadowSlopeScaleDepthBias
polymorph
portraitsave
possesscompanion
printactions
printcombatdata
printcreatures
printeffects
printfactiontable
printfeats
printglobalvars
printlevelstats
printlistenexpressions
printlocalvars
printperception
printrepository
printreputation
printscripts
profiling
rain
ReigidPointShadowZBias
removefeat
renderpc
renderwater
resetlevels
resetpackage
resetstats
resourcestats
RigidDirShadowZBias
rosteradd
rs
runscript
savedaynightstage
savegame
sceneintens
scriptprofiling
SelfDirShadowDepthBias
SelfDirShadowSlopeScaleDepthBias
SelfPointShadowDepthBias
SelfPointShadowSlopeScaleDepthBias
serverstats
SetCHA
SetCON
SetDEX
SetINT
setstatsdepth
SetSTR
SetWIS
shadowmap
shadows
showattacks
showcomments
showfps
showscriptcalls
showstats
showtriggerevents
skels
SkinDirShadowZBias
SkinPointShadowBias
sky
snow
softshadows
solid
specular
spheres
stats
surface
surfaceonly
takedamage
TerrainDirShadowDepthBias
TerrainDirShadowSlopeScaleDepthBias
TerrainDirShadowZBias
texfilter
textborder
tint
toggleserver
trees
unpolymorph
usebehavior
usescriptset
verifymemory
voiceover
wami
waterreflections
wireframe
Head over to the Tweak Guide for more information: http://www.tweakguides.com/NWN2_1.html