MDL compiler Created 17 years ago2007-04-01 12:56:45 UTC by ShinReiga ShinReiga

Created 17 years ago2007-04-01 12:56:45 UTC by ShinReiga ShinReiga

Posted 17 years ago2007-04-01 12:56:45 UTC Post #217658
When compiling a MDL with GUIStudioMdl 2.1 i get an error saying "bad command cd$texture"

is this something to do with the actual textures, or the directories of the textures or something?
please help!
Posted 17 years ago2007-04-01 13:15:37 UTC Post #217659
"cd$texture" isn't a valid .QC command. "$cdmaterials" is what you want.

I compile my models the old-fashioned way: With the actual .QC and StudioMDL. At the bottom of BJ's compiling steup tutorial, he explains the process of creating a .QC file and compiling with it. Although I don't use GUIStudio, this method is sure to work every time.
Posted 17 years ago2007-04-01 13:37:05 UTC Post #217662
yeah thats the one sorry ...
nice one. ...

do you have any idea as to what the error is tho?
Posted 17 years ago2007-04-01 14:42:30 UTC Post #217666
Umm... he just told you?

Go to your QC file and replace cd$texture with $cdmaterials.
Madcow MadcowSpy zappin my udder
Posted 17 years ago2007-04-01 15:11:06 UTC Post #217669
no no cd$textures was a typo ... i meant cd$materials
Posted 17 years ago2007-04-01 15:47:31 UTC Post #217672
The $ sign needs to go before the "cd," otherwise StudioMDL won't recognize that line as a command. $cdmaterials, not cd$materials
Posted 17 years ago2007-04-01 16:03:52 UTC Post #217674
nice one ... il try that one now
Posted 17 years ago2007-04-01 17:56:00 UTC Post #217686
nice one ... i put that in a got round my error...however using GUIStudioMDL i got the error....

ERROR: 'EXCEPTION_ACCESS_VIOLATION' (assert: 1)
ERROR: Aborted Processing on 'v_shotgun2.mdl'

cheers for the help..
Posted 17 years ago2007-04-01 17:59:36 UTC Post #217687
That sounds like an error on behalf of the compiler program itself.

Try making the .QC from scratch (the tutorial mentioned above will help) and compile with it. If you still get errors, then there's probably a problem with the .SMDs you exported (which can hopefuly be fixed in XSI), or you made a syntax error. If the problem resolves itself, then cheers!
Posted 17 years ago2007-04-03 09:58:58 UTC Post #217847
'EXCEPTION_ACCESS_VIOLATION' - this erro can point on everything imho. Too many polygons, syntax errors in QC, etc ...
Posted 17 years ago2007-04-05 09:34:07 UTC Post #218078
so it could in the SMD file, or the QC..
but the qc file is pretty simple ... in fact its this ...

$modelname "v_shotgun2/v_shotgun2.mdl"
$cdmaterials "materials/models/v_shotgun2"
$scale 1.0
$staticprop
$surfaceprop "metal"
$body "body" "D:HL2SteamAppsSourceModsmoddumpShotgun_reference.smd"
$sequence Idle "D:HL2SteamAppsSourceModsmoddumpShotgun_reference.smd" fps 30 ACT_IDLE 1
$collisionmodel "D:HL2SteamAppsSourceModsmoddumpShotgun_reference.smd"
{
$mass 100.000
}

help please!!!
Posted 17 years ago2007-04-05 11:53:13 UTC Post #218098
I'm going to assume you're making a view model to replace the old shotgun? If so, then there's a bunch of stuff you'll need in the .QC for it to actually function. Below is the .QC file for the pistol model I made in the Maps and Mods forum:
$modelname weapons/v_Pistol.mdl
$model "studio" "v_colt1911_MainReference2.smd"
$cdmaterials "models/Weapons/V_hand/"
$cdmaterials "models/Colt1911/"
$hboxset "default"
$attachment "muzzle" "ValveBiped.root3" 0.00 0.00 0.00 rotate 0 180 -180
$attachment "1" "ValveBiped.root4" -1.00 0.00 0.00 rotate -0 90 -180
$origin 0 0 65
$illumposition 12.972 0.702 -35.781
$sequence idle01 "v_colt1911_idle02" loop ACT_VM_IDLE 1 fps 30.00 node 0
$sequence idle01empty "v_colt1911_idle02" loop ACT_VM_IDLE_EMPTY 1 fps 30.00 node 0
$sequence fire "v_colt1911_idle02" SNAP ACT_VM_PRIMARYATTACK 1 fps 30.00 node 2 {
{ event AE_MUZZLEFLASH 0 "PISTOL MUZZLE" }
}

