Need help with draft schematics

r4design

New Member
Jun 13, 2020
2
0
0
#1
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
Jan 11, 2015
243
20
18
35
Empire in Flames
www.writingunderduress.com
#2
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
Jun 13, 2020
2
0
0
#3
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.