[SOLVED?] Frustrating problem with hgn_mothership and subsystem

I created a copy of “hgn_mothership” and renamed it “hgn_mothership_research0”. I also created “Hgn_MS_Module_FireControl_research0” which is a duplicate of “Hgn_MS_Module_FireControl”. Same files, different names.

The only difference between “hgn_mothership” and “hgn_mothership_research0” and is that the latter can build “Hgn_MS_Module_FireControl_research0” instead of “Hgn_MS_Module_FireControl”.

The problem is that “Hgn_MS_Module_FireControl_research0” causes the game to crash. The same ship with the default “Hgn_MS_Module_FireControl” does not crash the game.

Here are the files:


I don’t understand the crashes. The files are identical. They are access violation and leave no records in the log. Any help would be appreciated. Thanks.

The error logs are not helping.

did you try with a shorter name, just to be sure ? Could be a name length problem (would be surprising, but still)

I resolved it somehow… I don’t know how…

Instead of using LoadSharedModel in the mothership .ship file, I just copied the HOD and other files and renamed them all. Maybe that did it.

I was actually worried that the problem was due to the file/object names having a number at the end instead of a letter. Usually this doesn’t matter in Lua, but I thought that maybe I encountered something that didn’t like numbers. For instance, some of the custom ship code appends the player index number to the end of the ship name, so it could have been getting confused by the additional digits. That would have meant a lot of extra work re-doing all the stuff I’ve been working on in the last day or two, so I dodged a bullet in that regard.

I wish the game would spit out an actual error message instead of just an access violation in six languages. It is really p****** me off.

would be a good thing to ask @BitVenom if he has any idea of what could be causing this ?

I think BitVenom is AWOL for the time being. People are asking him too many questions.

This may be the issue.

addCustomCode(NewShipType,"data:Ship/Hgn_Mothership/Hgn_Mothership.lua","","Create_Hgn_Mothership","Update_Hgn_Mothership","","Hgn_Mothership",4)

The last Hgn_Mothership should be changed to Hgn_Mothership0.

addCustomCode(NewShipType,"data:Ship/Hgn_Mothership/Hgn_Mothership.lua","","Create_Hgn_Mothership","Update_Hgn_Mothership","","Hgn_Mothership0",4)

or

Just remove that line entirely. I’m not sure that it really does anything special:

UI_SetElementSize("NewResearchMenu", "NonCombat", 0, 0);

I changed it to this:

addCustomCode(NewShipType,"data:Ship/Hgn_Mothership_Research0/Hgn_Mothership_Research0.lua","","Create_Hgn_Mothership_Research0","Update_Hgn_Mothership_Research0","","Hgn_Mothership_Research0",4)

Not sure if that made the difference.