Weapon Compiling

Stormy

Companion Cube
Joined
Aug 7, 2003
Messages
3,888
Reaction score
22
Right, i understand how this works semi but im getting confused with some parts of the .qc file. When i look at a line from the HL2 shotgun .qc this is what im reading.

$sequence idle01 {for animation idle01 in the code}

"Idle01" loop fps 30 {play animation Idle01 (which is a smd) at 30 fps).. dont get "loop"

activity ACT_VM_IDLE 1 node 0 {dont understand what this is. Please explain)

Another part i dont understand is putting the muzzle flashes on.

Code:
$attachment "muzzle" "ValveBiped.Muzzle" 0 0 0 rotate -90 0 0 rigid

{ event AE_MUZZLEFLASH 0 "SHOTGUN MUZZLE" } node 2

Again what im reading here is.

- Load Bone Valvebiped.muzzle, with xyz cordinates at this angle. I dont understand ridget
-i dont understand the second part. Does this refure back to the first part? Play muzzle flash and plce at these co-ordinates. If that is right can you please explain what part does what. And even why they are called what they are.
-I also dont understand "node"

Any help would be really good. Trying to learn as much as i can atm so i can start getting some stuff ingame! Thanx

-Stormy
 
Code:
$sequence idle01 "Idle01" loop fps 30 activity ACT_VM_IDLE 1 node 0

The sequence named idle01 uses the animation filename idle01.smd, it plays in a continuous loop at 30 frames per second and is tied to the animation ACT_VM_IDLE when called by the code.

Code:
$attachment "muzzle" "ValveBiped.Muzzle" 0 0 0 rotate -90 0 0 rigid

{ event AE_MUZZLEFLASH 0 "SHOTGUN MUZZLE" } node 2

Defines an attachment called "muzzle" at the position of the bone called "ValveBiped.Muzzle". The co-ordinates are for adjusting the position of the attachment if it seems wrong. Same goes for the rotation (pitch yaw roll)

Not 100% sure on the second part. The "event AE_MUZZLEFLASH" refers to when the game code calls for the muzzleflash. The "SHOTGUN MUZZLE" part I assume refers to the model and the attachment, but that doesn't seem quite right.
 
That thats kind of what i thought for most of it but i just wanted to clarafiy and make sure i was on the right tracks. The only other thing is the "node" what is this?
 
Apparently,

Valve Wiki said:
Tags the sequence as belonging to a point on the sequence transition graph table. This is for animations which don’t change graph state, such as looping animations. Multiple sequences can be at the same entry in the graph table, at which point they won’t need transition animations be move between each other. Alternatively, you can have them at different points and expressly skip transitions (see $skiptransition). Sequences with no declaration are assumed at the root node and the transition graph assumes any sequence can move from the root node or to the root node without a intermediate transition.

So I'm sure that clears it up :)

I spent a good few hours last week going through various .qc files to gain a complete understanding of (almost!) everything in it. It's definitely a worthwhile task if you're going to be doing a lot of model compiling.
 
So they are points between different animations?

One other thing

Code:
 $sequence "idle" "tree_deciduous_01a_reference" fps 30

Why does a static prop need an idle animation?
 
I think because all models need both a definition of the mesh and the bones. The reference SMD defines the mesh, the animation defines the bones.
 
One addition:

Events kind of go the other way around. The code calls the animation, and as it plays and reaches a specified frame, the animation throws the event to the code, which catches it and takes the required action (in this case it draws a muzzleflash).

{ event AE_MUZZLEFLASH 0 "SHOTGUN MUZZLE" }

The "0" refers to the animation frame in which the effect will be drawn. In most cases you will want shots to be instant so it will often be 0 in the case of muzzleflashes. "SHOTGUN MUZZLE" refers to the type of muzzleflash effect that will be drawn.

No attachment is passed to the code as the muzzleflash because, it will by default be drawn at attachment 0 (ie. the first attachment defined). Attachment 0 is in this case also the place where it should be, so no problems there. Looking at the muzzleflash code, it seems you could set a second parameter after "SHOTGUN MUZZLE" that overrides the default attachment. I've never needed this though, as it's easier to just define the muzzle as the first attachment.

Another effect event you'll see a lot in weapons looks like this:
{ event 6001 28 "1" }

Event 6001 is the "throw brass" event, that tells the game to spawn an empty shell of type "1" at attachment 1 (second defined) on frame 28 of the animation. "1" stands for rifle/smg shell, whereas "2" will throw a shotgun shell and "0" a generic one.

If you have the sourcecode around you can look up all possible events with short explanations in cl_animevent.h. Alternatively they're at the valve wiki as well, a ways down this page: http://developer.valvesoftware.com/wiki/Animation_events
 
Right i have starting to recompile my model from scratch with .qc and .vmt files. But having problems with the texture showing on the model.

The .mdl etc is in:
\half-life 2 deathmatch\hl2mp\models\Stormy\Sphere.mdl

The vmt and vtf are in:
\hl2mp\materials\models\Stormy\Shpere.vmt

.qc

$modelname Stormy/Sphere.mdl

$cdmaterials materials/models


$staticprop
$surfaceprop "rubber"
$scale "1.0"

$body studio "./Sphere.smd"

$sequence idle "Sphere" loop fps 30

$collisionmodel "Sphere.smd" {
$Mass 100
$concave
}




.vmt

"vertexlitgeneric"
{
"$baseTexture" "models/Stormy/Sphere"
"$surfaceprop" "rubber"
"$envmap" "env_cubemap"
}


Any idea's on what im doing wrong?
 
You forgot the stormy folder it should be like this $cdmaterials materials/models/Stormy
 
I just tryed it... i have also tryed

$cdmaterials materials/models/Stormy
$cdmaterials models/Stormy
 
Back
Top