$sequence fire1 "v_colt1911_idle02" SNAP ACT_VM_RECOIL1 1 fps 30.00 node 2 {
{ event AE_MUZZLEFLASH 0 "PISTOL MUZZLE" }
}

$sequence fire2 "v_colt1911_idle02" SNAP ACT_VM_RECOIL2 1 fps 30.00 node 2 {
{ event AE_MUZZLEFLASH 0 "PISTOL MUZZLE" }
}

$sequence fire3 "v_colt1911_idle02" SNAP ACT_VM_RECOIL3 1 fps 30.00 node 2 {
{ event AE_MUZZLEFLASH 0 "PISTOL MUZZLE" }
}

$sequence fireempty "v_colt1911_idle02" ACT_VM_DRYFIRE 1 fps 30.00 node 2
$sequence draw "v_colt1911_idle02" snap ACT_VM_DRAW 1 fps 30.00 node 0
$sequence drawempty "v_colt1911_idle02" fps 30.00 node 0
$sequence reload "v_colt1911_idle02" SNAP ACT_VM_RELOAD 1 fps 30.00 node 0
$sequence holster "v_colt1911_idle02" snap ACT_VM_HOLSTER 1 fps 30.00 node 0
$sequence holsterempty "v_colt1911_idle02" snap ACT_VM_HOLSTER 1 fps 30.00 node 0
$sequence idletolow "v_colt1911_idle02" ACT_VM_LOWERED_TO_IDLE 1 fps 30.00 transition 0 1
$sequence lowtoidle "v_colt1911_idle02" ACT_VM_IDLE_TO_LOWERED 1 fps 30.00 transition 1 0
$sequence lowidle "v_colt1911_idle02" loop ACT_VM_IDLE_LOWERED 1 fps 30.00 node 1
(the skeletal animations are all named the same because I'm reanimating it)

First, change "$body "body"" to "$model "studio"". This will make a better looking model than if you use "body"

For a view model, you'll need at least one skeletal animation for the gun to function in-game. You DO know how to rig and animate, right? ;)

Most of the other stuff can be ignored as they aren't needed to get the compile to actually work. Just make sure all your syntax is right 'n stuff. Decompile Valve's v_shotgun and see what they did, if it helps you.
Posted 17 years ago2007-04-05 12:36:59 UTC Post #218105
sweet ... that actually worked!

how would i now get that as a weapon to choose when i am creating my map in Hammer?

again thanks for the help man
Posted 17 years ago2007-04-05 13:06:54 UTC Post #218108
ahhh...
i guess i have to create a txt file ..? v_shotgun2.txt in the MyMod/Scripts ???
Posted 17 years ago2007-04-05 13:13:31 UTC Post #218111
No problem :)

Weapons actually have two models: The v_model, which consists of a high-poly version of the gun and the HL2 hands, and w_models, a low-poly version of the gun which you see on the ground and in the enemy's hands.

If you have not replaced the original w_model yet, then simply creating the original HL2 shotgun item in Hammer would yield the HL2 w_model of the shotgun in-game, but your new shotgun would replace the v_model in your hands.

REMEMBER!!!:
To replace a model already existing in the .GCF (the Half-Life 2 shotgun, in this case), the files MUST be in the same place as the originals, and must have the exact same name. For insance, if the v_shotgun was found at "hl2/models/Weapons" in the .GCF, then the new files would need to be placed in "hl2/models/Weapons" in the Half-Life 2 mod filder. Your new shotgun models must also be named "v_shotgun," or the game won't recognize the new ones as weapons and replace the old ones.
Posted 17 years ago2007-04-05 13:26:33 UTC Post #218114
nice one ... il give that a try ...

firstly nice one for stayin with me with this as well ..

but how about adding a v_shotgun2 to the list of weapons instead of "overwriting" the original HL2 shotgun?

if i edit the image of w_shotgun and change the qc ... would that work?

nice one man
Posted 17 years ago2007-04-05 13:30:39 UTC Post #218115
Ahh, you posted just as I was editing my post to incluse this :) :

