Exporting a Custom Weapon
-
I go on about FL wanting CMPs to be multi component, as far as weapons are concerned you don’t have a choice, if you don’t have a separate component for the barrel then the model will only rotate, it will not track up & down following the target.
The model is seriously primitive to allow you to follow what I’m doing.
It’s nothing more than 3 boxes and 1 cylinder, but that’s all you need for the basics of gun exporting. First we have “box01” (yellow), this is the point that the weapon is attached by and has to be the first group in milkshapes group list, then it’s “cylinder01” (purple), which goes second in the list. “box02” (light blue) goes third, and “box03” (red) goes last. Now we need to rename each group or FL won’t use them right, “box01” becomes “somename_base”, you can use any name you like but it must end in “_base” for it to work, “cylinder01” you can call anything you like as it’s name will be lost on export. Then we have “box02”, like “box01” you can use anything you like but it must end in “_barrel” for it to work, “box03” can be anything you like it as it to will lose it’s name on export.Now we need to set the pivot point for the barrel -
As you can see from the picture the model is well off centre, this is important as FL will be using the centre point as the pivot, so I have moved the model until milkshapes centre axis is right where I want the weapon to pivot. For those that want to be smart, centre your model and then use the new version of UTF Edit to alter the REV node, it just means working out the coordinates in milkshape of where you want the pivot and transfering them into your CMP’s REV node.Now to export your gun -
This is my settings for this tutorial’s basic gun, the top half you should be familiar with, orientation, model type, settings, LOD & scale are no different to what most of you use (I hope). The bottom half is where most of you will get lost, what we have here are the “Group Options”, this is where we create a multi component CMP. “Number of Groups” most of you leave as 1, which means your exporting a single component CMP (or a 3DB in a CMP shell), for a gun we need a minimum of 2, WTF? “Group Quantities” has suddenly lit up. This is where we assign milkshape groups into the required components, in the case of this tutorial that’s 4 groups split into 2 components, “box01” & ”cylinder01” will become component one or in FL terms the “Root”, “box02” & “box03” are combined to make component two (our barrel).
This is what this gun looks like in UTF Edit, notice the last 2 nodes, yep that’s the 2 components for this gun, a “base” & a “barrel”. Although there is no actual mesh data in these nodes, they do hold the “rigging” info that FL needs to make the gun work.How you hardpoint it is entirely up to you as you can do it in milkshape & HardCMP without any real problems. Weapons only really use 3 hardpoints, HpMount & HpConnect get assigned to the “Root”, while HpFire01 gets assigned to the “barrel”(yes folks, no more of this ‘just stuff it on the root’ nonsense). HpMount is used to attach it to the FL engine, HpConnect to allow it to attach to the weapon hardpoint on a ship(very important :p), and HpFire01 is where you shoot from, you can have more than one HpFire, just remember that in FL you only get weapon sounds on guns with one HpFire, two or more and the gun is silent, to over come this you need the Tutorial by Parabolix from the old site.
Note
How you built and order your models in milkshape is important, learn to see your model in component form and organize your group list accordingly, never regroup your model by texture, it might look good in a render but works against you if you want to be fancy with FL. -
This is very good info, many thanks for the clarifications Bejaymac.
One comment:-
This is what this gun looks like in UTF Edit, notice the last 2 nodes, yep that’s the 2 components for this gun, a “base” & a “barrel”. Although there is no actual mesh data in these nodes, they do hold the “rigging” info that FL needs to make the gun work.
My game was freezing and crashing and I spent days thinking you meant that there was no weapon mesh data after exporting the model.
Nope, it is complete at this stage. The sur file I had made was the cause of my problems. The weapon model itself was fine after export in 2 groups, even when I made a test model with many component parts for each group.
Warnings:-
One!
When you export anything, the scale is always 1/92 until you click on SAVE Settings or LOAD Settings. Even when you move the slider to 1! So save yourself a lot of frustration - set your scale to 1, set Orientation “back-to-front”, and CLICK SAVE Settings, save them as weapons.ces and you should be in business, just LOAD settings next time and set your name and groups and groups quantities.Two!
If you want a gun with several barrels, ensure there is only one part named xxxx_barrel. List any barrel-bits under it. Then for your second barrel call it something like “barrel2” and call its bits “barrel2bit1” etc. Like this…xxxx_base
basepivot
basepin
basespigot
xxxx_barrel
barrel1bit1
barrel1bit2
barrel1bit3
barrel2
barrel2bit1
barrel2bit2
barrel2bit3
barrel3
barrel3bit1
barrel3bit2
barrel3bit3Then export it as 2 groups (only 2 groups always!) and list the total number of components in each group in the Group Quantities windows. In this example that is
Group 1: 4
Group 2: 12Three!
Your weapon HpConnect hardpoint must be attached to your xxxx_base (which becomes the root), and HpFire01 to your barrel.If you make your hardpoints in MilkShape and export them with the model, then they may be attached to the wrong bits! Mine were all attached to xxxx_base for some models, and when a couple of HpConnect hardpoints were attached to the xxxx_barrel the game couldn’t attach them to the ship and of course spewed out lots of red lines in the console window.
In addition, the exporter can’t work out how to orient hardpoints and most of them end up tilted or turned or squashed, and you need to re-orient them using HardCMP anyway…
So it’s better to not waste your time, just export the weapon model without hardpoints, and add them in HardCMP later. Only HpConnect and HpFire01 are obligatory, but for conformity as Bejaymac says, do please add the HpMount too.
Four!
When you do add the hardpoints in HardCMP, my version will not allow me to enter new hardpoint names. So I opened my HardCMP exe with a hex editor and changed a couple of existing hardpoint names that I won’t use to HpConnect and HpFire and that works. Just be careful to replace existing hardpoint names that are longer than these, or you will displace the exe and it won’t work!Five!
Do NOT waste too much time creating custom sur files for your weapons. Even a simple long tapered box identical to several standard weapon surs was incorrectly exported by that blessed sur exporter plugin. If your game crashes or freezes, suspect any weapon surs that you made right away, and rename them to check. Unlike ship surs, where weird ships needed and justified the hours and days of hairpulling, it’s best to use an existing sur file from plain FL for weapons, (there are many) and just resize them to your weapon using FL Model Tool. Note that there are several weapon surs in plain FL that are upside down! Don’t use those, you can’t turn them right-way-up.Out.
;D