Nbane - Editing .2das and the talk table Explained



  • There are three different .2das that are relevant to the addition of a new class, with custom spells, and feats. These are:

    Classes.2da
    Feat.2da
    Spells.2da
    

    Most of what you find in a .2da is a statistic. What do I mean by this? Well, a prerequisite feat, for example might be required to take a custom feat of your design, it would go in the 'feat.2da' and the appropriate field would show this.

    Where do they get accessed from?

    The ".2das" go inside a hakpak. This hakpak should be both client and serverside. You need to add the hak via the 'Custom content' tab in the module as well, similiar to the method to adding the TLK See 1e)(discussed in this first lesson . The TLK goes in the TLK folder in "C:NWN/tlk" the hakpak in the "C:/NWN/Hak" folder. if these don't exist, its okay to simply create a new folder with the afforementioned name.

    These .2das are all inter-related, and 'hook' into each other in some regard or the other. Take as an example, a custom spell such as 'Astral Projection', there is a field, in the 'classes.2da' called 'spellID' which 'hooks' into a script within your custom module. (CoA)
    But anyway, I digress, this is getting a bit ahead of ourselves!-

    Now, moving on, most of what is in a .2da will speak for itself, but some fields within a .2da have very little support online and can be daunting, even on the nwnwiki page (Which is still an essential resource incidentally). An example of this might be the fields that relate to the 'talk table', on this wiki for class.2da, we'll begin our lessons from this starting point in fact, with the creation of a new custom class and go from there. Feel free to shoot me a PM on IRC (Nick "Nbane") If I'm unclear anywhere, or you need some advice.

    APPROACH
    I am recommending with regards to CoA's hak addition, you take what is known as an 'Additive' approach. This means starting with a blank slate, and adding to it as you go along. This does not mean you will be unable to put in custom resources, like custom creatures/placeables etc) that you find on the nwvault, it simply means you will not have any clutter from any other .2das lying around you are unaware of.

    RESOURCES
    1a)
    In your "C:NWN/" folder you should have a zip file called "2dasource". This contains all the .2das that are a part of NWN as standard. By unzipping it with 7zip or winzip, pull out the file named "Classes.2da". Open it up in notepad or wordpad, and you can see some pretty familiar things, things you'd expect for the 2da on classes.

    This website is essential in breaking down the fields for a class, feat, or even a custom spell….

    http://nwn.wikia.com/wiki/Classes.2da
    

    One of the tools we'll HAVE to use is a tlk editor: (Note: I personally recommend this one)
    1b)

    http://nwvault.ign.com/View.php?view=Other.Detail&id=1295
    ```WARNING- DO NOT DOWNLOAD THE 'AXE MURDERERS TLK EDITOR' off the nwvault. It is a VIRUS, likely made by a disgruntled bioware employee, and is a nasty one at that.
    
    I'm going to follow this up with lessons as I go, in this first post- okay,
    
    **LESSON 1**
    **ADDING THE THAYAN KNIGHT CLASS**
    1c)
    Okay firstly in the last line of the afforementioned "Classes.2da" there is a line for purple dragon knight, with an ID of 41\. We'll start by adding a 42 right after it for our new, custom class the 'Thayan Knight':
    
    

    41 Purple_Dragon_Knight 111710 111711 111712 111713 ...

    
    in fact, lets have a look there, the spacing between each item and field is handled with the space bar, don't use tab if you can avoid it in fact. The first field there is the label field. Now dont worry too much about this, its just for human eyes, so we can distinguish numbers 41 from 42, so it should be pretty obvious what goes in there for our 'Thayan knight' Thats right! "Thayan_Knight".
    
    -Remember earlier i mentioned a 'Talk' Table? well. Thats what these first four fields relate to on the classes.2da believe it or not.
    
    

    "Name Plural Lower Description "

    111710 111711 111712 111713 ...

    I found the talk table quite confusing at first. But it helps to understand the point behind somethings existence in programming or math, then you can get a greater understanding- So, what _is_ the point of a talk table?
    
    _"A TLK or TALK table is a list of strings, listed by number. "_
    
    Computers dont speak our language. They speak numbers, and in fact, they are good at it! much faster at it! So, when a computer has to store a lot of sentences, for example for conversations, or any dialogue at all that might be said in game, its better to use numbers, for memory purposes- Thats why when we have something like :
    
    

    Druids are divine spellcasters who receive their spells from nature, not the gods. They strive to live in harmony with the natural world, and hate anything that is not part of the natural cycle, especially aberrations and undead creatures. As they gain experience, they learn to take the shapes of animals and eventually of more powerful creatures. The strict oaths taken by every druid prohibit using weapons and armor outside their tradition.

    WARNING: To cast a spell, a druid must have a Wisdom score of 10 + the spell's level. For example, to cast a 4th-level spell, a druid must have a Wisdom of 14.

    • Alignment Restrictions: Must be neutral good, lawful neutral, true neutral, chaotic neutral, or neutral evil.
    • Hit Die: d8.
    • Proficiencies: Proficient with druidic weapons, as well as light and medium armor and shields.
    • Skill Points (*4 at 1st level): 4 + Int Modifier.
    • Spellcasting: Divine (Wisdom-based, armor-related chance of spell failure is ignored).
    • Ex-Druids: A druid who is no longer neutral cannot gain levels.
    Quite a lot of text, right? So see why its better to have it pre-loaded into memory, and -that- my friend is what a talk table does! This entry for a druid description for example, is line 243, in the classes.2da… In fact, why not have a look in there just now? See if you can find it-
    
    

    3 Druid 6 7 4893 243

    Find it okay?
    
    yep, line 3, in classes.2da under 'Druid' right at the end there, the number 243…. That fourth field. 'Description'. It refers to the part that appears, say, when a character is choosing their class when they are creating/levelling up their character. The other three fields also have an ID which relates to the words so! without further adieu! heres our Thayan Knights first four fields to be entered into our custom TLK table:
    
    

    "Thayan Knight"

    "Thayan Knights"

    "thayan knight"

    "The thayan knight is a fierce warrior, who follows his masters order without question.

    • Alignment Restrictions: lawful neutral, chaotic neutral, or neutral evil.
    • Hit Die: d8.
      -etc.
      "
    So How do we enter a new field into the TLK?
    
    Here's the URL for the tool for editing from 1b):
    
    

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

    The standard tlk table, will not be found in that wee "2dasource.zip" file. You need to take a different approach to this one, by going into your "C:/NWN/" folder, and copying the file there called "Dialog.tlk" Keep this copy safe, as its a standard resource for NWN-
    1e)
    Once you've copied the dialog.tlk into wherever it is your keeping all your custom files for your hakpak- Rename it, I don't know, "CoA_TLK" or something. Its not really important, what -is- important, is that within the CoA Module itself, you select the TLK as the one you will be using from within this part (highlighted in red, in diagram):
    
    ![](http://i679.photobucket.com/albums/vv158/NightsBane666/aaaaaaa.png)
    
    You can navigate here by going to Edit>Module Properties>Custom Content[tab]
    
    So. To end this lesson, lets simply Open up the TLK from the editor. And put in some custom entries for our class. Thayan Knight. or whatever you think is relevant. The next parts will get easier. Anyway. I'll post lesson 2 here soon. and we'll give our guy some base Ab and things like that.
    
    –----------------------------
    **Notes:**
    remember, the nwnwiki does have -some- useful bits there that relate to the fields, so heres that URL again:```
    http://nwn.wikia.com/wiki/Classes.2da
    ```But i think these first four fields are pretty self explanatory once you wrap your head around the reason for doing it. Such as plural for the plural, 'lower' for lower case…etc.
    
    **LESSON 2**
    **ADDING THE THAYAN KNIGHT CLASS (continued)**
    
    **Recap:**
    
    We've learned what a TLK table is. How to open/edit a TLK. The first four fields of our classes.2da and how to edit them.
    
    2a)
    
    Lesson 2 will continue with the following fields set for our Thayan Knight class(after number 41, Purple Dragon knight):
    
    _42 Thayan_Knight 112010 112011 112012 112013 IR_THAYKNIGHT 10_
    
    I'll run through the first four fields again for a quick recap; The numbers relate to the ID's in a Tlk table. 112010 is the index number for the 'flagged' text, which is edited from the tlk program. So in the four fields here, highlighted in red, is also representated in the tlk table, which is done by adding entries and surprise surprise, the numbers should match!
    
    _42 Thayan_Knight 112010 112011 112012 112013 IR_THAYKNIGHT_
    
    This next bit, highlighted in red here, is representative of the name of a simple ".tga" format of an image file. i.e) An image, this is the image that appears as an icon for the class/feat/skill/spell, or whatever it will represent- In this case, the icon for our custom "Thayan Knight".
    
    Adding an image is as simple as importing it into our custom hakpak. It should be a .tga file. It should be 32x32 in size. it can contain an alpha layer too. It can then be referenced by any .2da.
    
    The next bit. highlighted:
    
    _HitDie AttackBonusTable FeatsTable SavingThrowTable SkillsTable BonusFeatsTable
    12 CLS_ATK_1 CLS_FEAT_BARB CLS_SAVTHR_BARB CLS_SKILL_BARB CLS_BFEAT_BARB_ 
    Is the number of hitpoints rolled when a character gains a level in this class. 12 should be fine for our knight: Next, The Attack Bonus table:
    
    _HitDie AttackBonusTable FeatsTable SavingThrowTable SkillsTable BonusFeatsTable
    12 CLS_ATK_1 CLS_FEAT_BARB CLS_SAVTHR_BARB CLS_SKILL_BARB CLS_BFEAT_BARB_ 
    
    This is where you get your first taste of a ".2da" within a ".2da". The following format is the format for what I am referencing here:
    
    

    http://nwn.wikia.com/wiki/Cls_atk_*.2da

    You might not want to really edit this field, or at least its unlikely, you will probably stick to the three main staples of AB bonus table's, which are 1/2 such as Rogue, or full, such as Fighter. "CLS_ATK_1" suits our purposes for our Thayan knight. But if you want a level 9 Thayan Knight to get an extra AB when he has 9 levels in the class, this is where you'd do it. The next section deals with a slightly more detailed version of this "2da" within a "2da" idea:
    
    _HitDie AttackBonusTable FeatsTable SavingThrowTable SkillsTable BonusFeatsTable
    12 CLS_ATK_1 CLS_FEAT_THAYKNIGHT CLS_SAVTHR_BARB CLS_SKILL_BARB CLS_BFEAT_BARB_ 
    
    The first field here, relates to Class specific Feats. It is not a totally unwise idea to have a peek inside one of the standard .2das that relate to this section, for example cls_feat_barb.2da relates to the standard "Barbarian" class within NWN (remember you can get all the base line 2das from within your 2dasource.zip file in C:NWN)
    
    Get a handle on the part that relates to the "List" and "OnMenu" fields that are in here, in this separate .2da. Don't worry too much, I can tell you what you need depending on your purpose, but there comes a point, where looking up the fields in the nwiki will become essential. Search for ""cls_feat_*.2da" to get a grip on it. I will for the purposes of this tutorial, stick to classes.2da, but it won't hurt you to have a peek.
    
    **Notes:**
    "cls_feat_*.2da" will (to add a little confusion into the matter) reference to the "feat.2da" in its field "featIndex"… the point here is to handle the whole matter in a modular fashion, so we'll deal entirely with the classes.2da, and eventually you will get the bigger picture... In fact... It'll get more confusing if you let it- (Just wait till we deal with Skills/feats that branch into other feats... ) such as "Skill focus : XXXX".
    
    Heres the link for the "feat.2da" on the wiki.
    
    

    http://nwn.wikia.com/wiki/Feat.2da

    This "Feat.2da" is the other big fellow.. like i mentioned, there are lots of .2das, all relating to NWN mechanics- But our big three to recap what was said right at the beginning (Of lesson 1!) are:
    
    

    Classes.2da
    Feat.2da
    Spells.2da

    Okay, so now that we've established that the "CLS_XXX_*" tables in the previous example are other .2das, we can move on to more statistical things within this 2da. Remember, still working in the "classes.2da"!
    
    _SkillPointBase SpellGainTable SpellKnownTable PlayerClass SpellCaster_
    
    The SkillPointBase field is the number of skill points gained every level (Excluding level 1, and before INT modifier), so 4 should do for our Thayan Knight chap.
    
    _SkillPointBase SpellGainTable SpellKnownTable PlayerClass SpellCaster_
    
    These two are 2da's within this 2da as well! so lets move on!
    
    _SkillPointBase SpellGainTable SpellKnownTable PlayerClass SpellCaster_
    
    The PlayerClass field is a boolean value (1 or 0) denoting whether the player can choose this class, or whether it is reserved for NPCs. Such as "Ooze"! since a PC is unlikely to be an ooze.
    
    _SkillPointBase SpellGainTable SpellKnownTable PlayerClass SpellCaster_
    
    The SpellCaster field is a boolean value (1 or 0) denoting whether the player class will be a spell caster, so a Sorceror or Bard would have 1 in here, so can you guess what our Thayan knight will have? Thats right! "Zero"! since he won't cast spells.
    
    –---------------------------------------------------------------
    
    The following:
    _Str Dex Con Wis Int Cha PrimaryAbil AlignRestrict AlignRstrctType InvertRestrict_
    
    Are fiarly self explanatory when you have a wee browse over the other classes. So we'll just move onto the next part which is much more fun!
    
    _Str Dex Con Wis Int Cha PrimaryAbil AlignRestrict AlignRstrctType InvertRestrict_
    
    These fields are a Hexadecimal value, and are "Bit Fields" (Basically just a whole number, but in a different format), heres a description of the bit field on the wiki :
    
    

    http://nwn.wikia.com/wiki/Bit_field

    For a Thayan Knight, we will expect them to be lawful and evil, of course, this is just an example, and an opinionative one at that, but a good template will be our assasin/blackguard values, which will enforce 'said' alignment. These are:
    
    _AlignRestrict AlignRstrctType InvertRestrict_
    _0x09 0x2 0_
    
    The field values are those hex numbers i mentioned, and I would just be rehashing the wiki here, so I'll just tell you unless you want specific alignments that aren't already in nwn, you won't need to get into this bit too much, just use the other classes as a template.
    
    _]AlignRestrict _AlignRstrctType InvertRestrict_
    _0x09 0x2 1_
    
    I don't really need to go over this bit, but i like what it does, so I'm gonna talk about it! - Inverting is used to 'flip' the alignment restriction values. The druid class is an example of this enforcing its neutral bias by inverting the standard "0x00 0x0" values, but as I say, this is really just me showing off a bit! Its pretty unlikely you'll need to invert.
    
    _Constant EffCRLvl01…02...03..._
    _CLASS_TYPE_THAYKNIGHT 1_
    
    The field name "Constant" refers to the constant variable that is used in the custom (CoA's) module specifically for scripting purposes. As an example "CLASS_BARD" rather than "1" (value of that constant) serves a purpose, its really just so when we're scripting we don't have to look up a numeric value, or remember it, and so its for the benefit of human eyes we put this value in here.
    
    _Constant EffCRLvl01…02...03..._
    _CLASS_TYPE_THAYKNIGHT 1…X...X..._
    
    The CR Rating is the challenge level that appears, such as "Impossible". Its a sliding scale, and you shouldnt worrry -too- much about it.
    
    **Extra work:**
    
    Heres the link for creating a new Cls_feat_Thayknight.2da,
    

    http://nwn.wikia.com/wiki/Cls_feat_*.2da



  • Big thank you to Nightbane for putting together this post and looking forward to more lessons in the future



  • My question is simply, who needs to have the custom 2da and tlk files? Must it be on both player and server machines to function? Or only to start with a base class at level 1?



  • The ".2das" go inside a hakpak. This hakpak should be both client and serverside. You need to add the hak via the 'Custom content' tab in the module as well, similiar to the method to adding the TLK. The TLK goes in the TLK folder in "C:NWN/tlk" the hakpak in the "C:/NWN/Hak" folder. if these don't exist, its okay to simply create a new folder with the afforementioned name.

    Added into original lesson plan.



  • Oh! I just noticed what you put about starting at level 1, yes, it will be in there with the character creation screen, providing the Hakpak is installed on the client machine, otherwise they will get an error message, if they do not have the hakpaks your (CoA's) module is using.

    it is also worth noting, that providing you start as i advise, with the "2dasource.zip" stuff, you will ensure that any 'normal' classes, such as FIGHTER/DRUID/CLERIC/…etc) that are already in the vault will still be able to log in as they have done before the implementation of the hak. The key word here is ADDITIVE. An additive approach is wise.

    You'll also be able to give the class to any NPC you like in the module. So your Thayan Wizard NPC will also have access to the spells etc the custom PC will have.



  • Thats good news, that way players will be able to login into the server without needing the hak.



  • no no, if you want them not to have the hak, and for changes you make to be optional, you need to make an 'Override', thats different. There are certain things that you won't be able to add, like 3D models and icons..



  • @NIGHTSBANE:

    no no, if you want them not to have the hak, and for changes you make to be optional, you need to make an 'Override', thats different. There are certain things that you won't be able to add, like 3D models and icons..

    We can actually run it so they don't need the hak. We over came that problem using the NWNx plug in.



  • Oh! I see! So they download the content when they are joining your server like how NWN2 uses a portal to give them custom content? Neat.



  • @NIGHTSBANE:

    Oh! I see! So they download the content when they are joining your server like how NWN2 uses a portal to give them custom content? Neat.

    No, they just don't need it.

    Our server is already running a hak, the players just do not need to have it to log in anymore.



  • Heres a teaser you could post :



  • Hm. I like this.


Log in to reply