Jul 9, 2013

GoldSource(GoldSrc) model porting. The Specialist animations to Sven Coop.

So yeah....I created another tutorial for people who may still want to learn something.
I am sure, some people liked animations from The Specialist, and wanted them to use in Sven Coop.
Actually, its easy job too, but some sequences has 2 animations in one sequence.
This option called as: Blend.
BUT. I am not going to step way too far forward.

We are here to convert some animations from The Specialist, right? Right. Lets do it.

What tools we have to use.
HLMV(With decompiler\compiler, as usual).

So yeah...what to do?
  1. We need to decompile model. (As usual.) (If you still have your model decompiled, you can skip this step.)
  2. Find animation, that we like: Example "morfy_jump.smd".
  3. Open this file with notepad
  4. Easiest job ever. Translate Italian words into English.
  5. Save it.
  6. Rename this animation: Example: "long_jump.smd"
  7. Copy and past this animation in model, that ready to compile. If it going ask to: Replace file? Answer as: Yes, replace it. (Better to have a backup, actually.)
  8. Compile the model and test it in game.
  9. Enjoy.
No pictures for now.(My battery on laptop is running low)

To Do list:
Make videos for tutorials. (Status: Canceled. Reason: Fraps cant record videos from desktop on Windows 8. And I am not going to use any another software for it, because they are not good enough for me.)

Jul 5, 2013

GoldSource(GoldSrc). The Specialist to Sven Coop player model porting.

Sometimes, I wanted to convert some player models from The Specialist, because they look some kind of cool.

I wasnt sure how-to convert them, but Horrawr and my little mind helped me out with this.

So yeah.

Today, Ill try to make another tutorial called:
The Specialist to Sven Coop player model porting.

So yeah...what we have to use today...
  1. HLMV(With decompiler\compiler), of course.
  2. MilkShape 3D(Just in case. Used to convert some animations from The Specialist 3.)
  3. Google translator(Just in case, if you are a lazy to read my words.)
  4. Fresh mind
  5. Great music from "Lost Tracks and Memories" album by Andreas Rönnberg.

Lets get starting.

Today, I will use this model. (All credits goes right to the author.)

First off: Decompile this model with your HLMV.
Second: Find "whitey.qc" (Because the model named as whitey)

Now take your attention at some information:

Marked information: Your attention!

  • Reference mesh(es), you need to find "mercenary.smd" file. I tell you why later.
  • Attachment(s)
  • Bone controller(s)
  • Hit Box(es)
Valve is using English words in their .qc, just like Sven Coop do.
The Specialist mod uses Italian words and they are need to be translated, in order to make model work in Sven coop.

So yeah. Here's your objective list:
  1. Find mercenary.smd file and translate Italian words into English.
  2. Translate Italian words under Attachments\Bone Controllers\HitBoxes section.
WARNING: DON'T TRANSLATE "Bip01" words! Dont even touch them! Just put translated words after "Bip01 ..."! Messing around with this one will destroy the whole model(Probably.)

Easiest job ever, is it, comrade?
Well, I guess you dont know Italian, and you need a help, right?
Right. And I am here to help you again.

Theres 2 ways to translate words

  1. Use a Google translate
  2. Use my translated words already.
Italian To (>) English

Bacino > Pelvis
SX Coscia > L Leg
SX Polpaccio > L Leg1
SX Piede > L Foot
DX Coscia > R Leg
DX Polpaccio > R Leg1
DX Piede > R Foot
Dorso > Spine
Dorso1 > Spine1
Dorso2 > Spine2
Dorso3 > Spine3
Collo > Neck
SX Clavicola > L Arm
SX Braccio superiore > L Arm1
SX Avambraccio > L Arm2
DX Clavicola > R Arm
DX Braccio superiore > R Arm1
DX Avambraccio > R Arm2
Testa > Head
SX Mano > L Hand
DX Mano > R Hand 

Use it.
Now lets take a look at those 2 images.


This is translated Attachments\BoneControllers\HitBoxes and .smd file.

Your job is almost done, sir! But you have to finish the job, right? Right. Save those files, and forget about them for a while.

Your next objective is: Take a whatever player model from Sven Coop and decompile it. Why? Because of Animations.

 Actually, we can convert animations from The Specialist too, but theres not enough animations for Sven Coop. So, yeah, decompile it.

