Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

***Tutorial*** Making Custom Weapons

Here you find the different tutorials on editing and MODing Freelancer

Post Fri Mar 18, 2005 10:13 pm

***Tutorial*** Making Custom Weapons

Note: this is a rather advanced tutorial, and not for newbies. You must be very comfortable with UTF Edit, the CMP-construction process, and not afraid to use a command-line utility.

And... until you've done this a few times... expect some pain and suffering. Just warning you now... eventually this gets easy, but not at first, even with these instructions...

STEPS TO MAKE CUSTOM WEAPONS:

1. Make the gun's turret, and the barrel, in your 3D software. The turret must be one piece, and the barrel another- so group them appropriately at the end of your modeling process.

2. The barrel must be on 0 Y.

3. Make an appropriate skin. Note that you can use one skin for both the barrel and the turret (using UVMapper) and the skin will be usable for both objects. Save the skin as DDS- you cannot use TGA textures on weapon objects.

4. Export the model to Milkshape, and name the turret and the barrel something unique, like "Argh_ballturret_turret" and "Argh_ballturret_barrel". Name the skin something unique, such as "Argh_ballturret_TEX".

5. Export the resulting model as a CMP file.

6. Open up UTF Edit, and use it to open the CMP you've just created. Export the VMESHDATA and VMESHREF as "VMESHDATA" and "VMESHREF", respectively. Put these two files into the same directory as meshconv.exe.

7. Use Meshconv.exe (you must open this via cmd-line, manually) and then run it like this: "meshconv VMESHDATA VMESHREF /g". Tell it that there are 2 parts, and 1 mesh for each part.

8. Now you'll have three new files sitting in the same directory as meshconv.exe: newvdata, meshref01 and meshref02.

9. Open up the working custom weapon file, and import newvdata into the VMESHDATA segment of the file. Rename the "something_something.lod0.vms" to "the name of the CMP you exported.lod0.vms"

10. Import the meshref01 into the first part (usually, this is the turret), and the meshref02 into the second part.

11. Rename the two 3DB files from "whatever they are now" to "the names you assigned the Groups in Milkshape".

12. Last but not least, go into Cmpnd-->Part_BARRELS_lod1-->Object name and change that to the name of the barrel object.

13. Check the CMP file. If nothing shows up, then the vmeshrefs are backwards- import meshref01 into the *second* part (usually the barrel) and meshref02 into the turret...

14. Assuming that things are showing up at this point, then use MS3D to import your texture into the CMP file, using the MAT exporter's option to "update an existing CMP, MAT or 3DB". Hopefully, you gave this Material a unique name in the CMP, as stated in the instructions... if not, you have to start OVER FROM THE BEGINNING. Which sucks.

15. Now you have a working weapon... you'll need to open up weapon_equip.ini and alter a weapon's instructions to fit... for example, with the Liberty Justice, change the following lines:

DA_archetype = equipment\models\weapons\li_heavy_ion_blaster.cmp
material_library = equipment\models\li_equip.mat

to

DA_archetype = equipment\models\weapons\name_of_your_new_weapon.cmp
material_library = equipment\models\weapons\name_of_your_new_weapon.cmp

Post Fri Mar 18, 2005 10:19 pm

Oh yeah... and Meshconv comes with nice, relatively easy-to-use templates for custom weapons... just use them, and you'll be OK

Edited by - Argh on 3/18/2005 10:19:53 PM

Post Sun Mar 20, 2005 3:35 pm

Very cool Argh! Redeye's Vmesh converter

Edited by - Cold_Void on 3/21/2005 11:28:30 AM

Post Fri Apr 29, 2005 5:10 pm

Argh what's the deal with the animation scripts in weapon cmps?what do they do/are for?Also could you take another stab at this tutorial,it is workable but some more focus on clearly defining which strings are character-for-character and which are insensitive would be good.
** hahah!I'm so glad I finally got this working,custom guns are awesome!! **


Edited by - Cold_Void on 6/13/2005 4:13:16 PM

Post Sat Apr 30, 2005 12:26 pm

