Friday 21 September 2007

Italics and bold in conversations

Use the ordinary html tags, <i> and <b> with their respective closing tags for bold and italic.

Includes - starting with group, ginc_group

All the include scripts are wonderful function libraries. Just starting to explore these.

ginc_group for example has handlers for creating and dealing with groups of creatures.

// Add up to iMax creatures with tag sTag to group sGroupName
void GroupAddTag(string sGroupName, string sTag, int iMax=20, int bOverridePrevGroup=FALSE)

// spawn creatures in - in BMA formation - and add them to a group
// if there are creatures already in the group, the new ones will be tacked on to the end and placed
// in formation accordingly.
void SpawnCreaturesInGroupAtWP(int iNum, string sTemplate, string sGroupName, string sWayPoint="SPAWN_POINT")

You can handle them as a group to face a waypoint, move to an object etc etc.
Then on the death of this group, various functions are available, eg:
GroupOnDeathBeginConversation
GroupOnDeathSetJournalEntry

Thursday 20 September 2007

Miserable as hell

Me and the weather. No birds. Dark.

8.42 Power cut now over. Power went off at about 7.40.

Sunday 16 September 2007

Use Selection button to make only what you want selectable

In the top left you have a dropdown menu called Selection. This allows you to chose which things to select (placables, creatures, sounds etc.). This is very helpful for selecting placeables and creatures placed under trees. It's also very helpful when selecting doors, waypoints and triggers. I usually set this to "None" whenever I'm not actively working on a part of the area, and just looking around trying to find out what to tweak next. No chance of dragging something out of place

Also, the show/hide button next to it is great for finding what you need to work on.
Found

Fixing door problems

You can double-click on the building, and it will suck its doors back into place. If you use your imagination, you can hear the rush of wind as it does so.
Source: Neverwinter Nights: Doors Flying Off Their Hinges
Address : http://nwn2forums.bioware.com/forums/viewtopic.html?topic=570637&forum=113

Terrain window unusable in Vista

Known bug. Have to switch Themes - right click on Desktop, choose Personalize[!] and then Themes and choose Windows Classic. Bit stark and not exactly what people buy Vista for, but the Terrain window will now be readable.

Wednesday 12 September 2007

Change PC or NPC name

RandomName()
Generates a random name.
SetFirstName works on PC or NPC - probably also on a placeable or item

string sCreatureTag="n_gerana";
void main(string sCreatureTag)
{
object oVictim = GetNearestCreature(0,0);//haven't sorted this one yet
oVictim = GetObjectByTag(sCreatureTag);
string sNewname = RandomName();

//All names I've got so far are male sounding so
//if female add an 'a'
if (1==GetGender(oVictim))
{
sNewname = sNewname +"a";
}
SetFirstName (oVictim,sNewname);
sNewname = RandomName();
SetLastName(oVictim,sNewname);
}

Lie down on bed, untried or rather no success with this yet