I will decompile: gman.mdl one.

After decompiling gman model, Ill open "gman.qc" file and will head down to the "Sequences list".
Oh God! Thats a lot of animations we got there!

But anyway. Copy the whole "Sequence" list and put in " whitey.qc" file under "Sequences"

Now save " whitey.qc" file and lets keep going.
Before compiling your converted model, copy ALL .smd animations from decompiled Sven Coop model and past them into folder, where our converted model is ready for delivery.
(Be sure, you are not pasting reference.smd's. Posting a new reference with same model, may mess up with your model.)

Now when you are done with copy-pasting operation, you can now open HLMV again and use compiler tool to finish your job. Wait for compiler and here you go. Look at your new model in HLMV.

Here you go. Now backup any player model(Example: th_gangster), that you want replace, then rename your converted model.(Example: whitey>>th_gangster), then replace your converted model and test it in game.

Now, your job is done. You can now play with converted model and enjoy.

Credits: Player model credits: Sven Coop Team and to author one(The nickname of author wasnt added in GameBanana page yet.)
You can download The Specialist mod for Half-Life 1 by clicking this link


Jul 1, 2013

GoldSource(GoldSrc) model porting part2.

In first part, we learned how-to convert weapon, but I assume you dont know how make timing animation correct? Alright then.

Before starting, be sure you have:
Mathematics knowledge.(Or you can use calculator, if you are really lazy.)
HLMV with compiler and de-compiler.
Caravan Palace - "Queens" music. (Just a fine music, that I am listening while doing animation timing correct.)

So yeah, in previous part, we learned how decompile\edit .qc file, matching animation lines with original weapon.(.357). But we probably dont know, how to make reload\draw animation faster\slower and etc.
Timing animations are required in case, if you still having reload sequence, while server know that your weapon already loaded with new bullets that ready kick a**.

Actually, this is easy part, just need to know some mathematics or use calculator in order to do everything fine.

So yeah, lets get started.

Open HLMV, then press "Load model"
After that, find our converted model "v_deagle.mdl".
After loading your model, go to the "Sequence" tab.
Now, you can see some information about "sequences".
1: The animations tab.
2: Play\Stop animation button
3: Speed of animation.
4: Information about sequence(# of sequence\Frames\FPS\Blends\# of events.)
5: Tab of events, that weapon uses while playing sequence. (Most of the times: Sound events.)
6: Play sound box. You can mark this box to play sounds. (If you cant hear any sounds, be sure to set the folder of sounds. To do this: Open "Options>Set sound folder, then choose where your sounds are, and double click the folder.)
(Open image, if you need to. This image contains, where all numbers are.)
Dont forget to open in new HLMV a .357 revolver.

Most of times, only "Draw\Reload\Reload_empty\Holster" needs a fix of timing.

Take a note of information about sequence.
All we really need is a "Frames" and "FPS".
Frames-Seriously. Its number of frames that animation got. You dont really need to mess up with this one, because it can mess up the whole animation.
FPS-Speed of animation. Can be edited, but setting more then 60 FPS, may make your animation way super fast, or super slow, if you set less then 10 FPS.
(Sometimes, you need to speed up animation, setting more then 60 FPS, just because frames way too small or a reload sequence way too long.").

FPS can be edited in .qc file.
$sequence "reload" "reload" fps 30 { event 5004 11 "weapons/de_clipout.wav" } { event 5004 47 "weapons/de_clipin.wav" }

So yeah, now we know whats Frames and FPS means, now lets take a work of timing.

The Sven Coop's .357 reload animation has 101 Frames and 40 FPS.
Means: 101 Frames in reload sequence with 40 FPS as speed.

Now you need to use mathematics skills:
101:40=2,525 seconds animation uses to reload a weapon.

Now back to the converted weapon: The deagle has
66 Frames and 30 FPS.
66:30=2,2 seconds.

Your objective: You need to find a closest result as possible.
The reload animation of revolver is 2,525. Find closest one from weapon that you converting.
66:26=2,538 and bla bla.

Those 2 are fine for "reload" animation, but the problem is:
The first animation will complete, but the sequence will be completed after 0,5~ seconds. (Because server uses standard weapon model)
The second animation will complete the sequence, but the animation will play for more couple of milliseconds.
Both of them, doesnt really affect at gameplay, because its just couple of milliseconds.

Now when we found a closest result as possible, open "v_deagle.qc" with notepad.exe, find sequence called "reload" and then look for FPS in this line.

Do the same with "draw" animation.

Simple: Look for "draw" animation in .357 Sven Coop's revolver, look how much frames\FPS there, take a result(17:30=0.566~). Then do the same steps with deagle, then think it great with your mind and get a result, that will counts as 0.566~ or a bit different.), then edit in .qc file how much FPS needed in "draw" animation.
Save the .qc file.
You have done, well, partner, but you are not finished yet. Sit down and use compiler from HLMV. Compile edited "v_deagle.qc" file and you are good for now.

Now, after all those work, we need to take a few last steps:
Use gFlip, if you didnt flipped lefthanded model to the righthanded.
Rename your converted model: "v_deagle.mdl>v_357.mdl"
Make a backup of your original model(In case, if you will not like it, or you just want to put them back.)
Replace a model with a converted one.
Test it in-game (I use "stadium3" map in Sven Coop to do all tests that I need with models.)
Have fun.

A little FAQ about this tutorial.
Q: Its hard for me...
A: Ill qoute someone: "Dont give up, dont put your hands down, keep it trying until you will do that.".
Q: I got some errors with gFlip, like...
A: Most of times, cleaning gFlip folder from your harddrive will solve this problem.
Q: I dont really get it at some part...
A: A video will come soon. When? When its will be done.
Q:  Animations are still fast\slow, even if I did everything correct!
A: This happens in Sven Coop. If you still having this problem, speed up or speed down the animation.(You know how now.)
Q: I see some "events" in sequence line, what they are means?
A: Events are used to make some special actions of this model.
Example: { event 5004 11 "weapons/de_clipout.wav " } This is a sound action. The sound "weapons/de_clipout.wav" will play when sequence of reload will reach 11 frame.
Many other events as "5001(Sprite effect), 1003(Some kind of mechanism in coordination system.) and etc can be used." Not a really big option, but its great one for effects.
Q: I want my weapon to be far from my eyepossition.
A: This can be done by adding "origin" line after "FPS".
Example:  $sequence "reload" "reload" fps 30 origin 0 0 10 { event 5004 11 "weapons/de_clipout.wav" } { event 5004 47 "weapons/de_clipin.wav" } (REMEMBER: THIS IS EXAMPLE.)
To make a weapon far from your eyes\face(whatever you gonna call it), use
"origin 0 -10 0" With minus: Its will be closer to eyes, without minus:(A.k.a.: "origin 0 10 0") its will be far from eyes.
Q: But...I know about this even more then you!
A: Then why you are reading this? Step forward to another blog.

I hope this tutorial will help you in next time and have a good time.
Model credits: VALVe\Sven Coop team.
Orphanage for making this(some kind of)tutorial.

GoldSource(GoldSrc) model porting. *Not important*.

NOTE:Some people will think: "This is useless information for me". 
I am not forcing you to read this. If you want it-go ahead and read at your own risk.

NOTE2: Dont post converted weapons anywhere in Internet, because of author rights(a.k.a. permissions). If you want to convert and then share weapon models, ask the creator of model first.

NOTE3: Keep in mind, some stuff might be complicated for you. In that case, you can either keep trying to understand or you can stop doing this and move on. I am not going to write down everything in order to make it easier for you. Either because I am lazy, either I am busy with Contagion stuff.

Now lets get a move on.

Once upon time, I wanted to convert some models from CS1.6 to Sven Coop(For example.)
I was looking for tutorial about that, but didnt found any of them(In my years. Maybe theres better tutorial about GoldSrc porting.).

So yeah. Today I want to share, how-to convert model from CS1.6 to Sven Coop.(Example again.)

I guess we can get started now...

Before starting. Make sure you got:

HLMV(Half-Life Model Viewer. Personally, I use Jed's one.)
De-compiler. (Also can be used with HLMV).
gFlip(In case, if you are righthanded or lefthanded weapon user.)
Some mathematics knowledge.
Beer.(Just in case.)

Lets get started then.

After downloading all files that you need,(GFlip may not required for use) we are going to un-archive those files in whatever folder you like.(I recommend to create an new folder, and put all files there.).

A main program that allows you to view any GoldSrc models.(Well, most of them, correctly.)

You can view models as much as you want, but we are here to know how-to convert weapon model? Right.

Before starting, please note: HLMV may have some issues with Windows 7 system. HLMV was writed for Windows XP, but we know already, that most of people got Windows 7. If you are having slow work on your PC, please open your TaskMannger, then choose process list, and search for "hlmv.exe" If you see any>close them.

So yeah, lets open HLMV.
Ill open "Apache.mdl" for example.
We see many tabs and some options in this window. Before doing something with model, make sure you configured your tools.(A.K.A. Decompiler and compiler.)

To check them: Press "Tools" then choose "Configure tools".

Then a window will appear, asking you for path to "studiomdl.exe"(Compiler) and "mdldec.exe"(Decompiler).

Set the way for those programs, then press "O.K." button and lets get to work.

So yeah, we got everything set up and now we can start working on converting of weapon.
Today, I will use "v_deagle.mdl" from cs1.6 and gonna convert it to Sven Coop.

So yeah, first: We need to decompile model.

To do this one:
Press "Tools" then "decompile model".

Then, select the model, that you want decompile(v_deagle.mdl for example) and press "Open".

After it, an command console will appear(Its fine, dont panic) and wait when the decompiler will finish. (Note: All model files(.qc\smd\bmp images) will be saved in folder where model was.)

After it, find v_deagle.qc file and open it with notepad.exe.

After it, you will see an text, that contains some information about model.
Information like:
Model name\scales\etc.
Reference meshes.
Hit boxes.

Most of times, when you are trying to convert model, you are only need to care about "sequences", since we are just converting weapon model.

Now decompile "v_357.mdl" from Sven Coop and open "v_357.qc" file.(Dont close "v_deagle.qc" file)

These are the animation lists, as well as descriptions for what the animations are.

Animation list for the deagle (6 animations)

idle - an idle animation
shoot1 - a shooting animation
shoot2 - a shooting animation
shoot_empty - Shooting animation that plays upon shooting the last bullet
reload - Reload animation
draw - Draw animation

Animation list for Sven's .357 (8 animations)

idle1 - an idle animation
fidget1 - a "fidget" animation - one where the player just messes around with the gun in his hand
fire1 - a shooting animation
reload - a reload animation
holster - holster animation
draw - draw animation
idle2 - an idle animation
idle3 - an idle animation
Take a note of the animations:

idle - an idle animation

idle1 - an idle animation

Do they match up? Yes. The deagle's idle animation would play when the 357 is playing an idle animation.

Moving down the list, the next animations are:

shoot1 - a shooting animation

fidget1 - animation where the player is messing around with the gun. plays randomly when the 357 is equipped

Do these match up? Nope. This would cause problems because when the fidget1 animation plays, the deagle will play the shooting animation.
Question appears:
How would one go about fixing this?

To remedy the fact that the desert eagle does not have a fidget animation, simply copy the idle animation. This does not cause any issues at all, because when the fidget animation would play, the gun would simply not move at all since it would be playing the idle animation.

Next on the list is the 357's shoot animation. Does the desert eagle list currently have animations that would match that description?

Deagle animation list
$sequence "idle" "idle" fps 16
$sequence "idle" "idle" fps 16
$sequence "shoot1" "shoot1" fps 38 { event 5001 0 "21" }
$sequence "shoot2" "shoot2" fps 38 { event 5001 0 "21" }
$sequence "shoot_empty" "shoot_empty" fps 38 { event 5001 0 "21" }
$sequence "reload" "reload" fps 30 { event 5004 11 "weapons/de_clipout.wav" } { event 5004 47 "weapons/de_clipin.wav" }
$sequence "draw" "draw" fps 30 { event 5004 10 "weapons/de_cock.wav" }

The answer is yes: shoot1, shoot2, and shoot_empty. If that's the case, why not just keep them all there?
To answer that question, just take another look at the animation lists.

Desert eagle's animation list
$sequence "idle" "idle" fps 16
$sequence "idle" "idle" fps 16
$sequence "shoot1" "shoot1" fps 38 { event 5001 0 "21" }
$sequence "shoot2" "shoot2" fps 38 { event 5001 0 "21" }
$sequence "shoot_empty" "shoot_empty" fps 38 { event 5001 0 "21" }
$sequence "reload" "reload" fps 30 { event 5004 11 "weapons/de_clipout.wav" } { event 5004 47 "weapons/de_clipin.wav" }
$sequence "draw" "draw" fps 30 { event 5004 10 "weapons/de_cock.wav" }

357's animation list
$sequence "idle1" "idle1" fps 30
$sequence "fidget1" "fidget1" fps 30 { event 5004 61 "weapons/357_idle_fidgetpull.wav" } { event 5004 122 "weapons/357_idle_fidgetrelease.wav" }
$sequence "fire1" "fire1" fps 30 { event 5001 0 "15" }
$sequence "reload" "reload" fps 40 {
{ event 5004 6 "weapons/357_chamberout.wav" }
{ event 5004 20 "weapons/357_shellsout.wav" }
{ event 5004 54 "weapons/357_shellsin.wav" }
{ event 5004 61 "weapons/357_quickloader.wav" }
{ event 5004 77 "weapons/357_chamberin.wav" }
$sequence "holster" "holster" fps 30
$sequence "draw" "draw" fps 30
$sequence "idle2" "idle2" fps 30
$sequence "idle3" "idle3" fps 30 { event 5004 8 "weapons/357_idle_squeeze.wav" } { event 5004 46 "weapons/357_idle_unsqueeze.wav" }

The only firing animation that the .357 has is the third one on the list: fire1. The desert eagle has three different animations. Shoot1 is third in the last, as is fire1, so that is okay, but what is fourth on the list?

On the .357, that would be reload, and on the deagle it is shoot2. What does this mean? It would mean that when you are reloading, a shooting animation would play. Again, the fifth on each list is follows: holster for the .357 and shoot_empty for the deagle. This means that whenever the holster animation plays for the .357, a shooting animation happens for the desert eagle. That's not what you would want, is it? So how do you fix that?

You delete the excess shoot animations in the list. It even helped clean up the list, because take a look.

Deagle's list

$sequence "idle" "idle" fps 16
$sequence "idle" "idle" fps 16
$sequence "shoot1" "shoot1" fps 38 { event 5001 0 "21" }
$sequence "reload" "reload" fps 30 { event 5004 11 "weapons/de_clipout.wav" } { event 5004 47 "weapons/de_clipin.wav" }
$sequence "draw" "draw" fps 30 { event 5004 10 "weapons/de_cock.wav" }

.357's list

$sequence "idle1" "idle1" fps 30
$sequence "fidget1" "fidget1" fps 30 { event 5004 61 "weapons/357_idle_fidgetpull.wav" } { event 5004 122 "weapons/357_idle_fidgetrelease.wav" }
$sequence "fire1" "fire1" fps 30 { event 5001 0 "15" }
$sequence "reload" "reload" fps 40 {
{ event 5004 6 "weapons/357_chamberout.wav" }
{ event 5004 20 "weapons/357_shellsout.wav" }
{ event 5004 54 "weapons/357_shellsin.wav" }
{ event 5004 61 "weapons/357_quickloader.wav" }
{ event 5004 77 "weapons/357_chamberin.wav" }
$sequence "holster" "holster" fps 30
$sequence "draw" "draw" fps 30
$sequence "idle2" "idle2" fps 30
$sequence "idle3" "idle3" fps 30 { event 5004 8 "weapons/357_idle_squeeze.wav" } { event 5004 46 "weapons/357_idle_unsqueeze.wav" }

The shoot1 animation is in the same spot as fire1, AND both reloads are in the same spot! So you don't need to reposition the reload animation in the list at all.

!IMPORTANT!: When converting models, BE ABSOLUTELY SURE YOU DECOMPILE THE ORIGINAL MODEL FIRST. This is critical because if you do not, it will cause errors when both models have animations with the same name. For example, in this, the reload animation for the .357 WILL NOT work with the desert eagle.

The final stretch, the conversion is almost done. You are now working with four animations for the 357


Looking at the desert eagle's animation list, does any match up with these?

$sequence "idle" "idle" fps 16
$sequence "idle" "idle" fps 16
$sequence "shoot1" "shoot1" fps 38 { event 5001 0 "21" }
$sequence "reload" "reload" fps 30 { event 5004 11 "weapons/de_clipout.wav" } { event 5004 47 "weapons/de_clipin.wav" }
$sequence "draw" "draw" fps 30 { event 5004 10 "weapons/de_cock.wav" }

Yes and no: You have an idle and a draw animation, but no holster animation, which comes before the draw animation in the list. How do you account for this?
Simple fix: Just copy and paste the $sequence "idle" line three times: Once before draw and twice after draw. Why would I use the idle animation for holster? Because it's generally never used, so no problems, correct?

Now you are done. This is how your final lists will look like.

Deagle animation list

$sequence "idle" "idle" fps 16
$sequence "idle" "idle" fps 16
$sequence "shoot1" "shoot1" fps 38 { event 5001 0 "21" }
$sequence "reload" "reload" fps 30 { event 5004 11 "weapons/de_clipout.wav" } { event 5004 47 "weapons/de_clipin.wav" }
$sequence "idle" "idle" fps 16
$sequence "draw" "draw" fps 30 { event 5004 10 "weapons/de_cock.wav" }
$sequence "idle" "idle" fps 16
$sequence "idle" "idle" fps 16

.357 animation list

$sequence "idle1" "idle1" fps 30
$sequence "fidget1" "fidget1" fps 30 { event 5004 61 "weapons/357_idle_fidgetpull.wav" } { event 5004 122 "weapons/357_idle_fidgetrelease.wav" }
$sequence "fire1" "fire1" fps 30 { event 5001 0 "15" }
$sequence "reload" "reload" fps 40 {
{ event 5004 6 "weapons/357_chamberout.wav" }
{ event 5004 20 "weapons/357_shellsout.wav" }
{ event 5004 54 "weapons/357_shellsin.wav" }
{ event 5004 61 "weapons/357_quickloader.wav" }
{ event 5004 77 "weapons/357_chamberin.wav" }
$sequence "holster" "holster" fps 30
$sequence "draw" "draw" fps 30
$sequence "idle2" "idle2" fps 30
$sequence "idle3" "idle3" fps 30 { event 5004 8 "weapons/357_idle_squeeze.wav" } { event 5004 46 "weapons/357_idle_unsqueeze.wav" }

List analysis

First spot
Deagle: idle 357: idle1
Matching animations? Yes, they are both idle animations

Second spot
Deagle: idle 357: fidget1
Matching animations? No, but the idle animation can work as a fidget animation.

Third spot
Deagle: shoot1 357: fire1
Matching animations? Yes, they are both shooting animations

Fourth spot
Deagle: reload 357: reload
Matching animations? Yes, they are both reload animations. *REMEMBER THE NOTE ABOUT DECOMPILING MODELS WITH THE SAME ANIMATION NAMES!!!!!*

Fifth spot
Deagle: idle 357: holster
Matching animations? No, but the idle animation can work as a holster animation

Sixth spot
Deagle: draw 357: draw
Matching animations? Yes, they are both draw animations. *REMEMBER THE NOTE ABOUT DECOMPILING MODELS WITH THE SAME ANIMATION NAMES!!!!!*

Seventh Spot
Deagle: idle 357: idle2
Matching animations? Yes, they are both idle animations
Eighth Spot

Eighth Spot
Deagle: idle 357: idle3
Matching animations? Yes, they are both idle animations

Now that the animation lists are similar, you are now free to save v_deagle.qc and re-compile it.

Extra tips:

Animation speeds may not match up. This can be remedied by working with the .qc file and Half Life Model Viewer simultaneously. How? That will be covered in another tutorial.

ALL counterstrike models are always left-handed, which means they are on the left side on the screen. To fix this, simply use the tool gflip. Drag and drop the converted model onto the gflip menu and the program will fix the model so it will be right-handed, or show up on the right side of the screen.

Models with transparencies, such as scopes and helmets that have glass parts, WILL mess up. There is a simple fix for this, and that would be opening up the converted model in HLMV. Then go to the Textures tab and check the Additive and Transparent boxes, go to File, and then Save Model As.

Player models are their own different story than weapon models. They are VASTLY different because Goldsource games/mods tend use different skeletons for their player models. Fixing this would need the use of Milkshape, which is something that I am not skilled at yet.

Credits: Much obliged to Horrawr who taught me this.

I hope this will help you in next time and see you later.