LucidMagic.net

Neverwinter Nights => NwN Building => Script Request => Topic started by: 420 on April 15, 2008, 02:46:42 PM

Title: Using 2da Files Instead of Constants
Post by: 420 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 (http://nwvault.ign.com/View.php?view=Other.Detail&id=248) 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 (http://nwn.bioware.com/downloads/misc.html).

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
Title: Re: Using 2da Files Instead of Constants
Post by: Ser Red Ronnet Connington 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?
Title: Re: Using 2da Files Instead of Constants
Post by: Ser Red Ronnet Connington on April 15, 2008, 04:00:59 PM
How would one add mighty 20, to an item?
Title: Re: Using 2da Files Instead of Constants
Post by: 420 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
Title: Re: Using 2da Files Instead of Constants
Post by: 420 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 (http://www.nwnx.org/).

-420
Title: Re: Using 2da Files Instead of Constants
Post by: Mo on April 17, 2008, 04:22:23 PM
What a bunch of 1337hax0rs you two are.
Title: Re: Using 2da Files Instead of Constants
Post by: 420 on April 17, 2008, 05:26:59 PM
What a bunch of 1337hax0rs you too are.
Teh 1337est!

-420