[tut] Uber Quick Guide To Converting

DrfuzzyDrfuzzy FEW... MORE.... INCHES... Join Date: 2003-09-21 Member: 21094Members
<div class="IPBDescription">weapon models</div> Ive gone through all these converting tutorials, and ive realized none of them just show you the quick and easy way on how to convert a model. No milkshape should be required, that is, if the model has animations that fit. (No shotguns for pistol, since the reload wouldent work)

First, you will need <a href='http://drfuzzy.nsarmslab.com/tutorials/convertingweapons/Convertingtut.rar' target='_blank'>this</a> and (if you want, but not nessassary) Jeds hlmv, which you can google you lazy punk <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile-fix.gif' border='0' style='vertical-align:middle' alt='smile-fix.gif' /><!--endemo-->

The rar includes 5 files: [studiomdl and logscript] [mdldec and decompile_all] and the half-life default .357 magnum. You will be converting the .357 to the natural selection pistol <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile-fix.gif' border='0' style='vertical-align:middle' alt='smile-fix.gif' /><!--endemo--> <span style='color:red'>The files in brackets MUST STAY TOGETHER or they will not work right</span>

Put all there in a folder on your desktop called models. Goto your natural selection models filder and put the v_hg.mdl in there with the rest of the files.

Run decompile_all, this will create 2 folders. Both folders will have the decompiled models. In the decompiled folders, you will have: refrence .smd files, animation .smd files, skin .bmp files, and the .qc file which should be named after the model's original file name (just to be easier for you to find <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html//emoticons/wink-fix.gif' border='0' style='vertical-align:middle' alt='wink-fix.gif' /><!--endemo--> )

Goto each folder and open both of the .qc files with your favorite text editor, such as wordpad.

You should see a bunch of code, I will go over what is in the code so you know what your doing. (Note: Stuff i write in red is just notes, not in the code.)

<!--QuoteBegin-v_357.qc+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (v_357.qc)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->/*
==============================================================================

QC script generated by Half-Life MDL Decompiler 1.2
2003, Kratisto. Based on code from Valve's HL SDK.

v_357.mdl

Original internal name:
"valve/models/v_357.mdl" <span style='color:red'> Ignore all the stuff up to this point, its useless</span>

==============================================================================
*/

$modelname "v_357.mdl" <span style='color:red'> This is what you want the model name to be when you compile it, since we want this to be the ns pistol, change this to v_hg.mdl</span>
<span style='color:yellow'>$cd ".\"
$cdtexture ".\"
$scale 1.0</span><span style='color:red'> Ignore this, just make sure its there and dont touch it</span>
$cliptotextures <span style='color:red'> This keeps your skin looking right, always make sure this is in the code</span>
$origin 0 0 0 <span style='color:red'> This is not in the code, but you can add it to move the whole model on a X Y Z basis.</span>

<span style='color:yellow'>
$bbox 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
$cbox 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
$eyeposition 0.000000 0.000000 0.000000
</span><span style='color:red'>Make sure these are left alone, they wont do much</span>

//reference mesh(es) <span style='color:red'>These $body strings are the refrence models. These files actualy contain the model, the $animations below only tell these files to move. Again, leve these alone. The bodygroup is a sub-model. If a game has a certian code, it will add extra parts to a model, such as the scope below when you play HL multiplayer. You can delete this string if you want, it will just remove the laster sight.</span>
$body "gun" "python_gun"

$body "bullets" "python_bullets"

$body "speedload" "python_speedload"

$body "hands" "python_hands"

$bodygroup "scope"
{
blank
studio "python_lasersight"
}


// 1 attachment(s) <span style='color:red'>This is usualy used for muzzleflashes, shell ejection locations, smoke effect locations, and all that extra stuff that comes out of the gun on certian animations. The "python_master" is a name of a bone, and the 3 numbers next to it are the XYZ location away from the bone you want. Attachments are connected to bones, so that XYZ tells it where it needs to be instead of being dead on the bone. Just leave this alone for now if it confuses you.</span>
$attachment 0 "python_master" 0.000000 -14.000000 6.000000

