Update - Nov 9 - Added ingame pix's of 4 ships, and a link to a zip file with the source files (.max, .bod, etc) for one of them. See below.
Small Update: Nov 3rd...additional 'essential tools. Added links to the Bod Viewer and 3d Max import script (from RA's post on ***)
Ok...I've told a few people I would try and explain how I finally got cockpits (and view points) to work. The following (unfortunately lengthy) post is an attempt on my part to provide a "relatively" quick look at how I get a new part (.bod) to act like a real cockpit.
As usual, this isn’t necessarily the right way...but it works every time for me.
First, you must have the right tools. DoubleShadows latest X2 Editor (0.0.27) is awsome, and now allows you to add and delete guns and turrets on your new ship entry in the TShips file. Unless you are a masochist, and like slogging through a never ending string of numbers...get it at: http://www.doubleshadow.wz.cz/?p=download.
Two other tools you will need are the Bod file viewer (lets you look at a small image of the .bod files in your "v" folder), and the MaxScript files used to import .bod files (bodies, not scenes) into 3d Max You can get the viewer at http://urquan.nightmail.ru/BODViewer/Exe , and the MaxScript files at http://urquan.nightmail.ru/Altor/ . These are from a Russian X2 modder. There is a bit more info on how to get the MaxScript to work in this thread: http://www.***/Forums/viewtopic.php?t=48 .
You can pack/unpack & compress/decompress the X2 files using the official X2 Modding kit (from this site), or the older X2 Modder by OlisJ. I prefer OlisJ's X2 Modder.
Now, this is not a simple (or particularly well-understood) subject, and I’m going to assume that you have diligently studied (and re-studied) the various graphics modding threads on this site, as well as the official GFX Modding documentation.
I am also assuming you probably followed roughly the same learning curve that I did; Hacked the TShips file until you got tired of flying around in the ultimate M5 (that could kill anything in the X2 universe), then switched to using a text editor and existing X2 .bod files (from the “v” folder) to build your own custom ships, and finally started importing body parts into 3d Max, creating new meshes, and trying to export your creations back into X2.
The reason that the above assumptions are important is that I fully expect you to have already explored the contents of .bod files...both from the “v” and “cut” folders. If you haven’t, go back and look at the graphics modding threads in the sticky at the top of this forum, and work through what is being discussed as you look at working X2 body parts and scene files!
OK...you know all that stuff...so how do you make a body part (.bod file) act like a cockpit? Well, if you looked in the “v” folder at working cockpits (806 is a good example) and turrets (look at 939), you will note that right at the end of the 1st body in the bodyarray there is a sequence that looks something like (this is from part 806):
Code: Select all
... ...
... ...
-99; 00000000000010001;
/----- Part cockpit -----
1; 218; 220; 219; -25; 2; -25.000000;26.000000; 25.000000;-24.000000; -25.000000;-24.000000; /(420) Flags 0x0001
1; 220; 218; 221; -25; 2; 25.000000;-24.000000; -25.000000;26.000000; 25.000000;26.000000; /(421) Flags 0x0001
0; 222; 224; 223; -25; 4; -25.000000;26.000000; 25.000000;-24.000000; 25.000000;26.000000; /(422) Flags 0x0001
0; 224; 222; 225; -25; 4; 25.000000;-24.000000; -25.000000;26.000000; -25.000000;-24.000000; /(423) Flags 0x0001
4; 218; 223; 221; -25; 8; -25.000000;26.000000; 25.000000;26.000000; 25.000000;26.000000; /(424) Flags 0x0001
4; 223; 218; 222; -25; 8; 25.000000;26.000000; -25.000000;26.000000; -25.000000;26.000000; /(425) Flags 0x0001
3; 221; 224; 220; -25; 16; 25.000000;26.000000; 25.000000;-24.000000; 25.000000;-24.000000; /(426) Flags 0x0001
3; 224; 221; 223; -25; 16; 25.000000;-24.000000; 25.000000;26.000000; 25.000000;26.000000; /(427) Flags 0x0001
5; 220; 225; 219; -25; 32; 25.000000;-24.000000; -25.000000;-24.000000; -25.000000;-24.000000; /(428) Flags 0x0001
5; 225; 220; 224; -25; 32; -25.000000;-24.000000; 25.000000;-24.000000; 25.000000;-24.000000; /(429) Flags 0x0001
2; 219; 222; 218; -25; 64; -25.000000;-24.000000; -25.000000;26.000000; -25.000000;26.000000; /(430) Flags 0x0001
2; 222; 219; 225; -25; 64; -25.000000;26.000000; -25.000000;-24.000000; -25.000000;-24.000000; /(431) Flags 0x0001
-99; 00001000000000000001;
-99; 0000000000000000; /Mark end of body
... ...
... ...
Starting from the limited information in the official GFX documentation, and based on considerable trial and error, here is what I do when creating a cockpit:
1. First create the body part for your cockpit, and name the object. I typically use unassigned part numbers…like 17210_1 (I’ll explain the “_1” at the end of the name later).
2. Make sure your pivot is centered, and that your new part is at 0,0,0. (There are many ways around this, but to keep this as simple as possible…keep things centered.)
3. Then use 3d Max to create a small cube (geometry)…I typically use 2x2x2 as a size…and name the object “cockpit”.
4. Move the cube you just created to where you want the origin point for your cockpit view.
5. Next, use 3d Max to “link” the cockpit cube to your cockpit body part (17210, in my example).
6. Make sure everything is centered (oh...I already said that!), and the use 3d Max to reset the transforms (Reset XForm), and collapse the modifier stack.
7. Now group your cockpit part (17210, in the example) and the linked cube named “cockpit”, and use the EgoSoft-supplied exporter to export your creation as a “body” (in my example, with the name 17210.bod). If you look at your new part with a text editor, you should see the magic “/----- Part cockpit -----“ section!
8. Include your cockpit into a scene file...and your ready to fly!
OK, about that scene file...how do you get guns to work with your new cockpit? Ah…remember the “_1” at the end of the cockpit name in my example above? That tells the EgoSoft exporter that this part is cockpit number 1 when you get around to exporting your scene file. If you imported a couple of X2 lasers (say part 106), and named both the new objects 106_1 (yes, you now have two objects in 3d Max with the same name), the resulting entries in your exported scene file might look something like:
Code: Select all
P 0; B 940; N 940_core;
{ 0x2002; 0; 0; 0; 0.000000; 0.000000; 0.000000; 0.000000; -1; -1; } // 34
/ Mon Nov 01 22:04:19 2004
/ Node 16270_1 Class [Editable Poly, GEOMOBJECT_CLASS_ID]
P 1; B 17210; C 1; N 16270_1;
{ 0x2002; 0; 0; 0; 0.000000; 0.000000; 0.000000; 0.000000; -1; -1; } // 0
/ Mon Nov 01 22:04:19 2004
/ Node 00106_1 Class [Editable Mesh, GEOMOBJECT_CLASS_ID]
P 2; B 106; C 1; N 00106_1;
{ 0x2002; 12791; -862; -1994; 0.000000; 0.000000; 0.000000; 0.000000; -1; -1; } // 34
/ Mon Nov 01 22:04:19 2004
/ Node 00106_1 Class [Editable Mesh, GEOMOBJECT_CLASS_ID]
P 3; B 106; C 1; N 00106_1;
{ 0x2002; -12791; -862; -1994; 0.000000; 0.000000; 0.000000; 0.000000; -1; -1; } // 34
/ Mon Nov 01 22:04:19 2004
/ Node cockpit Class [Box, GEOMOBJECT_CLASS_ID]
P 4; B 0; F 1; N cockpit;
{ 0x2002; 0; 1891; 1593; 0.344915; -0.529813; 0.662266; 0.529813; -1; -1; } // 34
You will note that the cockpit part (17210) now has a “C 1” automatically inserted into the part entry. This identifies the part as cockpit #1. You will also note that the two 106 lasers are automatically assigned to cockpit #1 (there is a “C 1” in each 106 entry).
Here is a simple example of creating a 4-gun turret using standard X2 parts (in this case, 939 turrets and 708 gun towers)
1. Import a 939 turret, and place somewhere on your model. Name it 939_2 (or _3, _4, _5, _6, _7...in addition to front guns in C1, you can have up to 6 turrets; top, bottom, front, rear, left, and right.)
2. Import and place 4 708 gun towers (actually, import 1, and clone it 3 times), each one named 708_2 (assuming the gun towers are to be controlled by the turret #2). You now have 4 objects in 3d Max with the name 708_2.
When you export the scene file, the resulting .bod will have the following entries somewhere in it:
Code: Select all
P 6; B 00939; C 2; { 2; 0; 5250; 293750; 0.0000; 0.0000; 0.0000; 0.0000; -1; -1; } // 0 /- Turret - front
P 7; B 00708; C 2; { 2; 67200; -25000; 243700; 0.0000; 0.0000; 0.0000; 0.0000; -1; -1; } // 0 /- gun tower - front
P 8; B 00708; C 2; { 2; 0; -61900; 283900; 0.0000; 0.0000; 0.0000; 0.0000; -1; -1; } // 0 /- gun tower - front
P 9; B 00708; C 2; { 2; -67200; -25000; 243700; 0.0000; 0.0000; 0.0000; 0.0000; -1; -1; } // 0 /- gun tower - front
P 10; B 00708; C 2; { 2; 0; 12750; 294750; 0.0000; 0.0000; 0.0000; 0.0000; -1; -1; } // 0 /- gun tower - front
Now all you have to do is pop over into DoubleShadows X2 Editor, and modify the appropriate TShip entry...but that topic has already been addressed in other threads (and this post has gone on far too long!)
Hope this helps...it works for me.