Roflmao... "expect pain and suffering" wasn't dire warning enough, eh? Just think how painful it was when I did it in the first place- the only example of a custom weapon model I could find was AGT's, and the example materials Redeye included with Meshconv. Thank goodness Redeye wrote readable documentation, or I might never have figured things out...

I've recently gotten a bit better at making custom weapons, so maybe I should re-write this tutorial at some point. As for the animation instructions- those define where the rotation points are, and the degree of motion. I haven't been able to get them to do much that's actually useful yet, but I think you could probably make guns do whacky things like be able to depress, etc., with a little bit of patience.

Post Fri May 06, 2005 9:39 am

question:
The cmp exporter (v2.1) can export multiple groups- should I just export as one and go through the above steps, or use this capability of the exporter?

Chris Bates
Lead scripter,
Stargate BFM: Freelancer

Post Fri May 06, 2005 10:46 am

You should have two Groups. One named "Moddersname_Weaponsname_Turret" and the other one named "Moddersname_Weaponsname_Barrel"

Use Regroup to re-order them, so that the Turret group is above the Barrel group... it really helps make the rest of the steps much more straightforward

Post Sat Jun 11, 2005 4:47 pm

I've tried exporting it as 1 mesh and going through the steps above several times, but nothing shows up in HardCMP. I tried using the CMP exporter's "export as separate groups" capability, and the cmp shows 2 groups, but nothing shows in HardCMP. This is rather irritating, as I can't even get the meshes to show, let alone get to the part where you import the material. If you could give me any help, I'd appreciate it greatly.

Chris Bates
Lead scripter,
Stargate BFM: Freelancer

Post Mon Jun 13, 2005 10:19 am

Heya, cjabates, I have the same dang problem here.

