[QUESTION] proper directory structure? unable to open file

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Woodmorning
Posts: 4
Joined: Fri, 7. Dec 18, 03:52
x4

[QUESTION] proper directory structure? unable to open file

Post by Woodmorning » Sun, 9. Dec 18, 15:08

Hi I am new to the X series and wanted to try my hand at modding. One of the first things I wanted to attempt was to add a custom missile to the game. From doing some digging it looks like I need to define a Macro, Component, and Ware for the new missile. I also added the new missile macro and component to the /index/macros.xml and components.xml respectively.

In game I can no longer open the consumables menu to purchase missiles, so I must have done something right but also something wrong. Upon checking the Debug Log text file, I see that there is an error that it can't seem to find the macro file. Something like

"Error: failed to open file: unable to find file: ./extensions/modnamehere/assets/props/weaponsystems/missile/macros/my_missile_mk1_macro"

Then this seems to cause the error of "Macro my_missile_mk1_macro" is defined in WaresDB but does not exist" which I think explains why the consumables menu is dead in game.

This is the only file that it seems to have a problem with, I get no errors for the component file or any of the index files or Ware files. and I have double checked that the spellings are correct and the directory path is correct I've also checked my xml with a fine tooth comb in that file and I don't see any errors or anything invalid.

Could anyone give any advice or insight? My mod is located in the documents folder. D:/Documents/Egosoft/xxxxxxxx/extensions/mymoddirectory but I've tried both there and the root game directory and it doesn't seem to make any difference

vedder1993
Posts: 5
Joined: Sat, 8. Dec 18, 00:02
x4

Re: [QUESTION] proper directory structure? unable to open file

Post by vedder1993 » Sun, 9. Dec 18, 16:47

viewtopic.php?f=181&t=406229

a post I made about the file structure and weapon modding.

Also, you sometimes need to restart your game twice before shit works, don't ask me why.
Feel free to ding me if you need more help

PS
I'm walking through your steps to see if something is not right (as far as I know)

Woodmorning
Posts: 4
Joined: Fri, 7. Dec 18, 03:52
x4

Re: [QUESTION] proper directory structure? unable to open file

Post by Woodmorning » Mon, 10. Dec 18, 15:27

vedder1993 wrote:
Sun, 9. Dec 18, 16:47
viewtopic.php?f=181&t=406229

a post I made about the file structure and weapon modding.

Also, you sometimes need to restart your game twice before shit works, don't ask me why.
Feel free to ding me if you need more help

PS
I'm walking through your steps to see if something is not right (as far as I know)
Thanks I really appreciate it. Awesome guide by the way! I was hoping someone would make something like that. I will look it over and see if there may be something I missed. I feel like i'm definitely close to getting something working.

EDIT: For the record, my directory structure looks like yours in that I have added files in every one of the folders that you highlighted in your guide, except for the 't' folder. I wasn't really able to make sense of what is defined in here. so maybe that is what I am missing?

vedder1993
Posts: 5
Joined: Sat, 8. Dec 18, 00:02
x4

Re: [QUESTION] proper directory structure? unable to open file

Post by vedder1993 » Mon, 10. Dec 18, 18:14

The T folder holds a number of xml files that hold almost all the text in the game in the form of a page and line ID.{page, line}. There is a different file for each supported language. You would never add new files in there but if you want to give a new name to your weapon you need to add a line in the document (044-001) is for English I think. Then in your macro files you give this page and ID number. If you want to support multiple languages make sure to use the same page and ID for in each file in the T folder.

DeadMor0z
Posts: 26
Joined: Fri, 29. Nov 13, 18:20
x4

Re: [QUESTION] proper directory structure? unable to open file

Post by DeadMor0z » Mon, 10. Dec 18, 22:29

For some reason x4 engine does not find NEW files if your mod is in documents folder. Try placing your mod in X4 root game/extensions folder.
I've figured it when some mods (which add something new to the game) started to work if I placed them in X4 root rather than in documents.
Also, I think, you must have a proper content xml, where id of your mod must be equal to your mod directory.