// 8 hit box(es)<span style='color:red'>You know what these are, Delete all of the $hbox codes and when you recompile, they will automaticly be added again.</span>
$hbox 0 "Bip01 R Arm2" 0.000000 -2.800000 -4.000000 11.368423 3.020000 1.730000
$hbox 0 "Bip01 R Hand" 0.000000 -0.870000 -1.790000 3.890000 1.030000 1.940000
$hbox 0 "python_master" -0.780000 -13.550000 -1.090000 1.010000 1.460000 8.690000
$hbox 0 "cylinder_spin" -1.300000 -2.000000 -1.430000 1.500000 0.290000 1.410000
$hbox 0 "Speedload Master" -1.150000 -4.190000 -1.180000 1.150000 0.080000 1.160000
$hbox 0 "Bip01 L Arm2" 0.000000 -2.800000 -1.730000 11.680000 3.020000 4.000000
$hbox 0 "Bip01 L Hand" 0.000000 -0.870000 -1.940000 3.890000 1.030000 1.790000
$hbox 0 "sight_master" -1.050000 -1.580000 -0.770000 1.140000 1.900000 4.710000

<span style='color:red'>This is the only thing YOU need to worry about, since you are only converting a model. This tells the refrence files above how to move. Studiomdl will look for these files and add them IN ORDER in the animation. So, forget everything above, and pay attention to these</span>
// 8 animation sequence(s)
$sequence "idle1" "idle1" fps 30 loop
$sequence "fidget1" "fidget1" fps 30
$sequence "fire2" "fire2" fps 50 { event 5001 0 "31" }
$sequence "reload" "reload" fps 42
$sequence "holster" "holster" fps 30 <span style='color:red'> The first "Holster" is just the name  HLMV you will see. It does not do anything. The second one is the FILE it looks for, so thats the important one to change. { event 5001 0 "31 } says that it will play a muzzle flash on frame zero, so you can change 0 to 5 and it will play the muzzleflash on frame 5 instead of 0. Loop just says to loop the animation when its done playing. Usualy our animations will have sound files in the code, especialy on the reload. Copy the sounds over to the right folder and they will play.</span>
$sequence "draw" "draw" fps 30
$sequence "idle2" "idle2" fps 30 loop
$sequence "idle3" "idle3" fps 30 loop
[color=red] Quick note, anything with //blah is just notes and does not effect code, so you could write //OMG OLOL BBQ  and nothing would happen. Its just for note taking if your code gets long and annoying
<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->

A little confusing, but continue on you will understand more later.


Now we get to the easy part, All we do is move the $sequence files around

Lets pretend we have a m16 that we want to convert to a, oh, say a glock, with the following sequences
<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
$Sequence "bob" "Fire" fps 30
$sequence "omg" "reload" fps 4353
$sequence "idle" "idle"
<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->

Your m16's .qc file looks like this:

<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
$sequence "Reload" "Reload" fps 50364
$sequence "something" "idle" fps 3
$sequence "fire" "fire" fps 5
<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->

Remember, as i said above, the first one in quotes just names the animation in a model viewer, and therefore has no purpose.

The half-life engine reads animations by what line the weapon is on, not the name of the animation.

So, to get the m16 to the glocks animation, you would have to move the animations like this, using copy and paste.

<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
$sequence "fire" "fire" fps 5
$sequence "Reload" "Reload" fps 50364
$sequence "something" "idle" fps 3
<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->

See, i didnt have to switch the names around, i only have to move the code up and down to match the order the animations occured in.

Any left over animations, delete them. If your missing animations that you need, such as a holster animation, just fill it in with a idle animation or something unnoticeable.

Now you save and compile, when you do this to your .357 your final code should look like this:
Quick note though, you can change how fast a animation plays by lowering/raising the fps number. The higher the number, the faster it plays.

<!--c1--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
$sequence "idle1" "idle1" fps 30 loop
$sequence "fidget1" "fidget1" fps 30
$sequence "reload" "reload" fps 36
$sequence "reload" "reload" fps 34
$sequence "fire1" "fire1" fps 30 { event 5001 0 "31" }
$sequence "idle1" "idle1" fps 30 loop
$sequence "draw" "draw" fps 30
<!--c2--></td></tr></table><div class='postcolor'><!--ec2-->

If it looks like that, save, then compile with logscript/studiomodel in the same folder. No cheating by looking at that though, or you wont learn much :/

Rename it to v_hg if you did not in the code, and put in your ns folder. If anything is confusing, post it and i will try to clear cause it is a little hard to explain some parts :x
Sign In or Register to comment.