Need help with draft schematics

r4design

New Member
Joined
Jun 13, 2020
Messages
2
First off, long time reader, first time poster. I've been wanting to jump into development on SWGEmu for a while, but only recently got my environment up and running to play with. As part of taking my first step into the modding world, I thought I would start with something simple- creating a new draft schematic for an existing piece of clothing (Nighsister/SMC garb). Halyn has already done this for EIF, but rather than simply reach out and ask what was done there, I thought I would try approaching it from scratch so I could learn how everything works together.

After beating my head against this for over a week and scouring this forum and others for snippets of direction, I'm convinced I'm just overlooking something I will never find on my own. And now I'm going mad.

Here's where I am.

First, using SIE, I created a new IFF file off of an existing donor (object/draft_schematic/clothing/shared_clothing_pants_field_07.iff)
--object
----draft_schematic
------clothing
-------- shared_clothing_nightsister_pants_01.iff
(for this, I extracted and renamed object/draft_schematic/clothing/shared_clothing_pants_field_07.iff as my starting point)

1) In the .iff, I edited the record for craftedSharedTemplate to point to the pre-existing object/tangible/wearables/pants/shared_nightsister_pants_s01.iff
2) I peeked into the EIF TRE files and saw that the draft schematic used there has nothing specified in the appearanceFilename node. Unlike the version I cloned, which points to the appearance file for clothing_pants_field_07. Assuming it was unnecessary, I copied that empty node from the EIF version to avoid confusion or complications later.

Updated the CRC file
--misc
---- object_template_crc_string_table.iff

1) I added a new record for the .iff: object/draft_schematic/clothing/shared_clothing_nightsister_pants_01.iff
2) I noted that the pre-existing object/tangible/wearables/pants/shared_nightsister_pants_s01.iff was already in the CRC file

And then added the new schematic here:
--datatables
----crafting
------schematic_group.iff
(added new schematic to the Master Tailor box):
craftClothingMaster > object/draft_schematic/clothing/shared_clothing_nightsister_pants_01.iff

As far as I can tell, there wasn't anything else that I needed to configure in the TRE. So I built a test file, added it to both the client and server at the top of the TRE file list.

Now on to the LUA files
In this case, there was already one of the necessary .lua files in the repository:
object>tangible>wearables>pants>nightsister_pants_s01.lua

I just needed to fill it out with some additional details:
Code:
object_tangible_wearables_pants_nightsister_pants_s01 = object_tangible_wearables_pants_shared_nightsister_pants_s01:new {
    playerRaces = { "object/creature/player/bothan_female.iff",
                "object/creature/player/human_female.iff",
                "object/creature/player/moncal_female.iff",
                "object/creature/player/rodian_female.iff",
                "object/creature/player/sullustan_female.iff",
                "object/creature/player/trandoshan_female.iff",
                "object/creature/player/twilek_female.iff",
                "object/creature/player/zabrak_female.iff",
                "object/mobile/vendor/aqualish_female.iff",
                "object/mobile/vendor/bith_female.iff",
                "object/mobile/vendor/bothan_female.iff",
                "object/mobile/vendor/human_female.iff",
                "object/mobile/vendor/moncal_female.iff",
                "object/mobile/vendor/rodian_female.iff",
                "object/mobile/vendor/sullustan_female.iff",
                "object/mobile/vendor/trandoshan_female.iff",
                "object/mobile/vendor/twilek_female.iff",
                "object/mobile/vendor/zabrak_female.iff" },

--- added by me
    numberExperimentalProperties = {1, 1, 1, 1},
    experimentalProperties = {"XX", "XX", "XX", "XX"},
    experimentalWeights = {1, 1, 1, 1},
    experimentalGroupTitles = {"null", "null", "null", "null"},
    experimentalSubGroupTitles = {"null", "null", "sockets", "hitpoints"},
    experimentalMin = {0, 0, 0, 1000},
    experimentalMax = {0, 0, 0, 1000},
    experimentalPrecision = {0, 0, 0, 0},
    experimentalCombineType = {0, 0, 4, 4},
--- end additions
}