Making weapon_shotgun2.txt (or whatever you have named the new one) won't work for a couple of reasons. Primarily, you can't replace or add scripts to the .GCF, as Valve has disabled that ability. Second, Valve made all their weapon code (C++ stuff) support only the number of weapons that are already in the game. The only way to get the new shotgun in-game is to replace the old one, because unless you make a mod, you can't mess with and/or add more C++ coding. Bummer =/

That also means you can't change clip sizes, maximum ammo capacity, and weapon sounds in plain old Half-Life 2. Full changes can only be made in mods. :(
Posted 17 years ago2007-04-05 13:45:50 UTC Post #218117
but if i make a mod .... i could get the gun in game yeah?
Posted 17 years ago2007-04-05 17:58:55 UTC Post #218137
Yeah. To add a totally new weapon, you'd just copy all the right code. I generally get the gun functioning as a replacement in Half-Life 2 first before I go and do all the code work.
Posted 17 years ago2007-04-05 18:01:43 UTC Post #218138
ah i see...
well as it goes i got the weapon in the game i think ... but there is no actual image when i run it in the game?
i followed ur instructions when replacing the names and making the models/weapons folder...
any idea why the hands and the gun dont appear, but when i pick up another unchanged gun it works?

again you been a diamond geezer with the help man..
Posted 17 years ago2007-04-05 18:06:37 UTC Post #218139
Any time :)

The gun is probably in need of an origin change. If you look at the .QC I quoted above, you'll see a line like this:
$origin 0 0 65
This will 'move' the model around until it's in the correct orientation. Of course, this origin value is for the pistol I was working on, and may not be what you need for your shotgun. Decompiling the Valve model and looking at their .QC will probably give you a more acurate value. You can edit the value to your liking from there! :)

