Making a custom crafting recipe for OC

https://neverwintervault.org/project/nwn2/other/nx2-tutorial-crafting

Ouch looks like it uses x2 scripts… which the OC does not.

Since I was suggested to make a new thread i’ll do it here.
OC’s crafting 2da

ID - sorts out the file, not used by game engine.
Category - which dies it refer?
Reagents - tags of items needed
Tags - recipe tag?
Effects - results? Enchantment effect? Spells required?
Output - result item
Skill - required skill
Level - minimum skill rank required

OC’s crafting index
ID
Category - links to?
Start row - links to?

the “trigger” - if a number is specified it’s a SpellID. If a tag is specified it’s a mundane crafting recipe. If “ALC” or “DIS” is specified it’s for Alchemy craftings.

recipes within Categories must be kept grouped together (see below)

a list of comma-delimited tags, in alphanumeric order (uppercase before lowercase)

nothing to do with what we normally think of as “tags”. Tags here define what baseitem-type of (object)Item a recipe can be applied to. Allowable constants are defined in the #include file(s). If prefaced with a “B” that means that the constant(s) are row IDs in BaseItems.2da – if not prefaced with a “B” the constants are TCC-item-types

comma-delimited; if a “B” has been prefixed to a list of Tags, it applies to all entries in that list. This is to say that a list of so-called Tags is either all baseitem-types or all TCC-itemtypes.

This is an EncodedIP. A list of 5 comma-delimited integers encodes the parameters of an itemproperty. If there is more than one itemproperty that’s to be applied by a recipe, they are delimited by semi-colon(s).

not needed when Enchanting a pre-existing item – is used for “Item Creation”. Specifies the resref of a resulting (created) item.

The FeatID required to do the recipe when enchanting or the SkillID that will be checked to do mundane crafting.

if enchanting: The minimum casterlevel required to do the recipe.
if mundane: The minimum ranks in “Skill” required to do the recipe. See “Skill” above.

OC-style crafting uses a whacky system of dividing Crafting.2da into subsets of triggers (read: Categories). This is why, in Crafting.2da, all triggers need to be kept grouped together. To find the recipe, the scripts start searching Crafting.2da at a given trigger’s Start ID (“START_ROW”) and stop searching for the right recipe at the row before the next START_ROW (or they reach the end of Crafting.2da, whichever comes first).

A recipe trigger (aka Category) in Crafting.2da.

Specifies the row in Crafting.2da for the scripts to start searching for a recipe ID’s properly corresponding reagents and tags (compared against what’s in the crafting container when a recipe is attempted).

2 Likes

Thanks. I tried one with TCC installed, lets see if it works…

iirc, all SpellIDs under CATEGORY need to come before any trigger-tags. not sure atm.

and Crafting_Index.2da might not be as straightforward as you think it is … if you add or remove recipes, all the start_rows (that come after them) in the index have to be shuffled appropriately.

Odear, item property malformed error … but I set any item tag…
Using TCC reboot

======
The recipe is to add OnHitCastSpell, Greater Missile Storm, to any item.

crafting 2da
CATEGORY REAGENTS TAGS EFFECTS OUTPUT SKILL LEVEL EXCLUDE XP GP DISABLE
1843 448 **** -1 “82,0,0,0,0” **** 0 0 **** 0 10000 0

1843 - new row
category - 448, from spells 2da
reagents - **** no reagents needed
tags - -1 = any item
effects - OnHitCastSpell = 82, need more effects??
output - does not create item, ****
skill - skill or feat id, not needed for now so 0
level - skill rank required, not needed for now so 0
exclude - not used, ****
xp - cost xp not charged for now
gp - set to 10000, enabled in config
disable - allow, 0

crafting index 2da - since its a new catagory, add into here as well
CATEGORY START_ROW
199 448 1843

199 - last row
448 - new category, does not exist in index, so add it
1843 - ref row, the row in crafting 2da which is the last row

==========

anything I missed??

as a matter of policy there should always be 5 entries in the EncodedIP.

eg: “82,448,20,0,0”

82 = ITEM_PROPERTY_ONHITCASTSPELL / ItemPropertyOnHitCastSpell(iPar1, iPar2) - see IPGetItemPropertyByID() in ‘x2_inc_itemprop’

448 = par1 / Isaacs_Greater_Missile_Storm in Spells.2da

20 = par2 / nLevel

0 = pad to five entries w/ zeroes


i never tried a recipe without reagents, but a glance at the code says it should work – but remember that a recipe needs to be unique, as described by the combination of its trigger and reagent-tags (and maybe itemtype “Tags”), else the script is going to grab the first recipe match that it finds.


everything else you have there looks good at a glance or two (unless all SpellID triggers/categories have to go before the mundane crafting recipes, but again at a glance the code says it should be okay since “448” is a unique trigger … not sure – i vaguely remember changing this from the stock code, but that was a long time ago)

Ok got tcc reboot from github, set everything in both 2da and will try again

=======

Urf its still itemproperty malformed error.

crafting 2da
CATEGORY REAGENTS TAGS EFFECTS OUTPUT SKILL LEVEL EXCLUDE XP GP DISABLE

1843 448 **** -1 82,448,40,0,0 **** 1093 10 **** 0 10000 0


crafting index 2da
CATEGORY START_ROW

199 448 1843

where did I go wrong…

got it to work at L20

my mistake, OnHitCastSpell needs to use a spell from Iprp_OnHitSpell.2da

eg, “82,99,20,0,0” – IGMS @ L20

 
everything else is the same as your specs.

Works here too.

Thanks

1 Like

Not sure if this will be of interest to you. but back when developing the OC Makeover and MotB Makeover I integrated the SoZ crafting system into the OC and MoTB. I had to make many fixes to the crafting scripts the SoZ had. That led in turn to my developing the SoZ Crafting Plus System which was intended to allow people to easily add SoZ style crafting into their own campaigns and allow custom recipes. Some of my work might be useful for you to look at.

3 Likes