Tutorial - Creating new weapon models

  • A lot of fun in creating your own mod is cleaning up icons and creating your very own weapon models so they sit better on your ships.


    Osprey wrote a very fine tutorial for creating your own icons, I can't upload it here as yet. Here I will cover only creating new weapon models.


    Many thanks to BejayMac for his stubbornness on exporting two-part weapons. He is CORRECT! :)


    First of all - you will need the following:-


    a) A clear head!
    b) Creative thoughts!
    c) Patience. Well OK, I'm going to save you a lot of hair-pulling if you follow my suggestions.


    d) MilkShape and the CMP Exporter v3 plugin
    e) GMAX-12 and MilkShape and the CMP Exporter v3 plugin
    f) Any other modelling program and MilkShape and the CMP Exporter plugin
    g) DDS Converter-2 for DDS conversions for your textures. Or The GIMP or PhotoShop and their DDS plugins if you are going to create your own fancy textures.
    h) HardCMP
    i) FL Model Tool


    j) Time
    k) Coffee/Tea/Pepsi/Shark/etc by the gallon - you may want to prepare a flask earlier!
    l) Pep-pills or eyelid propper-uppers
    m) This tutorial on a couple of sheets of white paper that's easy to read at 06:00 am after 12 hours at it.
    n) A Sense of Humour!


    :D


    Creating your own weapon is easy, use MilkShape or GMax 12 as it is free (or used to be free). But then you must import it into MilkShape because you need to export it as a .cmp file and the only exporter I know of is for MilkShape. But then MilkShape costs very little and it is a satisfying thing to create your own ships as well as weapons. SO GO BUY IT! :roll:


    There are 3 things needed for weapons:


    1. A weapon base - this can be a simple cube or brick shape or cylinder, whichever suits your weapon best. For one of mine I wanted a sphere as a base housing, so I just created a sphere. Done!


    But it MUST be named xxxx_base in MilkShape.


    2. The barrel, smoke-stack, ejector - whatever you want to call it. It can be as simple as a single horizontal cylinder. Done! Move it so the hinge point is somewhere inside your base or somehow overlapping it or touching the top of it or is otherwise in a kind of contact with it. More Done!


    But it MUST be named xxxx_barrel in MilkShape.


    3. A .sur file that covers most of the weapon, so it can be hit by gunfire. This you CANNOT create, my experience was very bad so I advise you that if you want to try then please do go ahead, but if your game freezes or crashes to desktop then delete your own sur file and do the following:
    a) go find an existing standard FL weapon and open it in HardCMP from its own folder. Press 'S' in HardCMP to bring up the weapon's .sur file. See if it is similar shape to your new weapon. If it is, copy it into your new weapon's creation folder and rename it the same as your weapon's .cmp file name. If it is not - go do the same with another standard weapon and repeat, until you find one that is almost a good fit and use that one!


    NOTE - some standard FL weapons have sur files that are upside down! These are errors, DON'T use one of those sur files, you can't turn it right way up!


    OK - back to your new super-weapon.


    1 a) Once you have created the base and barrel(s) (Beyond the Scope of This Tutorial! Sorry! 8-) )


    You can have more than one barrel but they must be in a single group, I'll discuss this further down.


    Then make sure your xxxx_base group is at the top of the list in MilkShape's Groups tab.


    b) If you want to make a multi-part base then go ahead, this is fine - but you MUST ensure that all of the parts are placed immediately below your xxxx_base group, as for example ...
    xxxx_base
    base_pivot
    base_olive
    base_spigot


    c) If you have a barrel with more than one part you can either regroup those parts into one group if they have a single texture, or if they use different textures then ensure they are listed AFTER your primary barrel, as follows:-
    xxxx_base
    base_pivot
    base_olive
    base_spigot
    xxxx_barrel
    barrel1_breech
    barrel1_spline1
    barrel1_spline2
    barrel2
    barrel2_breech
    barrel2_spline1
    barrel2_spline2


    Do NOT create Hardpoints!! You can if you like of course, and they must be named Hp|Revolute|Hpxxxx or Hp|Fixed|Hpxxxx, and they must be come at the end of the groups list after ALL of the weapon components. But in my experience the exporter attaches them to the wrong part of the gun sometimes, and their orientation will be incorrect and you will have to fix them in HardCMP later - so you should NOT make them in MilkShape now.


    d) Ensure your materials are .DDS format and NOT .TGA, and also ensure they are 256 x 256 x 24bpp (bits per pixel) or 512 x 512 x 24bpp or MAXIMUM 1024 x 1024 x 24bpp. If possible, TESSALATE all of your different textures into ONE large tile that is SQUARE and at most 1024 x 1024 x 24bpp. Then you can remap the textures in MilkShape (fairly easy and BTSTT - Beyond The Scope of This Tutorial - sorry!). If not then you must ensure that EACH texture is .DDS format and 256 x 256 x 24bpp or 512 x 512 x 24 bpp etc. You can use a wonderful utility DDS Converter 2 to achieve this. Use DDS DXT1 or DXT3 format, both worked fine for me and I think I use DXT1 mostly.


    Name your material AND the DDS file similar to your weapon's name, and KEEP IT UNIQUE! If you have a range of new weapons using the same texture file then this is fine, I use for example the same textures for all my Narn Empire weapons and I use the name NarnWeapons.mat for the material and NarnWeapons.dds for the texture filename.


    e) Export your materials file as a NEW .MAT file (don't import the textures into the .CMP, although this can be done it's not standard FL policy). Remember to name it something unique as above.


    f) Select all of the components of your weapon in MilkShape, and then move the entire weapon until the pivot point (the point around which the barrel will hinge up/down and also the point around which it will swing left/right) is at absolute 0 (X=0, Y=0, Z=0). This is because FL will swing the barrel up/down at the absolute 0, and will also swing it left/right around absolute 0. So if you don't centre your weapon's pivot point there, then your weapon will swing incorrectly and look sad! Or alternatively your weapon may look more cool swinging and pivoting off-centre, its a pure personal thing for you to decide, especially if you model your weapons on some Kusari guns that have barrels off-centre.


    g) Deselect all your weapon's parts and save your weapon as an .ms3d file. If you don't then later on you may wish you had! :D


    h) Click the Groups tab in MilkShape so you can see the gun's components. Note HOW MANY components follow the xxxx_base group and how many follow the xxxx_barrel group - my example above has 3 components after the base and 7 after the primary barrel xxxx_barrel. So the base consists of 4 parts and the barrel(s) consist of 8 parts. Remember yours.


    i) Click File... Export... and start your .CMP exporter plugin (use v3, v2 does NOT work correctly for weapons).


    j) If this is the first time you are exporting a weapon, then Set Scale Down (Divided into X, Y, Z) = 1. Now click the Orientation = Back to Front and Model Type = Weapon radio buttons. Now ensure Level of Detail = Level 0, and change No of Groups = 2. Do NOT use any other count! Ignore the Group Quantities boxes for now. They can be different for different weapons you make.


    Now click on Save Settings and save them using the weapon name or weapon series name, or even just a general name (I use weapons.ces).


    Or if you already did this step earlier and saved your settings, then click on LOAD Settings instead and retrieve these settings.


    Why? You MUST either Save Settings or Load Settings, or else the Scale Down value will NOT change to 1, even if it shows '1' - it will actually reduce to 1/92 of the size you have made your model, this is a bug in the exporter plugin.


    k) Click on the Export File Option: CMP button and give your new weapon its name, e.g. Narn_Medium_Gun.cmp


    l) Set the Group Quantities for Group 1 = 4 (this is the total components that make up my weapon's base in the example above) or set yours to whatever you have. If you have only a single-part xxxx_base then set yours to 1.


    m) Set the Group Quantities for Group 2 = 8 (this is the total components that make up my weapon's barrels in the example above) or set yours to whatever you have. If you have only a single-part xxxx_barrel then set yours to 1.


    n) If you have set everything that is needed, the Continue button will be enabled. If not then check all the clicks I mentioned above again! When it is enabled, click it.


    o) You will now see a confirmation screen in "UTF tree" format. Open all the "nodes" by clicking the + signs. Look through them and you should find:-
    xxxx_base_lod0.vms,
    Cmpnd...Cons...Rev,
    Cmpnd...Root,
    Cmpnd...Part_xxxx_barrel_lod1,
    xxxx_base_lod1.3db,
    xxxx_barrel_lod1.3db.


    If you created hardpoints you will also see those under the part to which they have been attached. In my experience the HpConnect and sometimes the HpMount Hardpoints were often attached to the barrel instead of the base, and it will not work, those two MUST be attached to the xxxx_base_lod1.3db node. The HpFire01, HpFire02 etc hardpoints MUST be attached to the xxxx_barrel_lod1.3db node. In either case there is nothing you can do now even if you can see there is an error. Click the Continue button to create the .cmp file. If you did create hardpoints and they were correctly placed, then continue with this method. If there was an obvious mistake, fix it and re-export your .cmp file and then continue.


    NOTE - if your weapon has more than one barrel and more than HpFire01 then your gun shot sound will not work, there was a subject on this fix on the old forum - BTSTT! 8-)


    p) Open your new .cmp file in HardCMP. If you made your hardpoints in MilkShape and they were correctly exported, then just ensure the orientation is correct, and if you already chose an existing .sur file press 'S' to see how it fits. Don't worry if it's right way up but wrong size, we can fix this later. If it's upside down then you have a problem, either you accidentally exported your weapon upside down instead of Back to Front, or the .sur you picked is really upside down - in this case you will have to choose another one. Sorry! :(


    If you followed my advice and did not make hardpoints in MilkShape then we will make them now, fast and easy...
    1. Click New, ensure Attached to = Root, click Revolute if you want your gun to rotate or Fixed if you want it to not rotate (I have fixed guns on my fighters, like aircraft wing-inset guns). Check Not From List and uncheck Use numbering scheme. If your name window changes to white and you can type in HpConnect then do this and click OK and all is fine. If it does not allow you to do this, like mine, then click the Name drop-down list and select DpConnect and then click OK.


    2. Enter the Position X, Y and Z values you estimate to place the centre of this hardpoint exactly where the gun will mount on the ship's HpWeaponxx or HpTurretxx hardpoint. Enter the Orientation you want (e.g. X for left/right tilt, Y for down/up tilt, or Z for left/right rotation. If your HpConnect is Revolute then set the Angle Max and Angle Min to whatever you want if not 45 and -45. If it's a gun then consider using settings to avoid it shooting your ship's fuselage. If it's a turret then you may want it to turn Angle Max = 360 and Angle Min = -360. Up to you. Click Validate and check it is in the right place and tilted/turned to be as you want it. If it's wrong then click Edit and change one value at a time until it's where you want it to be.


    I haven't found a use for the Apply button yet, if you know please tell, and also why my hardpoint name window doesn't allow me to enter new hardpoint names? :?


    3. Do the same as step 1 to make your HpMount hardpoint, if you want one. This time it exists in both drop-down lists. It's apparently used when you see the weapon mounted on a technician's trolley at the equipment dealer - mine never show because the scripts at the equipment dealers I have at my new bases where the weapons are sold do not allow this. So the HpMount is not mandatory. And then do also Step 2 to place this hardpoint where and orient it how you want it.


    4. Click New, ensure Attached to = xxxx_barrel_lod1, click Fixed. Check Not From List and also check Use numbering scheme if it's not already checked. If your name window changes to white and you can type in HpFire then do this and click OK and all is fine. If it does not allow you to do this, like mine, then click the Name drop-down list and select Hpxx and then click OK. It will become Hpxx01.


    5. Do step 2 for this hardpoint and place it so its centre is exactly at the tip of the primary barrel where you want the firing flame to appear. If your gun is small you may need to set the Y position to 1 or more to lift the cube up so you can see, then drop it back when its forward/back and left/right position are correct. There is no need to change the orientation, and there will not be an Angle Max/ Angle Min setting as this hardpoint is fixed.


    When you have more than one barrel then repeat steps 4 and 5 for the remaining HpFirexx hardpoints, one for each barrel. Don't worry if they are named DpConnect, and Hpxx01 Hpxx02 etc, we will fix this shortly.


    6. Click Save As (NOT Save) and save your weapon model, but NOTE: If you saved it before already and you want to overwrite the same file, you MUST select the file and press Delete before saving, because if you do not do this, HardCMP has a bug that adds more than one copy of a new hardpoint, and it also cannot overwrite read-only files, but does not tell you this has happened! You will discover these problems only when you re-open the model file with HardCMP again. So save yourself some time by doing it this way each time.


    7. Re-open your model and check the hardpoints are connected to the right part and look right. If all is well, then close HardCMP. Go to step


    8. If your hardpoints were named DpConnect and Hpxx01 etc because like mine your HardCMP will not let you enter new hardpoint types, then open your weapon .cmp in UTF Edit. Open the xxxx_base_lod1.3db node, ensure the DpConnect hardpoint is there. If it's not then you made a mistake in the creation, go do it again! If it's there, click on it once, wait a second, and click on it again - the blue selection highlight on the name will become an edit window, allowing you to change the name to HpConnect. Then click away from the hardpoint name and the name edit window will close. If you made an HpMount hardpoint and it is also under xxxx_base_lod1.3db then all is well - if you didn't make one, then again all is well. But if you made one and it's in the wrong place, for example under the xxxx_barrel_lod1.3db, then you have to go back and do it again! :?


    9. Open the xxxx_barrel_lod1.3db node, and find the Hpxx01 hardpoint. Using the same method as for HpConnect, rename Hpxx01 to HpFire01. If you have more than one barrel then you will have Hpxx02, and maybe also Hpxx03 and so on under the same node, xxxx_barrel_lod1.3db. Rename each of those to HpFire02, HpFire03 etc. When all are done, click Save File As, delete the old file by selecting it and clicking Delete, and then ensure the name in the window is correct and click Save.


    All done.


    q) Now we will resize the .sur file.


    1) Open your model cmp file in FL Model Tool, wait for the values to stop scrolling. If the Original Data Radius and New Data Radius numbers are not the same, click Save, delete the old file by selecting it and pressing Delete as before, and save it with the same name. Reopen the cmp model file.


    If the two radius values are the same then continue...


    2) Click the SUR tab and load in the xxxx.sur file you created ( :shock: silly billy, after everything I said too!! :lol: ) or copied from an existing standard FL one. Click Resize, click Scale Factor = Automatic (to CMP), click Weapon/Ammo/Damage Object, uncheck Make all components part of hull (Custom ships only) and click OK. When you see Use xxxx.cmp for resize data? click OK.


    When the data stops scrolling, click on Save... and go save your new sur file, BUT remembering it must be the same name as your weapon's .cmp file (uh... :? yes, but with the .sur extension and NOT .cmp, or you will overwrite your model with a sur file silly! :shock: ).


    Umm... if you can't see the .cmp or .sur extensions, then you need to disable "Hide extensions for known file types" in Windows Explorer's - Tools - Folder Options - View tab. Vista's method is Way Beyond the scope of this tutorial, sorry!


    OK, you should now have:-
    weapon.cmp
    weapon.sur
    weapon.mat or weaponrange.mat


    Right! Put them all into the Freelancer\DATA\EQUIPMENT\MODELS\WEAPONS folder for guns, or the Freelancer\DATA\EQUIPMENT\MODELS\TURRETS folder for turrets (or else wherever you like! :lol: ).


    Go open your weapon_equip.ini, add the new weapon (BTSTT - Beyond the Scope of This Tutorial! Sorry!) and change the following lines in the [Gun] section:-


    for guns:-
    DA_archetype = EQUIPMENT\MODELS\WEAPONS\xxxx.cmp
    material_library = EQUIPMENT\MODELS\WEAPONS\xxxx.mat


    or for turrets:-
    DA_archetype = EQUIPMENT\MODELS\TURRET\xxxx.cmp
    material_library = EQUIPMENT\MODELS\TURRET\xxxx.mat


    OK, now also make an entry for your gun in \DATA\EQUIPMENT\weapon_good.ini (BTSTT!! 8-) )


    Now if you want it to be sold make an entry for each base in \DATA\EQUIPMENT\market_misc.ini (BTSTT!! 8-) )


    And put it into the DATA\SHIPS\loadouts.ini file for each NPC ship that will carry it (BTSTT!)


    And in the \DATA\EQUIPMENT\goods.ini file for the ship you want to have the new weapon mounted when players buy it (BTSTT!)


    And finally if you want it to be dropped as loot when you kill an NPC who is carrying one, make an entry in \DATA\MISSIONS\lootprops.ini in the [mLootProps] section or [PhantomLoot] section (or both!) - (BTS... yes, you got it! 8-) )


    Now hopefully, I didn't forget anything or mistype too much, as it is 06:04 now here after all....
    Uhhh... where are my glasses?? Oh... heheh... on my head! :oops:
    Hmmm.... :P


    G'night! :mrgreen: