Author Topic: Using 2da Files Instead of Constants  (Read 9857 times)

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
Using 2da Files Instead of Constants
« on: April 15, 2008, 02:46:42 PM »
Bioware didn't bother to update the list of pre-defined constants in nwscript when they expanded the .2da files for epic levels in HotU. So, here is a quick run-down on how to use the 2da files to access the missing constants.

First, you must get access to the 2da files. While you can use NWN Explorer and dig around in NWN\data\xp2patch.bif under "Game Data" it's much easier to  just download the current full 2da source files from this link (at the bottom): Neverwinter Nights Miscellaneous Files.

Now to address this problem:
what i would like to know is, is it possible for standard nwnscript to handle adding up to 20 damage to an item? They dont seem to have the constants for a damage type of 20. While it also seems maxed at 10.

Open up iprp_damagecost.2da:
Code: [Select]
2DA V2.0                                                 
                                                         
           Name   Label    Cost   NumDice   Die    Rank   GameString    VFX
0          ****   Random   0      ****      ****   ****   ****          0
1          1035   1        0.15   0         1      1      ****          0
2          1036   2        0.25   0         2      2      ****          0
3          1037   3        0.5    0         3      4      ****          0
4          1038   4        0.75   0         4      6      ****          1
5          1039   5        1      0         5      8      ****          1
6          1040   1d4      0.25   1         4      3      58314         0
7          1041   1d6      0.4    1         6      5      58315         1
8          1042   1d8      0.65   1         8      7      58316         1
9          1043   1d10     0.75   1         10     9      58317         1
10         1044   2d6      0.85   2         6      14     58318         1
11         83572  2d8      0.95   2         8      17     83571         1
12         83592  2d4      0.75   2         4      10     83595         1
13         83590  2d10     1.75   2         10     19     83594         1
14         83591  1d12     1.5    1         12     12     83596         1
15         83598  2d12     2      2         12     20     83597         1
16         83585  6        1.25   0         6      11     84297         1
17         83586  7        1.50   0         7      13     84298         1
18         83587  8        1.75   0         8      15     84299         1
19         83588  9        2      0         9      16     84300         1
20         83589  10       2.25   0         10     18     84301         1
21         84251  11       2.50   0         11     20     84302         1
22         84252  12       2.75   0         12     21     84303         1
23         84253  13       3.00   0         13     22     84304         1
24         84254  14       3.25   0         14     23     84305         1
25         84255  15       3.50   0         15     24     84306         1
26         84256  16       3.75   0         16     25     84307         1
27         84257  17       4.00   0         17     26     84308         1
28         84258  18       4.25   0         18     27     84309         1
29         84259  19       4.50   0         19     28     84310         1
30         84260  20       4.75   0         20     29     84311         1
You only need to look at the first column which is the actual numeric value of the constant and the corresponding damage amount under the "Label" column.

For example the following three lines are the same code:
Quote
//Using pre-defined constants
ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGEBONUS_1d6);

//Using value from iprp_damagecost.2da
ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_ACID, 7);

//Using value from iprp_damagetype.2da and iprp_damagecost.2da
ItemPropertyDamageBonus(6, 7);

So, to make the damage 20 you'd replace the 7 in the above example with 30.

-420
« Last Edit: April 17, 2008, 01:48:00 PM by 420 »

Offline Ser Red Ronnet Connington

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • Email
Re: Using 2da Files Instead of Constants
« Reply #1 on: April 15, 2008, 03:19:14 PM »
Cheers I was using 40, thinking if 20 was giving me 10, then 40 would give me 20. Il try 30 now and it should work. btw what script handles the skill checks, such as hide vs spot, taunt vs conc?
« Last Edit: April 15, 2008, 03:34:39 PM by Ser Red Ronnet Connington »

Offline Ser Red Ronnet Connington

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • Email
Re: Using 2da Files Instead of Constants
« Reply #2 on: April 15, 2008, 04:00:59 PM »
How would one add mighty 20, to an item?

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
Re: Using 2da Files Instead of Constants
« Reply #3 on: April 15, 2008, 06:20:35 PM »
How would one add mighty 20, to an item?
ItemPropertyMaxRangeStrengthMod(int nModifier)

where the int is 1-20

I'll look into the skill checks and get back to you. I believe it is all hard coded but I'm not sure.

-420
« Last Edit: April 15, 2008, 06:24:55 PM by 420 »

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
Re: Using 2da Files Instead of Constants
« Reply #4 on: April 17, 2008, 01:47:00 PM »
btw what script handles the skill checks, such as hide vs spot, taunt vs conc?

I looked into this, turns out that those kind of skill checks are hard coded (meaning they are handled by the game engine and not by scripts). You may be able to intercept and alter the checks using NWNX.

-420

Offline Mo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3051
    • MSN Messenger - cochy@msn.com
    • View Profile
    • http://lucidmagic.net
    • Email
Re: Using 2da Files Instead of Constants
« Reply #5 on: April 17, 2008, 04:22:23 PM »
What a bunch of 1337hax0rs you two are.
« Last Edit: April 17, 2008, 05:39:33 PM by Mo »

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
Re: Using 2da Files Instead of Constants
« Reply #6 on: April 17, 2008, 05:26:59 PM »
What a bunch of 1337hax0rs you too are.
Teh 1337est!

-420