I am trying to make a CM dropper, made it in Milkshape. Named the base part Ro9ue_cm_base and the barrel part Ro9ue_cm_barrel. It uses the "weapon_1" texture from "li_equip.mat," so I just left texture as "weapon_1" so that I can refer to that mat when I use it.
Then I used MeshConv.exe to create new mesh data (said 2 parts/objects, 1 for each. Got a newvdata.dat, meshref01.dat, and meshref02 in my MeshConv directory now.
I opened the cmp file, \- > VMeshLibrary > Ro9ue_cm_base.lod0.vms > VMeshData and imported the newvdata here. Then I went to \- > Ro9ue_cm_base_lod1.3db > MultiLevel > Level0 > VMeshPart > VMeshRef and imported meshref01.dat there. And \- > Ro9ue_cm_barrel_lod1.3db > MultiLevel > Level0 > VMeshPart > VMeshRef and imported meshref02.dat there.
Next, I went to Cmpnd > Part_Ro9ue_cm_barrel_lod1 > Object name and used the string edit to rename it Ro9ue_cm_barrel.

Now, thinking I have a nice pretty CM dropper awaiting my adding HPs, I open the newly saved cmp file. But there is nothing there. Nothing at all. I cannot even add HPs to the supposed 2 parts of the CM, as they do not even exist in the directory in HardCMP (I try to add New, but can only add one to "Root" - aren't any others there). I do believe i did everything down to the letter, but it gives me less than I started with (could actually see the base in the original model, not barrels -- but now I can't see a thing.

Any help with what the heck is going on would be most appreciated Thanks

- Ro9ue
_________________________________
"Do or do not. There is no try."
- Jedi Master Yoda

Post Mon Jun 13, 2005 12:57 pm

Ok, well, I figured out how to finally get a working cmp with all the parts in it. I had to use the BLANK_GUN.cmp and one of Harrier's weap .cmps to use as a guide, looked at what he named where - so I now have a cm dropper (a "gun" ) that looks fine in HardCMP and has HpMount, HpConnect, and HpFire01. I have it oriented correctly, to all is well...
Except I cannot really see the thing in the game - I see more like half the polygons, kinda jumbled up. I was thinking it might be textures? I have the texture named "weapon_1" like the regular CM dropper and other equipment, and I tried refering to both the .cmp and to the li_equip.mat for the material_library (neither of which worked).

So now I have a mountable CM dropper that faces bakwards and fires backwards, but I can see only half of its polys ... Is there a known problem that causes this? Do I need to make a custom texture, or is this something actually wrong with my .cmp file? Thanks.

- Ro9ue
_________________________________
"Do or do not. There is no try."
- Jedi Master Yoda

Edited by - Ro9ue on 6/13/2005 1:57:38 PM

Post Mon Jun 13, 2005 5:31 pm

Ro9ue,

reading this and your other thread.... (naughty Ro9ue tsk tsk.. double posting .. It would appear to be the textures are the most likely cause.. they MUST have unique names.. otherwise freelancer gets confused.. I had this problem early on where I used the same part name and texture for the base of two guns.. result.. depending where you were, the gun could have the normal base or the wrong one.. looked really odd I can tell you, as one was capship sized and the other on the small size for ships.. once I realized and fixed my mistake the small gun displayed without the massive base..

I have even created invisible guns.. without trying to,, they work fine but are invisible... (imported the textures wrong)...

Harrier

Post Tue Jun 14, 2005 8:11 am

Hey harrier,
Yeah, I did double-post ... shame shame, eh? Nah, but really just because I did not know if all you head knowledgable guys would have as much time to check posts by n00b's like me since you are wokring on bigger and better things Thought I'd see if anyone else knew anything about it.

But thanks for the reply - I am going to go try to fix it right now. Ooo, so close! This is actually the reason I began modding a year ago - I wanted to create my own custom weapons, though after rading about a paragraph of redeye's tutorial, I sat back in my chair, stared at the screen for a minute, and could only utter " ... Huh. Ok then, next idea." But I finally gave enough time to it that I can now make some sense of it.

Oh, and I noticed yesterday, when I was trying to figure out what the deal was, I used an altered turret view to get right up close to my ship, and noticed that the base part of the dropper is seemingly alright ... heh, well all the 5 faces of the base Big whoop, but anyway, that part is ok, but the actual body of the dropper is the one that's screwed. So that's the part I need to correct. I wonder why all the regular FL equipment can use the same textures but we modders can't ..? A lot of them use the weapon_1 texture without having them mess up on them. *shrug* Ah well, I don't know.
Sorry to be pesky, I'm really trying to avoid that. Thanks a lot, mate - I really appreciate it.

- Ro9ue
_________________________________
"Do or do not. There is no try."
- Jedi Master Yoda

Edited by - Ro9ue on 6/14/2005 9:15:34 AM

Post Tue Jun 14, 2005 9:22 am

Thanks for the tip- now it's working for me, and I can bring more "realistic" weapons into my team's mod.

Chris Bates
Lead scripter,
Stargate BFM: Freelancer

Post Wed Jun 15, 2005 7:36 pm

So yours works, cjabates? Congratulations for that I'm glad someone else figured it out.
Though mine is still hosed up ... *sigh* well, I guess I'll come back to it later. I've regressed since yesterday, going backwards - I can't even see the stupid thing now at all. Just CMs popping out of space near my ship. I'm rather sick of making the 12 different remakes of the blasted thing ... so I'm adding the new ships to the game instead of pounding my head against that wall - doing so just gets me farther and farther away from where I started - heh, in the negative direction =) Gotta love things that don't work, eh?

- Ro9ue
_________________________________
"Do or do not. There is no try."
- Jedi Master Yoda

Post Tue Nov 15, 2005 2:27 am

if you want a gun with proper LOD's, go with ARG's tutorial, however, if you want the easy way, simple do as follows:

youll needa few things;
Milkshape 3d, version 1.7.4 or above
the CMP exporter V0.3 or above(anything that can export multyple groups)
the MAT file exporter V0.1 or above.
hardpoint editor HardCMP, most recetn version recommended, as this one has numouras bugs fixed and allows you to create new kinds of hardpoints, such as HpConnect and HpFire

now, you need a weapon, assuming you allready have this finishedand skinned in MS3D(textured with ONE AND THE SAME SKIN FILE!, preferably DDS), make sure it consists of 2 parts:

the BASE, which *usually* comes in contact with your ship, and
the BARREL, whi angles up and down and usually fires the projectile.

once in Milkshape, goto the "Groups"tab top right on your screen, and make sure theres only the base and barrel there, (important) IN THAT ORDER!!! otherwise your base will angle and your barrel wont show.

ok, now thats clear, also assure the names are origenal, usefull(as argh stated) would be puttin in first the name of the gun, then follow that up with "-base" or "-barrel" and that the Texture names are origenal, also usefull to go for the actual texture name...

I.E. if your gun's texture is called "code_tex_512.dds" then call the texture name in MS3D code_tex_512, thatll be usefull for the MAT file, as this wont load up differnt textures as result of duplicate names.

...returning to the model, in the top left viewer, assure the gun is pointing its barrel at you, and that the pivot point is exactly centred to the origin point in MS3d(the 3 colored lines in the middle)

select that view port, and rotate it upside down, a total of 180 degrees, make sure the rotation pivot is set to "Origin"

scale it to about 10 times its curent size, also around the origin, and export it with the CMP exporter.

in the menu that pops up, mark the model type as "weapon"(not sure what this does to the model) and let it create a new gun model, DONT HIT EXPORT YET!!!!!
set the group count to 2
now add the value of 1 to groups 1 and 2 in that same menu, and NOW you can hit export.

not done yet, here comes the MAT file

im still not entirely sure howto create a blank new MAT file myself, as for some reason my mat's refuse to get red by the CMP files, but anyho...

use the MATfile exporter and hit the "Update excistant MAT/CMP/3DB" button(should be the second)

in the rolldown menu, below the area were you type in the name, select CMP file, then click on the newly created weapon.CMP and hit save.

should the exporter ask for you to locate the textures, you left the texture file to far form the exporters reach, usefull would be to keep the texture in the same folder to the model and CMP.

assuming nothing goes wrong, you should have a dialog showing that shows a hyarchial structure, commen to Freelancer's Mat and CMP files.
hit continue

your almost done, now for the hardpoints.

open up the new CMP file, if the gun's to small, scale it up a lil more with the export settings i told you to use earlyer, scaling it up is easy, to scale up, use the value of 2.0 in all dialogs to double its size(dont overdo it).
dont worry, once set up, the Mat file SHOULD remain as it is in the cmp.

i always compare my models with the default CMP weapon the "Li_heavy_ion_blaster.cmp"
this gun we all know like the back of our hands, and it fits on just about all but the bigger gunboats.
if your going for capitol weapons, compare it with Ku_large_forward.cmp" or simular, the Kusary gunboat LFG is the smallest amongst them, but it fits pretty much all cap ships, with an exaption for the bretonian gunboat, which is massivly oversized on its own.

ok, assuming your done with the scaling part, now lets move back to adding hardpoints.

open up the gun's CMP file, and hit the "new" button in HardCMP.
mark the hardpoints as a "revolute"and hit "not from list"
the dialog box should be white now enabling you to type, so type this:

HpConnect

click on OK, and posision the new hardpoint's EXACT(!) CENTRE to the point which you want the gun to connect with the ship.

the gun *should* be configured with a full 360 degree rotational connect point, if its not, change is to be so.
thisll enable to gun to rotate freely around should the hardpoint its going to connect to allow it.

new hardpoint, again, mark it as "revolute" and hit "not from list"... name it:

HpFire01


DONT HIT OK JUST YET!
this is the point from which the projectile comes, it can either be set up as directional point(rotation 0 degrees), or as omnitarget point(360 degrees all round, does not need turret to rotate)

now, from the dropdown menu, assuming you named and organized the groups i MS3D properly, there should be 2 options, "root" and "*weaponname*-barrel"
hit the **-barrel entry.
this will link the hardpoint to the barrel, enabling it to angle and fire properly.

now set up the hardpoint to match up with the barrel, hit save CMP, click on OK if it askes you if your sure, and PRETO!

your done

Return to Freelancer Editing Tutorial Forum