Creating new craftable items
#1
Posté 01 février 2014 - 02:20
Basically, I've decided to create a mod that's based around crafting. Therefore, I'm hoping to be able to do things like such:
- create specific enchantments that result from gem/essence combinations (ex: diamond + weak fire essence on sword adds 1d6 fire damage, but on half plate adds 5 fire resistance)
- create new materials such as metals/wood that add bonuses to equipment when crafted (similar to darksteel giving +1 electrical damage)
I tried out Lilac's Script Generator to see if I could do something with its Blacksmith / Item Forge Script, and while the script compiled successfully, when I tested it in game, it seemed to only partially work. In my case, I attached the script to On Spell Cast At on a magician's workbench, required 1 diamond and 1 weak earth essence (with the appropriate tags) to be in the workbench, and the Barkskin spell to be cast on the workbench with the items inside. The spell consumed only the diamond and left the earth essence, and did not provide the item I wanted to create (specified the ResRef correctly in the script).
Has anyone had any success with this, or is there a better way to go about it? For the record, I'm not planning on using SoZ crafting at the moment.
#2
Posté 01 février 2014 - 04:08
you might not like the answers, and i know it's only my perspective, so here goes
o.0CPK87 wrote...
Basically, I've decided to create a mod that's based around crafting.
first mod? OC-style crafting is *very* intricate.
These sound very doable, but my memory tells me they might require indepth .2da edits, and possibly even a change or two to the core crafting script (esp. for the 2nd example; the first probly involves only additions to the crafting .2da and its index .2da).- create specific enchantments that result from gem/essence combinations (ex: diamond + weak fire essence on sword adds 1d6 fire damage, but on half plate adds 5 fire resistance)
- create new materials such as metals/wood that add bonuses to equipment when crafted (similar to darksteel giving +1 electrical damage)
While i didn't mod NwN crafting, I seem to recall that IG the two systems are quite different. Lilac's likely won't handle NwN2 crafting...I tried out Lilac's Script Generator to see if I could do something with its Blacksmith / Item Forge Script, and while the script compiled successfully, when I tested it in game, it seemed to only partially work.
Kaldor knows more than me about SoZ crafting. What I can say after more than 100 hrs. of OC-style craft modding isHas anyone had any success with this, or is there a better way to go about it? For the record, I'm not planning on using SoZ crafting at the moment.
- one of the devs/scripters, ChazM, put out a module just for doing craft edits, Crafting.mod.
Now, personally i bypassed it after checking it out, in favor of doing things manually because I went straight for the balanced / rebalanced versions of OC-style crafting, which don't rely on the main goal of ChazM's module,
which is to output
Modifié par kevL, 01 février 2014 - 06:51 .
#3
Posté 01 février 2014 - 04:13
#4
Posté 01 février 2014 - 04:35
to create a new recipe (using old materials, just with new components ie. gems+essences and spells)
you have to find the spell section in Crafting.2da (all spells that're used for various recipes need to be grouped together in the .2da)
Add a line there (the spell# will ofc be its reference in Spells.2da). Add the components in case-sensitive alphabetical order <- that really screwed me up for a while [edit: with (A..Z) before (a..z)]. Fill in the rest of the lines, blah blah.
Finally go to Crafting_index.2da. Find the spell#. Increment the reference to Crafting.2da in the *successive* lines that follow, such that they refer to the new, displaced lines in Crafting.2da
Ps. am feeling pretty sure that adding molds & stock materials like woods & metals requires changes to the scripts.
Modifié par kevL, 01 février 2014 - 10:47 .
#5
Posté 01 février 2014 - 07:20
If I could, I'd use the Legends crafting system, which does mining, skinning, leatherworking, blacksmithing, and more, but it's designed for a PW, and I'd have to make some modifications to get it to work for a single-player module.
#6
Posté 01 février 2014 - 07:50
I don't want to create an entirely new system, but rather create new items using the existing system. So an enchantment would still use a gem and an essence like in the OC, but it would be a different gem/essence combination and put a different effect on the item. I didn't think it would be too drastic of a change, although I expected that I would have to learn to modify 2da files at some point.
kevL, I'll take a look at those, thanks. Hopefully once I get the hang of how the 2da files work, it should be smoother from there. They don't seem much different than massive Excel sheets anyway - tedious but not necessarily complicated. And the only reason I want to create new materials is to add different stat bonuses - instead of +1 electrical damage from darksteel, for instance, it would give +3 AB. Technically I wouldn't have to create "new" materials, I could modify the stat bonus from existing ones instead. The whole reason I want to change the enchantment effects is because I am creating a quest that focuses entirely around item progression, with no experience gain or leveling up. Therefore I need to re-balance the current crafting to match what I'm trying to do.
#7
Posté 01 février 2014 - 10:27
i just popped open Crafting.2da. It's been a while, the EFFECTS column is the most difficult to get a handle on; the numbers refer to various 2da's iirc.
There's really only a few scripts, plus a few functions in 'ginc_crafting' that are used. (but some of the helper functions are a nightmare to follow, i found)
with the caveat that I'm not looking at the original scripts here, you'll probably find yourself having to
If you need a hand i'm willing to look into specific questions,
Modifié par kevL, 01 février 2014 - 10:37 .
#8
Posté 01 février 2014 - 12:31
ColorsFade has custom crafting in his campaign, perhaps he might be able to shed some light on your questions CPK. I don't know though if his crafting adds properties to your existing equipment, or simply gives you a nice item if you have the materials. Also, it happens through dialogue and not on a bench I think. Maybe it's important?
#9
Posté 01 février 2014 - 04:52
Of course, if you're going to do it through dialogue, as you say Andy, then there's really no restriction, because you're not using the same system, and are essentially doing it all manually, like the hunting/cooking system does.
Modifié par Tchos, 01 février 2014 - 04:54 .
#10
Posté 01 février 2014 - 06:26
Eg. an EFFECT in the .2da looks like this: 23,6,2,0,0. Those are references to a series of .2das: which ones.
yes, The simplest recipes simply output items from blueprints. And one of the reasons for ChazM's mod is to keep Crafting.2da in sync w/ Crafting_index.2da
On the other hand, a dialog that checks if PC has two items and if so removes them and creates a third is ... not like this.
in addition to keep the two .2da's in sync, the recipes have to be kept grouped according to the trigger-spell used.* Can't just put new recipes at the bottom, and if mr.CPK wants to reuse lines it will make things much easier. First find the group of a spell, in Crafting.2da, that you'd want to use ... (if that group already exists ofc)Tchos wrote...
Something about things having to be in an unintuitive order, like perhaps new items can't be at the bottom, and so the mod does the arrangement work for you.
on the easy side, it looks like adding new (or changing) materials won't require changes to scripts (unless *maybe* if using one of the advanced craft extension add-ons)
* or perhaps the mold-tag in the case of mundane crafting, or .. technically recipes have to be grouped according to a string, that might represent a Spells.2da entry, a mold-tag, or a defined string-constant like "ALC" for Alchemy recipes, etc.
Modifié par kevL, 01 février 2014 - 06:41 .
#11
Posté 01 février 2014 - 07:13
after a few more glances, it looks relatively simple to change say Darksteel from +1 electrical to say +3 AB.
in Crafting.2da
- find the appropriate mold-entries grouping under CATEGORY
- find the correct REAGENTS line(s) within that grouping
- change the OUTPUT, to either an existing or custom blueprint-resref of the desired item w/ +3AB
- leave SKILL at "26" => Craft Weapon
- adjust the LEVEL (ranks of SKILL) needed
#12
Posté 01 février 2014 - 07:24
kevL wrote...
CPK:
after a few more glances, it looks relatively simple to change say Darksteel from +1 electrical to say +3 AB.
in Crafting.2da
- find the appropriate mold-entries grouping under CATEGORY
- find the correct REAGENTS line(s) within that grouping
- change the OUTPUT, to either an existing or custom blueprint-resref of the desired item w/ +3AB
- leave SKILL at "26" => Craft Weapon
- adjust the LEVEL (ranks of SKILL) needed
I figured as much, thanks for confirming that for me. I can probably afford to modify existing lines in the .2DA's because I don't plan on making any of the original recipes viable for this mod. That way I shouldn't have to mess with the order of things in the 2DA, if I'm understanding correctly. I wish I could get into the IRC channel to discuss it on there, it would certainly make understanding this easier. I am guessing that I'll need to create copies of the existing .2DA files that I need and put them in the Campaigns folder under My Documents? I don't want to break anything in the existing game if I can help it!
#13
Posté 01 février 2014 - 07:28
( i haven't tried those .2da's in the campaign folder myself, only in \\Override but should work ok )
The originals in the installation folder ought be very secure this way.
#14
Posté 01 février 2014 - 07:31
that'd wipe out all standard crafting and keep things manageable...
* and Crafting_index.2da, wiped clean at first
[edit] you'd have to maintain the Crafting_index.2da yourself if you do this.
But the index is a very small simple, straightforward file anyway,
Modifié par kevL, 01 février 2014 - 07:42 .
#15
Posté 01 février 2014 - 07:48
If I'm understanding correctly, isn't that what I am doing by copying a duplicate of the file into my mod's campaign folder? Or do you mean just wipe everything out entirely from that duplicate file and fill it in myself? I'd be afraid that that would mess up the order stuff needs to be in to work.
#16
Posté 01 février 2014 - 07:54
not once you understand how the index file works.CPK87 wrote...
kevL,
If I'm understanding correctly, isn't that what I am doing by copying a duplicate of the file into my mod's campaign folder? Or do you mean just wipe everything out entirely from that duplicate file and fill it in myself? I'd be afraid that that would mess up the order stuff needs to be in to work.
ok, hopefully you've grasped that entries in Crafting need to be grouped according to a trigger (spell, mold-tag, "ALC", etc)
The scripts, to prevent having to iterate through the entire Crafting.2da, first check the index and get the beginning entry. Then it iterates through *only that group* to find if the correct reagents are present in the workbench.
So the index contains only two things:
1. the CATEGORY to search through (spell, mold-tag, "ALC", etc)
2. the beginning entry line in Crafting.2da
get it?
#17
Posté 01 février 2014 - 08:07
Edit: Just double-checked and realized I made a mistake there - the category number does in fact refer to a specific spell.
Modifié par CPK87, 01 février 2014 - 08:28 .
#18
Posté 01 février 2014 - 08:20
If you ... notice that the recipes those refer to use different spells ... I suggest ye notice again!
but i am willing to be shown wrong.
#19
Posté 01 février 2014 - 08:28
#20
Posté 01 février 2014 - 08:31
oh, i just want to remind you that
Add the components in case-sensitive alphabetical order <- that really screwed me up for a while [edit: with (A..Z) before (a..z)].
iirc
Modifié par kevL, 01 février 2014 - 08:31 .
#21
Posté 01 février 2014 - 08:35
#22
Posté 01 février 2014 - 10:17
- The 1st determines the type of item prop it is, which is referred to in itempropdef.2da.
- The 2nd determines the sub-type of the item prop, like sonic damage for the damage reduction prop. The file the subtype exists in is specified under IPRP_Abilities in itempropdef.2da.
- The 3rd seems to represent the value of the prop, but I'm not sure if there's a .2da file for this.
I'm still not sure about the 4th and 5th ones. Most of them are just 0, but some of the 4th ones are 10 or 24, and there is only one enchantment where the 5th is a 1 instead of a 0, and it seems it's a bugged enchantment. Any ideas what these last two numbers might represent?
Also curious about what the TAGS tab means, which is always either a 2 or a 1, right before the EFFECTS tab.
#23
Posté 01 février 2014 - 10:49
give me a minute or 35
#24
Posté 01 février 2014 - 11:50
This is what the doc says:
+-------+---------------
| E | EFFECTS
+-------+---------------
An encoded effect. The first number represents the itemproperty to apply, the folllowing numbers are the parameters specific to that function.
See script x2_inc_itemprops for the mappings between constants and specific ItemProperty functions.
Recipes may only have EFFECTS or OUTPUT, not both
5 params, the 1st one is most important, refers as you say to Itempropdef.2da (although i get this confused with Itemprops.2da)
note: Refers to one of about 100 constants defined in nwscript.nss (core hardcoded constants/functions) as int ITEM_PROPERTY_*
From Itemprop.def, go to column SubTypeResRef -> that's the name of the .2da used to reference the 2nd param. For example, my first entry in Crafting has EFFECTS "23,6,2,0,0"
23 = DamageResist, w/ SubTypeResRef = IPRP_DAMAGETYPE
Go to Iprp_damagetype.2da:
6 = Acid resistance
Now make the guess that the 3rd param refers to Iprp_resistcost.2da, where
2 = 10 resistance
So "23,6,2,0,0" means 10 damage resistance vs acid.
The zeros in there are probably unnecessary and the EFFECT could be written as "23,6,2" (but that's a guess based on the fact that a few other EFFECTS look that way)*. If there were more effect-params, like "48,14,3,13,0" that means more values are needed to fully define the itemproperty.
48 = OnHit, IPRP_ONHIT.2da
14 = Silence
-> guess IPRP_ONHITDUR.2da
3 = 50%
Now go haywire and cheat by tracking down the function that applies the effect:
itemproperty ItemPropertyOnHitProps(int nProperty, int nSaveDC, int nSpecial=0); // SILENCE :nSpecial is the duration/percentage of effecting victim. // constant(IP_CONST_ONHIT_DURATION_*)
14 = nProperty = IP_CONST_ONHIT_SILENCE
3 = nSaveDC (i find this hard to believe..)
13 = nSpecial = IP_CONST_ONHIT_DURATION_25_PERCENT_1_ROUNDS
Ok! next up: TAGS
* I'd leave the zeros in, in case they refer to row#0 sometimes.
Modifié par kevL, 01 février 2014 - 11:53 .
#25
Posté 02 février 2014 - 12:37
TAGS looks like it refers (directly or indirectly) to Baseitems.2da, with constants defined in nwscript.nss+-------+---------------
| D | TAGS
+-------+---------------
The items that can be affected
This will either be a number representing an Item category or a list preceded with a "B" indicated a list of Base Item Types
in other words you can specify a recipe that takes hold only on a weapon, eg.
'ginc_item' defines the constants, -1 meaning ANY (although 12 looks like it works kinda the same, by including several types into one). I'll list them but like anything NwN2, testing is needed.
// item categories - weapon, armor/shield, other const int ITEM_CATEGORY_ANY = -1; const int ITEM_CATEGORY_NONE = 0; const int ITEM_CATEGORY_WEAPON = 1; const int ITEM_CATEGORY_ARMOR_SHIELD = 2; const int ITEM_CATEGORY_BOW = 3; const int ITEM_CATEGORY_XBOW = 4; const int ITEM_CATEGORY_SLING = 5; const int ITEM_CATEGORY_AMMO = 6; const int ITEM_CATEGORY_MISC_EQUIPPABLE = 8; // amulet, ring, cloak, etc. const int ITEM_CATEGORY_OTHER = 9; // everything not armor & weapons const int ITEM_CATEGORY_RANGED = 10; const int ITEM_CATEGORY_GLOVES = 36;// <-- kL, SHOULD THIS BE "11" ... for crafting esp. What 36! see Attack Bonuses ipType #56 // Recipes in 'crafting.2da' for gloves ( i believe ) use "11" in Col_TAGS // derived item categories const int ITEM_CATEGORY_ALL = 12; // ITEM_CATEGORY_WEAPON + ITEM_CATEGORY_ARMOR_SHIELD + ITEM_CATEGORY_OTHER const int ITEM_CATEGORY_EQUIPPABLE = 13; // ITEM_CATEGORY_MISC_EQUIPPABLE + ITEM_CATEGORY_ARMOR_SHIELD + ITEM_CATEGORY_WEAPON
forgive my little note there. I got as far as bit-flags in 'ginc_math' and said that's nuff. Use educated guesses based on what's there already; this is what i do.





Retour en haut