Woodmorning
Posts: 4
Joined: Fri, 7. Dec 18, 03:52
x4

Re: [QUESTION] proper directory structure? unable to open file

Post by Woodmorning » Wed, 12. Dec 18, 02:11

So I just got home and am able to post the actual log. After trying your suggestions I am still getting the same errors.

[=ERROR=] 0.00 XLib::XMLInputOpenCallback(): Failed to open the file: assets/props/weaponsystems/missile/macros/missile_cluster_torpedo_mk1_macro
[=ERROR=] 0.00 File I/O: Could not find file '.\assets\props\weaponsystems\missile\macros\missile_cluster_torpedo_mk1_macro.sig'
[General] 0.00 ======================================
[General] 0.00 ======================================
[General] 0.00 ======================================
[=ERROR=] 0.00 Error loading component macro: Error loading from XML file 'assets\props\weaponsystems\missile\macros\missile_cluster_torpedo_mk1_macro'. Check the log for further information.
[General] 0.00 ======================================
[General] 0.00 ======================================
[=ERROR=] 0.00 Macro 'missile_cluster_torpedo_mk1_macro' is listed as missile in the WareDB but does not exist
[General] 0.00 ======================================
[General] 6.10 ======================================
[=ERROR=] 6.10 File I/O: Could not find file '.\assets\props\weaponsystems\missile\macros\missile_cluster_torpedo_mk1_macro'

the file is located in: .../SteamDirectory/X4 Foundations/extensions/MyModNameHere/assets/props/WeaponSystems/macros/

Another thing that stands out to me is that it cant find the .sig file? What is a .sig file? The only file I have in that folder is an .xml file called: "missile_cluster_torpedo_mk1_macro.xml"

Chair5768
Posts: 36
Joined: Sun, 15. Jan 06, 06:43
x3

Re: [QUESTION] proper directory structure? unable to open file

Post by Chair5768 » Wed, 12. Dec 18, 06:23

In your index file you have to give the full path like:
<diff>
<add sel="/index">
<entry name="missile_cluster_torpedo_mk1_macro" value="extensions\MyModNameHere\assets\props\weaponsystems\missile\macros\missile_cluster_torpedo_mk1_macro/>
</add>
</diff>

also:
assets/props/weaponsystems/missile/macros/missile_cluster_torpedo_mk1_macro
is using forward slashes instead of back slashes, not sure if thats the game or you


Don't worry about sig files. I /think/ they're there as a way of confirming what is and isn't an official part of the game, a way of digitally signing things... I may be way off on that but I do know that the game will always complain about not finding them if you have your mods in the root game directory, and that mods work perfectly fine without them.

Woodmorning
Posts: 4
Joined: Fri, 7. Dec 18, 03:52
x4

Re: [QUESTION] proper directory structure? unable to open file

Post by Woodmorning » Thu, 13. Dec 18, 01:00

Chair5768 wrote:
Wed, 12. Dec 18, 06:23
In your index file you have to give the full path like:
<diff>
<add sel="/index">
<entry name="missile_cluster_torpedo_mk1_macro" value="extensions\MyModNameHere\assets\props\weaponsystems\missile\macros\missile_cluster_torpedo_mk1_macro/>
</add>
</diff>

also:
assets/props/weaponsystems/missile/macros/missile_cluster_torpedo_mk1_macro
is using forward slashes instead of back slashes, not sure if thats the game or you


Don't worry about sig files. I /think/ they're there as a way of confirming what is and isn't an official part of the game, a way of digitally signing things... I may be way off on that but I do know that the game will always complain about not finding them if you have your mods in the root game directory, and that mods work perfectly fine without them.
Thanks for the heads up about the index file. I have since corrected that. Also I think the forwards slashes are being printed by the game, since everywhere in my XML I am using backslashes like so: ( ' \ ' ) I am still having the same issue though :/ ive even started over from scratch using only base assets as references inside of the macro file.

Post Reply

Return to “X4: Foundations - Scripts and Modding”