ObjectTemplates:addTemplate(object_tangible_wearables_pants_nightsister_pants_s01, "object/tangible/wearables/pants/nightsister_pants_s01.iff")
In messing around in the iff editor, I deduced that the DSSA nodes correspond roughly to the experimental attributes- although I could only find a clear correlation for the specifics in the subGroupTitles in the iff editor. But I kept the # of items in each array (4) to the same # of DSSA nodes. This was largely identical to what was defined in the .lua for my original donor draft schematic (clothing_pants_field_07, which uses object/tangible/wearables/pants/pants_s07.lua)

Next I created my new draft schematic off of the corresponding clothing_pants_field_07.lua donor, under a new file:
object>draft_schematic>clothing>clothing_pants_nightsister_01.lua

Code:
object_draft_schematic_clothing_clothing_pants_nightsister_01 = object_draft_schematic_clothing_shared_clothing_pants_nightsister_01:new {
    templateType = DRAFTSCHEMATIC,

    customObjectName = "Nightsister Pestilence Leggings",

    craftingToolTab = 8, -- (See DraftSchematicObjectTemplate.h)
    complexity = 25,
    size = 3,

    xpType = "crafting_clothing_general",
    xp = 80,

    assemblySkill = "clothing_assembly",
    experimentingSkill = "clothing_experimentation",
    customizationSkill = "clothing_customization",

    customizationOptions = {2, 1},
    customizationStringNames = {"/private/index_color_1", "/private/index_color_2"},
    customizationDefaults = {36, 47},

    ingredientTemplateNames = {"craft_clothing_ingredients_n", "craft_clothing_ingredients_n", "craft_clothing_ingredients_n"},
    ingredientTitleNames = {"shell", "binding_and_hardware", "colorizable_cloth_panel"},
    ingredientSlotType = {0, 1, 0},
    resourceTypes = {"hide", "object/tangible/component/clothing/shared_metal_fasteners.iff", "hide"},
    resourceQuantities = {50, 2, 50},
    contribution = {100, 100, 100},


    targetTemplate = "object/tangible/wearables/pants/shared_clothing_nightsister_pants_s01.iff",

    additionalTemplates = {
    }
}

ObjectTemplates:addTemplate(object_draft_schematic_clothing_clothing_pants_nightsister_01, "object/draft_schematic/clothing/shared_clothing_nightsister_pants_01.iff")
From what I could see looking at the mesh and texture data for the nightsister pants, it looked like there were 2 color customization palettes, so I kept those consistent with the donor information as placeholder. The ingredient data I also matched to the donor, since I believed the .iffs would be largely identical.

And finally, I made sure to update references to the new files where necessary:
objects.lua:
Code:
object_draft_schematic_clothing_shared_clothing_pants_nightsister_01 = SharedDraftSchematicObjectTemplate:new {
    clientTemplateFileName = "object/draft_schematic/clothing/shared_clothing_nightsister_pants_01.iff"
}

ObjectTemplates:addClientTemplate(object_draft_schematic_clothing_shared_clothing_pants_nightsister_01, "object/draft_schematic/clothing/shared_clothing_nightsister_pants_01.iff")
serverobjects.lua:
includeFile("draft_schematic/clothing/clothing_pants_nightsister_01.lua")


and finally managers > crafting> schematics.lua
{path="object/draft_schematic/clothing/shared_clothing_nightsister_pants_01.iff"},


Now when I launch the server, I don't see any errors or warnings related to the files (I did in early iterations as I messed up filenames across different places). When I check the granted schematics of Master Tailor, I see the dreaded "Unknown schematic", and there's nothing in the crafting tool. However, when I check my datapad and check for the schematics, I see it listed there. Clicking it crashes the server with an "Unhandled exception in DraftSchematicObjectTemplate::getResourceWeights" error.

