Choose Your Language

Saturday, 11 April 2009

SoZ Crafting - Avoiding Trade Items

UPDATED (13th April): In the light of this forum post, I did some further experimentation with kinc_crafting (which I eventually found) and can now recommend the following structure for basic crafting. i.e. When not requiring TRADE ITEMS.

First of all locate kinc_crafting.NSS in the SoZ expansion campaign folder. Open this with a basic text editor (like notepad) and copy the script into the toolset as a new script and name it the same. i.e. kinc_crafting (without the NSS suffix). The only other file you require (to make this script compile correctly) is kinc_trade_constants, which can be located in the same way as described above for the previous script. Again, copy and paste the script into your own module, keeping the same name.

Open your kinc_crafting script and add the include line for the kinc_trade_constants file. i.e. Add the line #include "kinc_trade_constants" just below the other include files mentioned in the kinc_crafting script. Lastly, add the #include "kinc_crafting" include line inside your own On Module Activate script, which will also contain the modified script as mentioned in this blog post.

Using the kinc_crafting include file instead of the kinc_trade bypasses the check for TRADE GOODS. However, you may still like to replace these goods (as described in the original post below) so that the player still has to acquire ingredients similar to the original TRADE GOODS. If you do, simply carry out the instructions below, but now without the need to delete the COST_GOODS and COST_RARERES columns first.


I thought I would share a couple more things with fellow builders with respect to crafting using SoZ code. First of all, if you have tried opening the nx2_crafting.2da file, you will have probably found that it has errors that prevent it from opening in some 2da editing programs. For those interested, here is a FIXED FILE that you can download. This file is required for those who may wish to edit it to either add or change those recipes that are available in the game.

In particular, you may wish to remove any references to TRADE ITEMS required to craft items. These items appear under the COST_GOODS and COST_RARERES columns and refer to TIMBERS and INGOTS. For basic crafting, you will NOT want these columns to contain references to any items, but want to add items (replacing these trade goods) with specific ingredients to the COST_ITEMS column instead.

E.g. In rows 97 and 98, I have removed the GOOD_TIMBER reference from the COST_GOODS column and added specific tags representing the planks instead. (See screenshot.) Now, when the code checks for the items required to make the different types of poisonous arrows, it will not fail when checking for TRADE ITEMS (which we don't want in a basic crafting system), because they are no longer listed, but will require specific planks of wood instead. In our example, I have made the requirements a Zalantar Plank for mild poisonous arrows and a Shedderan Plank for poisonous arrows.

Continue to remove unwanted TRADE ITEMS from their respective columns and add appropriate planks of wood or ingots as required. In this way, you can keep all the recipes that can be found and make use of basic crafting items rather than have to rely on the TRADE system.

Just for your information, I have also discovered a number of errors with respect to items required for the crafting (in the 2da file), descriptions of such (in the recipe description), and even in the resulting item itself (item object). As an example, these two lines that supposedly make two different types of arrows, actually make an arrow with the same qualities! Of course, it is easy enough to add or alter the properties on the arrows and make a new campaign item (that will be created instead), which is what I have done. Just remember to ensure you have the name, resref and/or tag set exactly as the 2da file requires or the item will not be made.


Wyrin said...

the crafting pointers you've been posting have been really handy

BTW I still get the number of columns mismatch on the 2da you linked to...

Lance Botelle (Bard of Althéa) said...

Hi Wyrin,


By the way, I double-checked the file and it opens fine in both the toolset and my 2da editor. Are you sure you are opening the correct one?

Make sure you place the 2da into your override *before* you open the toolset and then try opening/viewing nx2_crafting.2da from the toolset. You should not have any problems.

It sounds like you may still be accessing the original by mistake.

Let me know, and if it still fails, email me the copy you are trying to open and I will check it to see if it is the file itself or a difference between us.

The email requires every part of the above line, including the email and underscore part.


Wyrin said...

not sure why it was playing up - altered it in Ecel and it was fine. I was using tlkedit2 rather than the toolset- might be why...?

anyways, got it working and have removed all references to goods/resources. Does mean i have to make sure the overland map encounter loot drops are working properly tho...

Lance Botelle (Bard of Althéa) said...

Hi Wyrin,

That may have been the reason. I also use "NWN 2da Editor version 1.11" and it opens fine in that as well as the toolset. As long as it opens in the toolset at least, then I figure that is OK, as most people can edit the 2da from there if they need to.

Did you read the update for this post? If you use just kinc_crafting along with the kinc_trade_constants, then you only need to add ingredients as required rather than delete the trade goods columns. The reason being, kinc_crafting does not check the trade goods columns in the 2da check.

I have not checked the overland map drops, but I have recognised and added a script that ensures creatures have a given chance to drop parts upon their deaths for those with the alchemy skill.

Regarding the overland map, you may be moving into an area I have not looked at with respects to crafting. The parts I have checked are simply if the player can pick up certain parts and use them at a given workbench to create items. I would assume that picking up parts on the overland map is a seperate issue, unless it relates to the TRADE system somehow, which you would know more than I.

Let me know if I have misundertood. :)