// Play custom animation (returns void)
void C_PlayCustomAnimation(object oObject, string sAnimationName,
int nLooping, float fSpeed = 1.0f)
{
PlayCustomAnimation(oObject, sAnimationName, nLooping, fSpeed);
}
void C_Laydown(object oTarget)
{
float fDelay;
if (GetGender(oTarget) == GENDER_FEMALE) {
fDelay = 3.33;
} else {
fDelay = 2.33;
}
PlayCustomAnimation(oTarget, "laydownb", 0);
DelayCommand(fDelay, C_PlayCustomAnimation(oTarget, "proneb", 1);
}

Two children playing tag

Both need the following variable set in their onspawn or otherwise: X0_COMBAT_CONDITION = 4 (Int)
Put this code in their OnHeartbeat:
//::///////////////////////////////////////////////
//:: gb_am_heart
//:: Copyright (c) 2005 Obsidian Entertainment
//:://////////////////////////////////////////////
/*
Ambient system heartbeat.
*/
//:://////////////////////////////////////////////
//:: Created By: Brian Fox
//:: Created On: 1/5/06
//:://////////////////////////////////////////////
#include "x2_am_inc"
#include "nw_i0_generic"
//:://////////////////////////////////////////////
void debugit(string s);
//:://////////////////////////////////////////////
void main()
{
if ( GetAILevel() < AI_LEVEL_LOW || NoPlayerInArea() ) return; // * don't run this if no one is around
//if ( GetAmbientBusy(OBJECT_SELF) == TRUE )
//{
// debugit( "ambient mode = TRUE" );
//}
//if ( GetReady(OBJECT_SELF) == FALSE )
//{
// debugit( "not ready" );
//}
//if ( GetInTransition(OBJECT_SELF) == TRUE )
//{
// debugit( "transition" );
//}
//else
//{
// debugit( "no transition" );
//}
if ( GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY) )
{
if ( TalentAdvancedBuff(40.0) )
{
SetSpawnInCondition( NW_FLAG_FAST_BUFF_ENEMY, FALSE );
return;
}
}
// * Nov 8: added conditions before they are allowed to try and leave
if ( GetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING) )
{
// * bk NOV 1: Trying to streamline the day/night transitioning
// * scripting
// * Nov 8: Adding the transition setting to it, to prevent
// * the barmaid from being over eager in serving drinks to everyone
// * even after closing
if ( GetCurrentAction() != ACTION_MOVETOPOINT && GetCurrentAction() != ACTION_DIALOGOBJECT )
{
//debugit( "going to check on waypoints" );
object oDayWay = GetObjectByTag( "POST_" + GetTag(OBJECT_SELF) );
object oNightWay = GetObjectByTag( "NIGHT_" + GetTag(OBJECT_SELF) );
if ( GetIsObjectValid(oDayWay) == TRUE && GetIsDay() == TRUE && GetArea(oDayWay) != GetArea(OBJECT_SELF) )
{
SetInTransition( TRUE, OBJECT_SELF );
WalkWayPoints( TRUE );
}
else if ( GetIsObjectValid(oNightWay) == TRUE && GetIsNight() == TRUE && GetArea(oNightWay) != GetArea(OBJECT_SELF) )
{
SetInTransition( TRUE, OBJECT_SELF );
WalkWayPoints( TRUE );
}
else // * I am in the right area
{
if ( GetInTransition() == TRUE )
{
SetInTransition( FALSE, OBJECT_SELF );
}
}
}
}
DoJob();
SetLocalLocation( OBJECT_SELF, MY_LOCAL_LOCATION_VAR_NAME, GetLocation(OBJECT_SELF) );
if ( GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT) )
{
SignalEvent( OBJECT_SELF, EventUserDefined(1001) );
}
}
//:://////////////////////////////////////////////
void debugit( string s )
{
//if ( GetTag(OBJECT_SELF) == "TownWait01" )
//if ( GetLocalInt(OBJECT_SELF, "NW_L_RANDOMTAG") == 0 )
//SetLocalInt( OBJECT_SELF, "NW_L_RANDOMTAG", Random(10000) );
}
//:://////////////////end of code//////////////////


NOTE - only way you can post code into blogger - if you want to keep the default convert line breaks on - is to use DIV with overflow - ie put style="overflow:auto; height:300px; width:400px;" for instance. You can't use textareas.

Debug Text=1

Script exceptions can be seen all of the time by changing the nwn.ini in the directory where NWN2 is installed. There is a setting for Debug Text=0. Change it to Debug Text=1. Also make sure DebugMode is set to 1. I highly recommend this change for anyone doing scripting so you don’t have to enable seeing exceptions every time you test. Each time the game is patched the nwn.ini gets overwritten so be sure to reapply this change. The settings may work in the My Documents nwn.ini so it won't get overridden, I haven't tried that.
Source

My notes on this, I am trying it out.

Tuesday 11 September 2007

Create a new spell?

You can apparently alter one of the spell scripts that are already there. In the 2da you'll find a column named impactscript. This is the script that gets fired if you cast the spell. But you may also add new scripts to your 2da. most of the columns are quite self-explaining.

Untried at this moment.

Monday 10 September 2007

Stackable shortcut S

Stack placeables on top of one another by changing the Stackable attribute to True.

Shortcut, use S. Select the placeable and press S (this changes the "Stackable" option to True). Then, just copy and paste the placeable as many times as you want.

Sunday 9 September 2007

FloatingTextStringOnCreature ONLY works on PC

Remarks

This function seems to be most useful for notifying PCs (and possibly their party) of in game effects (detections, environmental perceptions, etc), and not as a way to facilitate PC-to-creature communication. For instance, if a PC passes a Listen check they could be notified via Ambient Text (“You hear footsteps coming down the hall”). Other uses could include Onomatopoeia originating from the PC (“Snap!”, “Cough!”, “Hick!”) and brief game feedback (simulate an overheard conversation, time from a sundial, item status, etc).

This function will not work on placeable objects of any kind, and text targeted to NPCs will never be visible to PCs. You can simulate text coming from a sign, sundial, or any other placeable object by floating it above the PC you want to notify, as long as the PC is near to the object when the text will appear.
Source: NWN Lexicon


NOTE But you can use SpeakString() - Am going to test this for placeables, particularly signs, as well as creatures. It floats the text so is a good replacement. Search for an entry later on this.
Update: It does work, it gives the name of the placeable in square brackets followed by the text of the SpeakString. Text floats upwards.

Thursday 6 September 2007

Set Local Variable on the PC