At this point, I don't know where else to look for what I'm doing wrong- so I'm turning to the MTG community for help!
 
Last edited:

Halyn

That One Guy
Staff member
Moderator
Joined
Jan 11, 2015
Messages
257
Location
Empire in Flames
I see several errors at first glance.

In your draft schematic lua, targetTemplate needs to point at the server object, not the client object. (Generally speaking, client objects all used shared_ as part of the filename, but server objects omit that.) Similarly, the crafting manager schematics.lua use server objects, not client objects.
 

r4design

New Member
Joined
Jun 13, 2020
Messages
2
Thanks, Halyn- the whole "shared_" vs not is something that I can't say I understand. So even though all the files in the .tre are named "shared_", the server looks for them without that as part of the name?

So updating the draft schematic .lua, schematics.lua and the schematic_group.iff to remove the 'shared_' path, I managed to see the draft schematic in my list of granted schematics, and in the crafting tool. However, I'm still faced with the "Unhandled exception in DraftSchematicObjectTemplate::getResourceWeights" error.

My first guess is that there is a discrepancy between what the draft schematic .iff file specifies in the tre file and what is in the .lua files- but if so, I'm not sure how to reconcile the two. Picking an existing object and schematic to clone was my way of cutting out any of that- but it's clear I don't understand the nuances.
 

OSULugan

New Member
Joined
Nov 17, 2020
Messages
1
Did you ever get this resolved? I'm trying to do something similar by bringing some other armor types into crafting functionality. I'm using snyter's editor.

I've gone through basically the same steps you detail above, but instead of copying a clothing item, I'm altering the mandalorian helmet to make it craftable, and creating a new custom armor segment kind to use in it's crafting:

  1. First, I took the object/draft_schematic/clothing/shared_clothing_armor_composite_xxx.iff, exported them and did a search/replace on all instances of "composite" to "mandalorian" in them (2 instances per file)
  2. Then I added entries to datatables/crafting/schematic_group.iff and placed the schematics in various craftArmorPersonalGroup
  3. Then, I added crc values to misc/object_template_crc_string_table.iff for these files
  4. I copied the scripts/object/draft_schematic/clothing/clothing_armor_composite_xxx.lua files to scripts/object/draft_schematic/clothing/clothing_armor_mandalorian_xxx.lua, again performing a find/replace for composite -> mandalorian
    During this process, I verified that the targetTemplate was a valid tangible object defined by an .iff file
    i.e.:
    targetTemplate = "object/tangible/wearables/armor/mandalorian/armor_mandalorian_boots.iff",
    I also added the experimental properties information from the composite lua files.
    I verified that the objects.lua file in that folder had the schematics listed in them
    i.e., object_draft_schematic_clothing_shared_clothing_armor_mandalorian_boots = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/clothing/shared_clothing_armor_mandalorian_boots.iff"

    }

    ObjectTemplates:addClientTemplate(object_draft_schematic_clothing_shared_clothing_armor_mandalorian_boots, "object/draft_schematic/clothing/shared_clothing_armor_mandalorian_boots.iff")

    And verified that they were in serverobjects.lua
    i.e., includeFile("draft_schematic/clothing/clothing_armor_mandalorian_boots.lua")
I packed all of those .iff files up into a .tre and loaded it server and client-side. Snyter's editor see's the changes as a new revision when I load it up.

I halted the server, deleted the draftschematics.db, then started it back up. Now I see the schematics listed on the armorsmith skill tree where I put them in schematic_group.iff, but I can't seem to figure out why I can't see them when I access an armor crafting station using my master armorsmith. I see all of the other armor types...

I know that I must be missing something, but I've gone around and around.

Next up will be to replace the composite segment with a new segment type, then migrate that to a loot-able option. Then look at doing similar things with the faction armor types, with purchaseable limited-used schematics from the faction vendors.

Any help would be greatly appreciated!
 
Top Bottom