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.

No comments:

Post a Comment