Jimiz Posted October 15, 2005 Report Share Posted October 15, 2005 This is tutorial for importing a weapon from Gmax to BF2. Parrot sketch is not included. Ok, a few words before I begin. I am by no means an expert and that will show. Yet, I am willing to risk that as I very strongly oppose hoarding knowledge and as it seems that many have problems with this stuff, so I thought to share what little knowledge I've gained on the area. I hope that atleast someone will find the information provided here helpful. I am sure that there are more efficent and delicate ways of achieving all this and I want you to know that during the course of this tutorial I'm going to just smash everything in place with bruteness that will probably leave the more seasoned modellers gasping in horror due my lack of finesse. But it works, and I'm content And still before we begin I want to emphasize that I don't feel that I'm the architecht here, I'm merely piecing together what others have done before me and therefore I wish to acknowledge the huge groundwork laid out by all those before me. Among many others, I want to especially thank the creators of this knife tutorial and [bFP]Kev for his hierarchy tips. For this tutorial, you will need the following programs: -Retail Battlefield 2 -BF2Editor -Gmax 1.2 -Gmax tools for BF2 -Irfanview The aim is to achieve all this with using free programs only, as personally I really can't afford to spend several hundreds of dollars in software that I'd use only as a hobby. **** Edit: I knew I had forgotten something; alas! the example model, grab it here BF2tut2.rar (38kb) This should make your first atempts on exporting easier as you can truly follow the tutorial step-by-step **** Chapter I - The groundwork -This tutorial doesn't actually create a new weapon from scratch, more accurately spoken, it replaces an old one. Because of this, it's important to think a little ahead: if you replace a bullup type a weapon (like the L85A1) with a weapon that's got the "classic" clip placement, animations will look a bit dodgy. This is because this particular tutorial will have nothing to do with actual weapon animations, but depends on the vanilla ones. -You naturally need a model and some textures for it. I've created a model for this tutorial that uses the L85's textures so for that, I went to /battlefield 2/mods/BF2/objects_client.zip -> /weapons/handheld/usrif_sa80 and extracted the whole folder including sounds. Make sure all the parts of the mesh are Editable meshes. -Then I opened up the usrif_sa80_c.dds with irfanview and saved the file as .tga and did my uvmapping stuff in gmax with that. Chapter II - Creating hierarchy -Open up Gmax with the BF2 tools -Now we need to start creating the hierarchy, first select the main body of the weapon and name it mesh1_Fp__GenericFireArm, select your clip and name it 1, select your trigger and name it 2, select your flap/bolt and name it 3. If your gun has got a fire selector, name it 4. At this point you're scene shouldn't have anything else, if there is, just attach them to the main mesh. Pressing "Select by name" at this point should produce results astonishingly like this: -Now, select 1, 2 and 3 and then click on "Select and link", then click "Select by name", select mesh1_Fp__GenericFireArm and click Link. Something a little like this: -Congratulations, you've now created your very first hierarchy! REMEMBER TO UNCHECK "Select and link" at this point! -If you click "Select by name" again and then check the "Display subtree" option, you should now see 1,2 and 3 below mesh1_Fp__GenericFireArm a little bit indented. That means that they are now children of the main mesh. -Now, create a Dummy and name it root_bundledMesh_WEAPONNAME. In my case that is root_bundledMesh_usrif_sa80 as my weapon is going to replace the L85. -Create two more dummies and name them geom0_1p and lod0 -Select geom0_1p, click "Select and link" -> "Select by name" -> root_bundledMesh_usrif_sa80 -> "Link" thus making it a child of the root_bundledMesh -Now select lod0 and make it a child of geom0_1p -Select mesh1_Fp__GenericFireArm and make it a child of lod0 After these steps, you're hierarchy should look like this: -Ok, now's the time for a little magic trick. -Select geom0_1p then on the top bar go to "BF2 -> BF 2 utilities" then on the left menu choose "Clone /w childs (copy)" and hit "Run util" -Now go to "Select by name" again. The hierarchy might look a bit messy right now, but don't get afraid, keep your head cool and select either one of the geom0_1p (there should be two of them now) entries and rename it to geom1_3p. Tada! Now your hierarchy should not look much dissimliar to this: -So, on we go! Time to create another Dummy, call it lod1 and make it a child of geom1_3p -Select either one of the mesh1_Fp__GenericFireArm meshes, use the BF2 utilities again Clone /w childs (Copy) then again, select the clone and make it a child of lod1 -Under lod1, attach 1,2 and 3 to the mesh1_Fp__GenericFireArm, making them a single mesh. -Hide the other two meshes, leaving only the one under lod1 visible. Now do your best to crop it down as this is the mesh that is visible from longer ranges so there's no point in keeping it very high poly. A good tool here is "Optimize", don't be shy with the settings, it's enough if you retain just the general shape and colour. -When you're happy with the results, unhide all the rest. Hierachy should look like this now: -On we go! Now, create a dummy, again and name it lod1 again, then make it a child of geom0_1p -Create a plane and name it something like Scope, then make it a child of the lod1 you just created. (I've intentionally left this like this as I'm not too good with scopes myself atm :oops: Don't worry, you can come back to this later.) -Now our hierarchy is done! -Your hierachy should look exactly like this: Chapter III - The actual export -So, now we've got hierarchy stuff done so we're ready for the export -First we need to get the paths right. Unless someone hasn't gotten it yet, you need a mod, just a blank MyMod will do just fine. -Goto "BF2 -> BF2 exporter" and click "Run setup" and set the paths to your satisfaction, for reference, here's my setup: -When you hit export, a file called "usrif_sa80.bundledmesh will be created in /battlefield 2/mods/YourMod/Objects/Weapons/Handheld/usrif_sa80/meshes -Then just hit export and open up the BF2editor. Go to animation editor, on the left-hand drop-down menu select BF2 -> Objects -> Weapons -> Handheld -> Usrif_sa80" and then drag and drop the entry over the soldier model (your mod has to have all parent mod content loaded for this to work. -It is very likely that at this point your model will look a bit like mine; oversized, ill-oriented and untextured. But not to worry, that is to be expected. -Okeydokey, now you've got your gun in the editor. In theory you could now just pack up the mod and launch it and the gun would be there, but taken into consideration it's current state, that would be just utterly pointless, don't you agree? Good, then we'll move on to The-Most-Annoying-Thing-You've-Ever-Done. Chapter IV - Desperation -So we've estabilished that the model is quite severely fracked up at the moment. Obviously we have to do something about it and in my personal opinion, the steps that follow are the most infuriating thing about the whole process and it is highly probable that the following manouvers will leave you seething in fury and smashing small household items around you. That's the case with me atleast, though I bet you a wooden nickle that there are much more effiecent ways of achieving this but due to my own inexperience, I am unable to present them here. Anyhow after this highly encouragin prologue, into the fire we go! -Still in BF2editor, go to the Object editor and load your gun there with the familiar drag 'n drop manouver. You can now probably see that the sub-objects are in the wrong place and that everything is quite messed up. Leave the editor there and go back to gmax -Now we need to re-link the sub-objects ie. triggers, flaps and magazines to the lod0's and then select all three meshes and their sub-objects like this: -Then you need to Step 1. - go to the "Hierarchy" - tab, select "Affect pivot only" Step 2. - right click "Move" and set "Absolute: World" to X,Y,Z = 0,0,0 Step 3. - click "Reset transform" under the hierarchy tab -Now re-link the hierarchy, the sub-objects back to their places like they were before: -Now select again all the three meshes and subobjects -Now, double-check that you've still got "Affect pivot only" selected on the right-hand "Hierarchy tab" -Now right click "Rotate" and set X,Y,Z = 0,0,0. This is important: the model should not move a bit, if it does, you're doing something wrong -It's time to export again, check that the paths are the same and hit export, don't close gmax, but switch back to BF2editor (which you should've left open, remember?) Object editor, now hit "Reload geometry" on the right-hand menu. The model should now have the correct orientation and all the sub-objects should be in their right places. -Go to the Animation editor again, drag and drop and make sure that the orientation is right ie. the barrel is pointing in the right direction and that everything else in place too (albeit a little off-scale) Testing animations in this phaze may produce rather amusing results Chapter V - Tweakin' -Now starts the tedious part, as far as I know, there's really no quick way through all this, you just have to kinda play it by ear. -This is the part in which we scale the model into the right size and change it's position so it fits the soldiers hands. -First we'll scale the model in to the right size, for this, you need to once again re-link the sub-objects to the lod0's like we did a while back: -With "Affect pivot" still selected, scale down the model and then hit "Reset: Scale" on the right. You have to estimate here. You can export the gun to the editor with the sub-objects "ill-parented" so you can do comparisons on the sizes, but you cannot see it in the animation editor. Remember, you always have to re-link the sub-objects, if you just try to scale down the model with the normal hierarchy, only the main meshes will be scaled down while the sub-objects remain the same size, not pretty, mind you So the drill here is: +Re-link sub-objects to lod0's (gmax) +Scale (gmax) +Reset scale (gmax) +Re-link sub-objects to the main meshes(gmax) +Export (gmax) +Reload geometry (BF2editor) +Check the mesh's size compared to the soldier model in animation editor (BF2editor) +Go back to square one if need be. (as is highly possible) Ok, so after some trial and error, we've got the scale about right: -Now we see that it's a bit misplaced, we need to move it a little back and down, so back to Gmax -Select all three meshes, make sure the sub-objects are in the right place in the hierarchy (under the main meshes). Now with "Affect pivot only" still selected, zoom up and close to the model so you see this bunch of colorful arrows. -With the move-tool, move the arrows, not the model, according to your needs, something like this: As you can see, I have to do the exactly opposite corrections. Then just export again, reload geom in the BF2editor go to the animation editor to see the results: All right! Almost there! Chapter VI - Finishing up -Now, Let's have some textures! -Remember when I told you that I unzipped the original "usrif_sa80" folder from the objects_client.zip? And when I told you the folders & files created by the exporting? Now we're going to put those two pieces of information in use. -Copy the "textures" folder containing usrif_sa80_c.dds and usrif_sa80_b.dds and the "Sounds" folder from the zip to /battlefield 2/mods/YourMod/Objects/Weapons/Handheld/usrif_sa80 -Back to Gmax. Open up material navigator and delete whatever materials there might have been. -Select all three meshes and sub-objects and the scope -Go to material editor. Click "New" and select "BF2 bundledmesh" -Now, you have manually type in the location of the .dds textures you just copied, for example, my paths are COLOR: D:Battlefield 2modsSOTFobjectsWeaponsHandheldusrif_sa80texturesusrif_sa80_c.dds NORMAL D:Battlefield 2modsSOTFobjectsWeaponsHandheldusrif_sa80texturesusrif_sa80_b.dds Then just click "Apply" and export. -In BF2editor, -> Reload geometry and the textures should now be visible: Great, huh? -Ok, we're almost there, the only remaining thing to do is to go in to BF2editor and click "Mod -> Package mod" and select "Package active" -Load up the game and after all that agony and swearing, it's all just sunshine and rainbows now That's about it, then. Naturally there are some minor things still, like, *uhm* the scope. But you can still do the modifications quite easily: modify in gmax -> export to editor -> package mod again. I'm sure that I've forgotten something and that there is something else amiss with the tutorial, but such is life, I'll do the corrections as they pop up. All rights reserved, please don't kill me, happy halloween, kthanxbye. Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 15, 2005 Report Share Posted October 15, 2005 Excilent Quote Link to comment Share on other sites More sharing options...
[IDF]SPYKER Posted October 15, 2005 Report Share Posted October 15, 2005 man. i think until now, this is the best tutrial for BF2 i ever see, lot of picture, lot of discr'... really awsome, keep it up, and make more tutrial like this :wink: Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 16, 2005 Report Share Posted October 16, 2005 hey I think you are forgetting the barrel objects... like where the muzzle flash and projectile are created? Dunno if you are or not, but this tut keeps leading me to dead ends.. think we are missing something... Quote Link to comment Share on other sites More sharing options...
BEEX Posted October 16, 2005 Report Share Posted October 16, 2005 very good tut...even though i dont use gmax..i am sure alot of peeps will be greatful to ya...keep up the good work "nevar" the things missing form the tut are explaining tweak files and animations,just copy a similar guns animation files and maybe do the same with tweak files..and rename all instances of the original guns name to your guns name in animation and tweak file. Quote Link to comment Share on other sites More sharing options...
JD7 Posted October 16, 2005 Report Share Posted October 16, 2005 I don't use gmax, but your tutorial is of a high standard - nice work, I'm sure other modders out there will benefit from your hard effort Quote Link to comment Share on other sites More sharing options...
annerajb[Bfs] Posted October 16, 2005 Report Share Posted October 16, 2005 if you want to get a scope working make lod1 under geom0 and make a plane in there that will work. Quote Link to comment Share on other sites More sharing options...
[R-DEV]requiem Posted October 16, 2005 Report Share Posted October 16, 2005 Thanks for the tutorial, great stuff I have a quick question regarding the drag and drop once in the animation editor, I receive the error "Failed to load object. Not a weapon, kit or vehicle." Any ideas anyone? Many thanks! Quote Link to comment Share on other sites More sharing options...
Jimiz Posted October 16, 2005 Author Report Share Posted October 16, 2005 ]if you want to get a scope working make lod1 under geom0 and make a plane in there that will work. Uh, yes. That is exactly what is done in the tutorial if you look closely, but that alone leaves you just with a, well, uhm, a plane in front of your gun So basically, yes, I know how to create a scope mesh, I just don't know how to refine it. But I'm getting there and once I feel I've mastered the task, I'll post ye' a follow-up (unless someone beats me to it *wink, wink, wink* ) requiem]Thanks for the tutorial, great stuff I have a quick question regarding the drag and drop once in the animation editor, I receive the error "Failed to load object. Not a weapon, kit or vehicle." Any ideas anyone? Many thanks! That error usually comes because of faulty hierarchy, ie. make sure you've got your sub-objects (clip, trigger, flap) parented to the mesh1_Fp__GenericFireArm, NOT to the lod0's. Quote Link to comment Share on other sites More sharing options...
[R-DEV]requiem Posted October 16, 2005 Report Share Posted October 16, 2005 Jimiz, yeah that's what it was, thanks (always forget that extra "_") Now I just need to figure out how to apply the default M4 animation... Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 16, 2005 Report Share Posted October 16, 2005 requiem]Thanks for the tutorial, great stuff I have a quick question regarding the drag and drop once in the animation editor, I receive the error "Failed to load object. Not a weapon, kit or vehicle." Any ideas anyone? Many thanks! I get the same error... forsomereason however when I do the 'magic trick' and make copies of the parent and children, it makes a whole list of cylinders,lines, and boxes and adds them to the clone hierarchy... if I delete them I loose my mesh. I think it's because my main gun mesh is several objects grouped together... you said name the main section of the gun mesh1_Fp__GenericFireArm so I selected all the parts that make up the gun except the trigger, clip, and flap, and grouped them, then named the group mesh1_Fp__GenericFireArm in the hierarchy this makes [mesh1_Fp__GenericFireArm] All copies after this one have the mesh1_Fp__GenericFireArm with no brackets, but have a long list of my cylinder and box objects. Is the grouping a problem or am I messing up somewhere else? Quote Link to comment Share on other sites More sharing options...
[R-DEV]requiem Posted October 16, 2005 Report Share Posted October 16, 2005 Show us a screenshot of your hierarchy, that'll help! Quote Link to comment Share on other sites More sharing options...
[BF:A]Hitpawz Posted October 16, 2005 Report Share Posted October 16, 2005 a b c Quote Link to comment Share on other sites More sharing options...
[R-DEV]requiem Posted October 16, 2005 Report Share Posted October 16, 2005 So what is the correct naming for the magazine, trigger, fire selector, T-Bar, etc.? Many thanks in advance. Quote Link to comment Share on other sites More sharing options...
[BF:A]Hitpawz Posted October 16, 2005 Report Share Posted October 16, 2005 a b c Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 17, 2005 Report Share Posted October 17, 2005 dunno what's up with it Quote Link to comment Share on other sites More sharing options...
[BF:A]Hitpawz Posted October 17, 2005 Report Share Posted October 17, 2005 a b c Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 17, 2005 Report Share Posted October 17, 2005 *points stupidly to tutorial..* but says 1-3 and stuff... *drools* Quote Link to comment Share on other sites More sharing options...
Jimiz Posted October 17, 2005 Author Report Share Posted October 17, 2005 dunno what's up with it You have to Attach all those, "Box01", "Line0" etc. to the mesh1_fp__GenericFireArm", use the "Attach" function on the right-hand menu under the tab "Modify". First select the mesh1, then click "Attach" and click all those boxes and lines. Remember: everything that is not a clip, a trigger, a bolt or a fire selector, has to be attached to the main-mesh. --- After some testing, it would seem that it doesn't matter at all what you name the sub-objects, I got the parts actually named like this: And as you can see from the pic, the animations still work. I also tried naming the sub-objects like Hitpawz suggested and the results were exactly the same. So the main thing is that 1) You've got the main body of your gun, as a single mesh, not grouped, but attached 2) The sub-objects are just parented to the main body I might be full of shit here, but this is how I've got things working anyway. Quote Link to comment Share on other sites More sharing options...
bountyhunterx Posted October 17, 2005 Report Share Posted October 17, 2005 So we can name them 1 2 3 4? Quote Link to comment Share on other sites More sharing options...
Jimiz Posted October 17, 2005 Author Report Share Posted October 17, 2005 So we can name them 1 2 3 4? As far as I can tell .. yes. Atleast that's how I've named mine and they work. Maybe some of the more experienced modellers could throw in their views here? Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 18, 2005 Report Share Posted October 18, 2005 thanks for the attach gizmo tut there helps with a LOT PS... Ok that got me a new error message... [usrif_rifle] has an incorrect itemIndex -1 and cannot be picked up!! dunno what that means... Quote Link to comment Share on other sites More sharing options...
[R-DEV]requiem Posted October 18, 2005 Report Share Posted October 18, 2005 You'll find it within the object editor, it's a setting. (rifle = 3) Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 18, 2005 Report Share Posted October 18, 2005 gah... ok I fixed that error.. now I get only Uknown Object in Kit and no pop up warning... maybe it's because I didn't UVW map and give it a texture? I thought the game slaps the "Uncle Sam wants YOU" texture over it if you don't give it a different one... I dunno I am stumped... I messed with it in the Object Editor and went all through the tweak files... ;( Quote Link to comment Share on other sites More sharing options...
NeVaR Posted October 20, 2005 Report Share Posted October 20, 2005 Alrighty... had success getting a model into the editor tonight PROGRESS! Anyways I just needed to more carefully read your tutorial it all works well. Only thing I need to know is how to change muzzle flashes and stuff... I know it is somehow tied into the animation, but I put the model in place of the m16a2 and the muzzle flash is about 6 inches away from my barrel. Shell casings eject properly and all, but muzzle is off. Also, since I replaced the m16a2 it currently has single and 3 round burst... how does one activate full auto instead of the 3 rounder? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.