That's not "feet for walking", but a new "feat for talking"!
OK, my wife thought it was a bad pun as well. Anyway, today, I have been looking at how custom feats were added to NWN2. In the official campaign, you acquire new "special" feats when you reach the statues at the "Ruins of Arvhan", and so I took my lead by checking out the scripts there. During my dissecting of the code, I learned about changing the colour of text as well. And to top all this, I discovered a new NWN tool that could open and edit both 2da and tlk files for both NWN1 and NWN2.
NEW TOOL: The tool I discovered is called TabularFramework and can be found at the Vault. It is quite impressive, and while it takes about a minute to load on the first use, it loads quite quickly on later usage. It not only allows you to edit both 2da and Tlk files, but also has the ability to open more than one file at once and compare 2da files. Also, there is a hexadecimal translator built in that can both decode and assign the confusing hexadecimal codes like the ones used for metamagic at the click of a button! I have found it reasonably stable and can say it has been a very useful addition to my toolset tools.
TEXT COLOUR: Text colour is not handled the same way in NWN2 as it was in NWN1, and during my sorting of the feat function I learned how to handle this. It involves a knowledge of the hexadecimal number for a colour, and requires a simple process of assigning the code to a simple string within a constant. I go into more detail on this web page from my website: How To Alter Text Colours. There is a table there showing all the colours and their equivalent name within NWN2 and a brief description of some code that can be used to assign the colour.
ADDING A FEAT: This was my main aim for today,and I was surprised that I managed to get it working on my first attempt! I did go on to mess it up, but by the end of the day, I achieved what I was after. :) As well as simply wanting to learn how to do it, I also wanted to give the player a way of changing some "Options" about their style of play. This involved adding a line to the feat.2da file, that also related to a new line in the spells.2da file, which contained the script that fired when the feat was used. I also had to add the constant FEAT_ALTHEA_ABILCONV so that I could use it to script the new feat onto the player if they did not yet have it. The result now, is that when the player enters the game, the module checks if the player has the feat, and if they do not, then it is added. The new feat is a "History" feat, which gets added to the drop down menu under special abilities, which when used, calls a conversation via the script named in the spells.2da file. The conversation starts with the player and will eventually offer them choices about their style of play. (This part should be easy.) I did come across a couple of issues that are worth noting:
1) To make a conversation start in the old NWN1 style (not using cut scene mode), I needed to alter a variable from the conversation properties, which was not obvious the first time around, as the properties is reached by right-clicking on the conversation file name and opening a new properties window, and not from within the conversation itself.
2) There is a column in the feat.2da that says, "IsPersistent". I thought this was to do with allowing a feat to work across a campaign, but it turned out to be with activating the feat every time the player entered a new area or the module loaded. This meant my PC Options conversation was firing every time I started the module, which I did not want. My thanks got to Kaedrin for helping me find this out.