Mod with specialization appears to look in wrong path on game start

Your forum for all discussions around Modding.
Eaglemc
Posts: 3
Joined: Tue Jan 02, 2024 7:14 am

Mod with specialization appears to look in wrong path on game start

Post by Eaglemc »

Hi Support,

I have modified some existing mods to work in a different way. I have always liked implements that used the old Agricultural Platform (AP) from FS 17 and 19. I find they allowed more compact setups compared to the IT Runner platform. Anyway, I've been building a few mods to suit my uses at the moment, like an autoload flatbed, a fertilizer spreader, and a tipper. The mods all work fine with no errors as individual mods, but then I had the bright idea of making a "pack" mod with the three of them in there. I got it all together and thought that I covered all the bases since It all works as expected: One mod shows at the career start for selection with its "pack" icon, and then all mods show in their respective categories in game with their individual icons, and all can be purchased and used in game... with one exception. The autoload on the flatbed doesn't work and I have an error in the log as follows:

Error: Could not find specialization 'FS22_AP_BackPack.FS22_aPalletAutoLoader.aPalletAutoLoader' for vehicle type FS22_AP_BackPack.PalletAutoLoaderTrailer'.

For some reason it is prepending "FS22_AP_BackPack." to the autoloader specialization, which it doesn't do when running my mod as a single item mod. I've looked at the moddesc.xml file and the xml for that autoload flatbed for a clue but can't find any difference between my multi-unit pack and another similar pack like FS22_AutoloaderStockPackjw. I've scoured the internet with searches on every keyword I can think of, and nothing matches this error.

My Mod hierarchy looks like this:
FS22_AP_BackPack.zip
---Mod1Folder
------(i3d, store icon, textures, etc.)
------Mod1.xml
---Mod2Folder
------(i3d, store icon, textures, etc.)
------Mod2.xml
---Mod3Folder
------(i3d, store icon, textures, etc.)
------Mod3.xml
---icon.dds
---modDesc.xml

Does anyone see the most-likely-simple reason my mod won't "find" the autoload specialization when in a "pack" mod?

Thanks in advance to the community.
Eaglemc
Posts: 3
Joined: Tue Jan 02, 2024 7:14 am

Re: Mod with specialization appears to look in wrong path on game start

Post by Eaglemc »

I did find the code below in the GDN LUADOC section for TypeManager:
-- add type specializations
local j = 0
while true do
local specKey = string.format("%s.specialization(%d)", key, j)
if not hasXMLProperty(xmlFile, specKey) then
break
end
local specName = getXMLString(xmlFile, specKey.. "#name")
local entry = self.specializationManager:getSpecializationByName(specName)
if entry == nil then
if modName ~= nil then
specName = modName.."."..specName
end
entry = self.specializationManager:getSpecializationByName(specName)
if entry == nil then
Logging.error("Could not find specialization '%s' for %s type '%s'.", specName, self.typeName, typeName)
specName = nil
end
end
if specName ~= nil then
self:addSpecialization(typeName, specName)
end
j = j + 1
end

So, this is where that error message is being set. It appears that self.specializationManager:getSpecializationByName(specName) is nil, an issue with specName, and trying to reset specName with additional parameters. I can see this is where the modName is being prepended to the specName, so is there something that is required in my "pack" mod that isn't required in the single item mod?
Eaglemc
Posts: 3
Joined: Tue Jan 02, 2024 7:14 am

Re: Mod with specialization appears to look in wrong path on game start

Post by Eaglemc »

So, you may find this funny... after all my in-depth script checking and troubleshooting on this problem... it turns out that it had nothing to do with my mod, other than what I NAMED IT!!! Good grief.

It's a long story which I'll shorten. My mod, FS22_AP_BackPack was being loaded alphabetically before the mod it was calling, FS22_aPalletAutoLoader, so it failed to find what it needed. I changed my mod name to FS22_zAP_BackPack and it worked like a charm!

I'll try to contact the author of FS22_aPalletAutoLoader and let them know this issue with their mod... or if any of you know the author you can show them this post.

Now, on to enjoying my new mod pack!
Post Reply