Remember that the values are in X, Y, Z, respectively.
Posted 17 years ago2007-04-07 11:53:12 UTC Post #218324
hey rotator, im using a different QC file now (as for some reason now " could not load file 'Altfire01.obj'" error comes up ...
this is the new qc file now ... but the shotgun still doesnt come up ...

$cd "D:shotgun"
$modelname "weapons/v_shotgun.mdl"
$model "studio" "Shotgun_reference.smd"
$cdmaterials "modelsWeaponsV_hand"
$cdmaterials "modelsWeaponsV_shotgun"
$cdmaterials "modelsweaponsshell"
$hboxset "default"
$hbox 0 "ValveBiped.Bip01_Spine2" 0.000 0.000 -4.015 11.946 24.170 0.000
$hbox 0 "ValveBiped.Bip01_Spine4" 0.000 0.000 0.000 2.033 1.001 1.938
$hbox 0 "ValveBiped.Bip01_L_Forearm" -1.968 -3.120 -3.061 11.482 1.909 2.721
$hbox 0 "ValveBiped.Bip01_L_Hand" -1.002 -2.207 -2.103 4.805 1.469 2.103
$hbox 0 "ValveBiped.Bip01_L_Finger4" -0.161 -1.158 -1.215 1.684 0.635 0.348
$hbox 0 "ValveBiped.Bip01_L_Finger41" -1.152 -0.669 -1.215 1.060 0.621 0.408
$hbox 0 "ValveBiped.Bip01_L_Finger3" 0.000 -1.574 -1.126 1.827 0.400 0.793
$hbox 0 "ValveBiped.Bip01_L_Finger2" -0.190 -2.038 -1.039 1.784 0.417 0.677
$hbox 0 "ValveBiped.Bip01_L_Finger0" -0.575 -0.500 -1.525 2.504 2.041 0.917
$hbox 0 "ValveBiped.Bip01_L_Finger01" -0.415 -0.404 -0.914 1.687 2.220 0.361
$hbox 0 "ValveBiped.Gun" -0.947 -6.407 -22.324 1.411 2.388 22.387
$hbox 0 "ValveBiped.Pump" -1.479 -4.397 -3.906 2.637 1.149 12.420
$hbox 0 "ValveBiped.square" -0.671 -0.704 -1.307 0.621 0.588 1.386
// Model uses material "vshotgun_albedo.vmt"
// Model uses material "casing01.vmt"
// Model uses material "v_hand_sheet.vmt"
$attachment "muzzle" "ValveBiped.Gun" -0.03 0.51 23.45 rotate -90.00 0.00 0.00
$attachment "1" "ValveBiped.Gun" -0.95 1.14 -5.59 rotate 0.00 -180.00 180.00
$surfaceprop "default"
$illumposition 4.919 28.541 -16.577
$sequence idle01 "idle01" loop ACT_VM_IDLE 1 fps 30.00 node 0
$sequence fire01 "fire01" ACT_VM_PRIMARYATTACK 1 fps 30.00 node 2 {
{ event AE_MUZZLEFLASH 0 "SHOTGUN MUZZLE" }
}

$sequence altfire "altfire" ACT_VM_SECONDARYATTACK 1 fps 30.00 node 2 {
{ event AE_MUZZLEFLASH 0 "SHOTGUN MUZZLE" }
}

$sequence draw "draw" ACT_VM_DRAW 1 fps 30.00 node 0
$sequence holster "holster" ACT_VM_HOLSTER 1 fps 30.00 node 0
$sequence reload1 "reload1" ACT_SHOTGUN_RELOAD_START 1 fps 30.00 node 0
$sequence reload2 "reload2" ACT_VM_RELOAD 1 fps 30.00 node 0
$sequence reload3 "reload3" ACT_SHOTGUN_RELOAD_FINISH 1 fps 30.00 node 0
$sequence pump "pump" ACT_SHOTGUN_PUMP 1 fps 30.00 node 0 {
{ event 6001 5 "2" }
}

$sequence dryfire "dryfire" ACT_VM_DRYFIRE 1 fps 30.00 node 2
$sequence lowered "lowered" loop ACT_VM_IDLE_LOWERED 1 fps 30.00 node 1
$sequence lowered_to_idle "lowered_to_idle" ACT_VM_LOWERED_TO_IDLE 1 fps 30.00 transition 1 0
$sequence idle_to_lowered "idle_to_lowered" ACT_VM_IDLE_TO_LOWERED 1 fps 30.00 transition 0 1
$sequence fire "fire" ACT_RANGE_ATTACK_SHOTGUN 1 fps 5.00 {
{ event AE_MUZZLEFLASH 0 "SHOTGUN MUZZLE" }
{ event 6001 0 "3" }
{ event 3004 0 }
}

any ideas? would incorrect directories with the textures make an issue?

cheers man
Posted 17 years ago2007-04-07 12:18:36 UTC Post #218326
What directory are your .SMDs located in? The very first line in the .QC, $cd "D:shotgun", tells the .QC file to look there when referencing the .SMDs. You can either move the .SMDs there, or remove that line from the .QC and move the .SMDs to the same folder that the .QC is in.

Also, be sure to check the model in the Half-Life Model Viewer (avalible in the Source SDK). If you load up your gun and go to Options > Center View, it will center the view on where the gun should be. If no model is visible, then there could be a number of problems:
  • You have a corrupt SMD (most likely the reference .SMD)
  • The origin is wayyyyyyyyyyyyyyyyyyyyyy off
  • You used a skeletal .SMD that had an inconsistent number of bones with the reference model (I think this would result in a stopped compile though... I'll need to test that)
From the looks of it (I may be mistaken), your compiler is using both your new .SMDs for the gun, and the skeletal .SMDs from the old gun. Not good. Generally, what I do is make a single test animation to ensure the bones work and make every animation that animation. That way, you can be sure that you will have no arguments in the compiler program between inconsistent .SMDs.

Whew, my fingers hurt. :)
Posted 17 years ago2007-04-07 12:37:12 UTC Post #218330
hahahhahas sweet .... il get on that ... :biggrin:
Posted 17 years ago2007-04-07 13:26:24 UTC Post #218333
ok ... right this is basically what i have done to pinpoint the problem...
stay with me...

1.used Cannonfodders Decompiler to decompile the shotgun and the TGA'S

2.imported the reference SMD, using Milkshape 3D, and resized the actual gun smaller, to see if this all works..I also add the textures and stuff so it would exported correctly. then exported the newly created smaller gun ref smd to overwrite the new one ...

3.Then used GUIStudioMDL 2.1 to recompile the ref smd using the above QC file ... outputting the files to the relevent folder...

4.When opening my mod and selecting the shotgun ..gun and hands dont appear, but if i shoot the gun, it still shoots...

woahh....there you go...
you need a medal for all this ... nice one dude
Posted 17 years ago2007-04-07 13:44:50 UTC Post #218336
woahh....there you go...
you need a medal for all this ... nice one dude
I'm not sure I know what you mean by this. Is your problem solved? If so, then hooray! :P
Posted 17 years ago2007-04-07 13:52:29 UTC Post #218337
that was a "pre" nice one !
you have stuck with me so far...but still have the problem..
are you famaliar with GUIStudioMDL 2.1?

i can complile when then target mod is halflife 2..
but when the target mod is my designed mod it gives me that exception error...i grow impatient with this mod!
Posted 17 years ago2007-04-07 14:00:58 UTC Post #218338
If the only problem is using the mod for the compiling then the only thing I can tell you is to copy the files over every time. Yeah, it sucks, but I'm not experienced with GUIStudioMDL, or compiling with mod setups.

Old-fashioned copy & paste FTW.
Posted 17 years ago2007-04-07 14:51:05 UTC Post #218340
we still got no image .... even when its in the mods directory...?
grrr....
is my .QC in order? could it be looking for something thats not right?
Posted 17 years ago2007-04-07 15:20:07 UTC Post #218341
Are you even seeing it in the model viewer? :(
Posted 17 years ago2007-04-07 15:26:02 UTC Post #218342
yeah man .... not the hlmv as that gets a mount problem...but yeah its i can see it in a model view... but its not centered...to view you need to pull down on the mouse...
issue?
Posted 17 years ago2007-04-07 15:29:56 UTC Post #218343
Load up a map in Half-Life 2, whip out your pistol, and type "sv_cheats 1" and "thirdperson". If you see your gun, then that's good. You'll have to center the gun in your view through trial and error. The last value, Z, in the "$origin" line of the .QC controls height. Higher values move it down and lower values move it up (I think).

I don't see why you'd see it in the model viewer and not in-game other than for that reason.
Posted 17 years ago2007-04-07 15:35:22 UTC Post #218346
right ... here goes!
Posted 17 years ago2007-04-07 15:42:27 UTC Post #218347
you legend!!
YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS!

but the origin is all messed up ...

there is no origin statement on my .QC (i posted a qc file earlier, not much as changed..where would i put that?)

you star mate .... made a man very relieved...been buggin me for ages!!
Posted 17 years ago2007-04-07 15:49:17 UTC Post #218348
You can put it anywhere that isn't inside the bracket of the values above it (I.e., not in the brackets of the skeletal animations).

I generally put it between the materials directory and the hitbox values. Easy to keep track of.
Posted 17 years ago2007-04-07 15:56:36 UTC Post #218349
so its simply

$origin 0 0 65

?

got an error when i put that in last time is all
Posted 17 years ago2007-04-07 16:53:00 UTC Post #218354
oooh it works...
not trial and error with the origin points now ...!
Posted 17 years ago2007-04-07 17:40:23 UTC Post #218356
Hooray!

Let's see some screenshots of the gun!
Posted 17 years ago2007-04-07 17:45:31 UTC Post #218357
hahaha ok .... once i get the gun in the game correctly!
at the moment im using points 0 60 0 ... the gun is in the center...but facing me ... i havent really got a clue about this (suprise suprise)..
i used 0 -60 0 and that didnt work...do you know which digit is the one to turn it 180 degrees?
Posted 17 years ago2007-04-07 17:50:27 UTC Post #218358
Oh jeez, I don't know if you can fix that with lines in the .QC.

You may have to take the entire model in XSI, including the bones, and rotate them 180 degrees so that they're facing the correct direction in XSI, then recompile them. I'll look into that, though.
Posted 17 years ago2007-04-07 17:51:31 UTC Post #218359
Oh jeez, I don't know if you can fix that with lines in the .QC.

You may have to take the entire model in XSI, including the bones, and rotate them 180 degrees so that they're facing the correct direction in XSI, then recompile them. I'll look into that, though.

I don't know if this will work, but try adding 3 more digits to the end of the line, to make it look like:

$origin 0 60 0 0 0 180

Perhaps the additional values will be recognized as rotational values. Who knows?
Posted 17 years ago2007-04-07 17:52:49 UTC Post #218360
ok sweet..
well im doing a trial and error thing with the origin points at the moment ...
but il look try that XSI program now...
cheers dude!
You must be logged in to post a response.