Tools and Resources
X3 Editor 2
The most vital tool for modding anything in X3 is the X3 Editor 2
. It allows you to open .cat files, which is where most of the files that you will modify exist.
The X3 Editor has a "Virtual File System" (VFS), which automatically finds the highest-precedent
file for you (the file that the game will use).
Therefore, the typical process is to:
1) Open the file that you want to modify in VFS. For example, addon\types\TShips (for AP) (or types\TShips for TC).
2) Save to your hard drive; in the same path. In the Save As.. dialog, click the button to "Switch to System Dialog". Then save as as a text file, in the path: addon\types\TShips.txt
. Note that you will need the .txt file extension on your hard drive, but the file inside the .cat has no extension.
3) Make your edits to the new file on your hard drive. That way, you can always delete your edited file if you make a mistake, and the original file will still be in the .cat file.
3D Model and Stats Viewer
This may be quicker than reloading the game to view your modified scenes:
3D Models and Stats Viewer
How to use the 3D Viewer in X3AP
A word about File "Precedence"
(Yes it is geeky, but you should know this)
is the way that a computer knows which thing to use, when there is more than one possible thing.
The computer uses the thing that has the highest precedence.
In X3, file precedence goes like this:
- Files in higher-numbered .cat files have higher precedence over the same-named files in lower-numbered .cat's.
- "Loose" files on your hard drive have precedence over files in .cat's.
- Packed files (.pck) on your hard drive have the highest precedence.
- The game will always
use the highest-precedent file.
A good text editor makes your life easier. While it is possible to edit X3 files with Notepad, some versions of Notepad have bad habits, such as changing file extension without warning, and inserting line breaks where you do not want them. A real programmer's editor is more reliable and easier to use in the long run.
Use whatever text editor you like. If you have no preference, then consider one of the following:
- Notepad++ (free)
is a very popular, free, text editor. It has most of the features of more sophisticated editors, and is "good enough" for most purposes.
- PsPad (free)
is another fine, free, text editor. While less well-known than Notepad++, I like PsPad because it opens slightly more quickly than Notepad++.
- UltraEdit (commercial)
is an inexpensive programmer's editor that is very nearly perfect. If you are willing to pay for an editor, then you would be hard-pressed to find one that does as much as UltraEdit.
Merge Tool (a.k.a. File Compare, or "Diff" Tool)
A Merge Tool allows you to compare two versions of a file, side-by-side, so that you can easily see what has changed. Merge tools are indispensable to programmers and modders.
- WinMerge (free)
is moderately capable and free. If it does the job for you, then that is great. However, commercial merge tools are noticeably superior.
- Beyond Compare (commercial)
is an excellent and inexpensive merge tool. It can also compare folders and binary files, which is sometimes handy. Beyond Compare is an excellent value, because it can do some things that even more expensive merge tools cannot.
- Araxis Merge
is an expensive merge tool, but it also has the easiest-to-use user interface (at least that is my experience with it).
If money is not a barrier, then it would not be overkill to own both Araxis Merge and Beyond Compare. They are different enough that I use them for different tasks. Araxis for quick, normal, day-to-day file compares. Beyond Compare for trickier jobs. Both are superior to WinMerge.
Directory Compare (Folder Compare)
These tools compare two folders full of files, and show you what has changed. For example, you could compare Ap to TC to see what is different.
All of the above Merge Tools can compare folders.
I have a slight preference for FileSync
. It is an older tool, written for Windows XP, but I like the way it works. *Shrug* maybe that is because I have used it more than other tools -- I am not sure. But it is very inexpensive ($15) and excellent, so I thought that I would mention it. There is a free version that you can try -- it is not disabled in any way other than it "pesters" you to register.
Resources for Newbies
Shrewd135 wrote:Does anyone have any ... scripting guides for x3? ... [snip]
- There is a great list of handy scripts for streamlining X3 at: Streamlining X3
. The discussion strays off topic, but the first post is very helpful.
- There is no tutorial for the X3 Editor 2
because it is intended to be easy to use.
- Use the Virtual File System (VFS) to find the highest-precedent file. That is the file that the game will use when there is more than one file of that name to choose from.
- In particular, look at the files in the Types folder: TShips, TLasers, TBullets, TMissiles. For example, you will change both TLasers and TBullets to change the damage per second of a gun.
- When you find a good reference, bookmark it. I save the bbcode in my bookmark description, so that I can easily copy-and-paste a link for other users.
- For example, bookmark this link: Search EgoSoft with Google
- For scripting info, examples, and reference, there is no better single source than the MCSI Programmer's Handbook
- All scripts *ARE* source code. So you already have the source to the Cheat Package
. And you are correct in thinking that it is a good model to use for your own scripts. You may need to use one of the tools bundled with the Plugin Manager
to extract the source.
- If you are serious about scripting, you will soon outgrow the in-game Script Editor. X-Studio Script Editor
are the external script editors that most experienced scripters use. You can (and should) begin with the in-game script editor, until you understand more about how the game works. But keep X-Studio and Exscriptor in mind for when you are ready for more editing horsepower.
- For modding guides, you will find some links in the Tutorials and Resources Index
. In particular, you will find information about 3D modeling for X3 there. Most of these guides assume that you know how to use your 3D modeling program(s).
- For basic 3D modeling information, like your simple ship example, you will want to search elsewhere. Google is your friend. Perhaps get a copy of the free GMax editor and find a tutorial for it.
- For the very basics of modding, Modding 101
has a lot of useful information. It also has a lot of extra words and old links -- it could stand to be updated. But it covers the basics.
- The Ship Tricks: Mini-Guides
are intended to be easy to follow. You may not be quit ready for them yet, but you will soon be there if you continue to study.
- A couple of your requests are more advanced topics, such as adding a turret. There are tutorials for that, but begin with learning how to use a 3D modeling program.
- Modifying plots is a job for the Mission Director (MD). There is not much documentation for it, and many experienced programmers find it frustrating to learn and use. Ironically, some less experienced developers have had better luck with it. Perhaps they have less to unlearn? In any case, you should take a look in the Community Scripts Library
under the "Mission Director" heading.
- There is some more information on the MD Mission Director Basics and Installation
page. However, the documents themselves are outdated. Extract the current documents from the Director folder in VFS (X3 Editor).
- Also, get the current documentation for the MD in acrobat format from Dillpickle's Download Page
. It is much easier to read that way.
- While there is a rogue decompiler for X3, I sense that you are nowhere near ready to use it. Decompiling is a job for experienced assembly-language programmers. However, X3 is highly moddable without decompiling.
- Best starting points are the X3 Editor and the MCSI Handbook.