void main( )
{
object oSelf = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
SetLocalInt(oSelf, "Value1", 1);
SetLocalFloat(oSelf, "Value2", 3.40);
SetLocalString(oSelf, "Quest1", "Quest completed!");
}


NWN2 Local Variables...
* NWN2 Local Variables are preferred over NWN2 global variables because they are assigned to specific objects and in that sense protected.
* Can be accessed by any object.
* Come in three types: integer, float, and string.
* Used to store information with a specific object.
* Used to get information from a specific object.


Source: NWN2 Scripting Setting Local Variables

Wednesday 5 September 2007

Tip: Debug using SendMessageToPC

//Debug String
SendMessageToPC(GetFirstPC(), "value of global int intValue is " + IntToString(intValue));

Spawnees and conversations

When a creature is added to an encounter if it already has a conversation it seems from my experimentation that the conversation will not fire. What does work is an onconversation script. So far, I have used these with the convo in SpeakStrings but can't see why it can't also start up a convo by tag.

Baking hell - too many objects

Constant difficulties here. Only solution is to convert as many placeables as possible to environment objects.

Tuesday 4 September 2007

Interface hell - using conditionals and parameters in convo editor

Interface hell. The conversation editor. When you are using the conditional tab or the action tab, pressing Refresh will eventually get you a little box to add things like starting conditional values.

Click Add to get a list of scripts, select one, then press Refresh to get the little box/es in which to enter values. Same system for the Conditions.

Try it out, it does work quite well, just clunky and pretty hidden.

Item - create special item with script on activate

You would not believe how tortuous this process is!!!

In item properties, under cast spell in 'item properties' window, you put in 'unique power'.
NOTE!!! Choose your base object with care, as gem for instance does not have anything available in 'item properties' window!!
Then you create a new script - don't worry there is nowhere in the item properties to link this in, it is done otherwise.
Use the 'item activate' template, then write out what you want the script to do when the item is activated.
The name of the script has to be i_tagofitem_ac.
Now, whenever the item is used by the player, the script will execute.

===============================================================

Item Scripts
Use the following for item scripts:

i__ac
script to execute when item activated

i__aq
script to execute when item acquired

i__ua
script to execute when item unacquired

i__eq
script to execute when item equipped

i__ue
script to execute when item unequipped


The module events will be written to automatically execute the proper script.

StringToObject - possibly can use to reference

//RWT-OEI 03/12/07
//Convert a 'string' to an object data type.
//This does not guarentee that the 'object' is anything valid
object StringToObject( string sString );


Try this for mock arrays
babble1, babble2 etc, to reference them

try and report back captain

My encounter creatures aren’t wandering around. How can I fix this?

My encounter creatures aren’t wandering around. How can I fix this?
Make sure your spawn script has the following:

if (GetIsEncounterCreature())
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS, TRUE);

Randomly pick a dialog response

gc_rand_1of(int iMax)
Used to randomly pick a dialog response.

Use parameters 2 through X for each entry after the first, decrementing by 1 for each branch down.

Example: 3 entries would have the following conditionals:

gc_rand_1of(3)

gc_rand_1of(2)

The final entry doesn't need a check since it is a certainty.

Monday 3 September 2007

Add Henchman

ga_add_companion(string sTarget)

This script adds the target as a henchman to the party.
Parameters:
string sTarget = Tag of the henchman to add. If blank, add dialog OWNER.

Multiple speakers in conversations

How to achieve this: In the Node tab, set the Speaker field to the tag of the speaker. NOTE: helpfully[!!!] this only appears in the lines already designated to be spoken by the NPC not the PC.

Friday 31 August 2007

Tint walls and floor - How?

Because I always use Properties in a New Window I couldn't find how to tint walls. If you select the interior Tiles you wish to colour you can look in the Properties window itself to change the colour of the walls.

BUT so far, changing the colours for the floor, let alone the promised texture changes (promised pre-release) doesn't work at all.

Floor workaround - I chose a floor placeable, resized it to fit the whole floor of the area, and tinted that in the usual way.

ALTHOUGH I had problems getting it to sit on the ground! Fixed that by changing the last parameter of its 'Position No Snap' to zero. IMPORTANT - after doing this set position and height lock to True!

SIDE NOTE set this last height param to 0.01 for carpets that sink into the floors particularly with the castle tiles.

There is also a placeable called a floorprop - initially at least a giant orange swirly tiled thing, but haven't really investigated its potential.

Even friendly encounters must be hostile

You can have an encounter spawning lots of lovely grannies or doggies, but the encounter itself must be set to Hostile, or to a faction hostile to the player.

Thursday 30 August 2007

New Lines

Hold SHIFT or CTRL when pressing enter to enter line break in module description, journal entries etc.

Trouble with conversations

Conversations - inserting reference lines correctly - counterintuitive but this is how:

  1. Right-click the destination NPC line and click ‘Set Link Destination’, then
  2. Right-click the PC line that should point there and select ‘Insert Link’.

The same text is inserted automatically cast in grey, to signify that it’s just a reference. If you change the dialog text of the original line, it will update all references that point to it.

Taken from Conversation Tutorial By Justin Gattuso

Wednesday 29 August 2007

Easy change NPC's clothes

Took me ages to find this. In Properties window for your NPC select the tab called 'Armor Set' and change the Variation box to another number. You can see the result if the Preview button is down.

Monday 27 August 2007

Toolset - lost Blueprint/Terrain window

Lost the main Blueprint/Terrain/Tiles window. Nothing I did could bring it back. Using the View/Options/Windows/Reset, although it had worked in the past, no longer worked.

Solution: Delete/rename the file in your 'Documents and Settings//Local Settings/Application Data\NWN2 Toolset\en-GB' folder called WindowConfig.xml

Local Settings is a hidden folder so make sure (for XP anyway) that you tick the box called 'Show hidden files and folders' in Explorer the Tools/FolderOptions/View.
You may also need to UNTICK the box called 'Hide Protected Operating System Files'.

Friday 24 August 2007

The Walkmesh

The 'Baked' toggle button shows you the current state of the terrain bake. Turning it on and off will show the changes that you made.

To make any changes to a walkmesh first turn off the "Baked" toggle. Make your adjustments, then rebake the level before running.

Lighten the load

Lighten the load on your PC by converting placeables to mere environmental objects. The engine does not calculate collision with these for either the characters or the camera and does not cut the walkmesh, so that fewer calculations have to be made in-game.

Convert rocks, even buildings beyond your interactive zone, and things that are purely there for decoration, not to be interacted with, and you will help your module run faster.

One caveat: Remember to cut the walkmesh out around them or you can walk through them.

Thursday 23 August 2007

Creating and using Groups

Create groups by using Shift click to select the various bits. Right click and select Export.

To use these files, simply unpack the .pfb files into My Documents/Neverwinter Nights 2/Override folder. Start up the toolset and they should appear under Blueprints|Prefab Groups.

Hmm. This works, but there is no Name field. Don't know how to make this happen.

Apparently to make sure they show up with a Name, you have to export them, then move them into override, then name the files, then re-export them. Oh how ridiculously convoluted.

Nope, doesn't seem to work.
unsolved
Tried allowing editing of blueprints by changing the value of
View/Options/General/Advanced/AllowEditingGlobalBlueprints
to true. And then using the plugin UniversalBlueprintChanger. But am getting crashes when try to load values for any prefabs at all.


Aha, know the answer to this now i think. I have not got the patch on my machine, and this was a problem fixed in the patch 1.03.

Q. Is there a way to create groups as we had them premade in Neverwinter Nights 1?

A. Select the objects you've placed, right click them and select Group. Name them. Right click them again and select Export. Save them into your modules directory inside the current temp folder you are working with (the module name will be at the end of it). Restart the toolset and open the module, you will see your grouped prefabs in the Prefab tab. You will have to rename it and classify it to get it organized as you want.
Source: Neverwinter Night 2 Toolset Guide


UPDATE: Got the patches, but still can't rename these things. STill don't know how to in spite of various advice I've found online.

Using Height lock with placeables

Getting placeables to do what you want can be very tricky. The arrow keys move placeables about, use Ctrl as well to rotate them. Page Up/Down adjusts the height of your placeable.

Height lock (‘Z’) locks the placeable in place. Use to fix its height in absolute terms. You can use this to get bridges to stick where you want them for instance. And useful for 'mixing' into terrain if they otherwise look too stuck on top of the terrain.

Terrain - use Flatten Smooth and Noise


Flatten is your friend. Keep the levels simple at first. Raise a test section in one corner out of the way to the level you want, then use the Flatten button and the eyedropper to select that height and paint away at the terrain you want to raise to that height.

For water, use a lowered not raised section in the same way then fill with water. Experiment with the water level, try -1 say. Use the eyedropper again to fill your sunken areas with water.

Smooth will rather obviously smooth out any jagged irregularites and give a more natural look. Noise will add 'noise' ie random irregularities again for a more natural appearance!

Stackables or placing things on tables



You can now stack placeables. This requires only changing Stackable under the miscellaneous properties to TRUE.

Change the default Stackable to True for the item, such as the bowl of fruit, which can be easily placed on top of say a table. This really works, see screenshot.

You can even stack several things, like baskets. A stack of three of the flatter baskets looks good.

OK, it is sometimes easier than other times. Use the arrow keys to fine tune your placing. And Ctrl arrow to turn it around.

What this is for