Solution to error_access_violation

Got problems with your models? Struggling with textures? Get help with your custom assets.

Solution to error_access_violation

Postby TorQueMoD on Fri Jun 27, 2008 9:37 pm

Hey guys!

So I ran into the error_access_violation error that I've noticed a lot of people have been having problems trying to get around and I figured out how to actually solve this problem that doesn't involve anything weird like having model viewer running in the background, or editing your game_info.txt file.

First of all, the reason the problem is occuring is simply because your QC file is not written correctly, or rather that the SDK isn't understanding it. The key to fixing the problem is to specify all of the paths to your model's source files. (IE where you're keeping them on your hard drive)

Here is what my QC file looks like:
Code: Select all
$modelname warzone/ships/enemy_ship.mdl

$cdmaterials models/warzone/ships
$staticprop
$surfaceprop "metal"
$scale 0.5

$body studio "Z:/warzone/models/smds/enemy_ship_ref.smd"

$sequence idle "Z:/warzone/models/smds/enemy_ship_ref.smd" loop fps 15

$collisionmodel "Z:/warzone/models/smds/enemy_ship_ref.smd" {
     $Mass 2000
   $concave
}


In the first line ($modelname warzone/ships/enemy_ship.mdl), you specify the directory you want the compiled model to be placed in. warzone/ships/ means that the compiled model will be placed in the models directory of your mod in the sub folders warzone/ships. As such, you need to create the same directory structure in the models/materials/ folder of your mod and place the model's vtf and vmt files there which is what the next line is. ($cdmaterials models/warzone/ships)

The next 3 lines should be self explanitory;

$staticprop - use this line to specify that the model has no moving parts (IE no animation) if you want to make an animated model, simply remove this line.

$surfaceprop "metal" - this specifies the overall material of the model. Don't worry if some parts of the model are a different material (my ship has glass windows) this is more for the physics than anything else.

$scale 0.5 - this is the scale of the model. I wanted my ship to be compiled at half the normal size.

Now this is where you need to specify the paths of the source files on your hard drive. In my case, I store the files on my Z:\ drive (yeah its weird) under the folders models and then smds.

$body studio "Z:/warzone/models/smds/enemy_ship_ref.smd" - Absolutely required for the model to compile. I even specify the extension because I ran into an error where the sdk was looking for an obj file when I did not specify. Doesn't hurt to be precise.

$sequence idle "Z:/warzone/models/smds/enemy_ship_ref.smd" loop fps 15 - this is the idle sequence for the model. With a static model, you can simply use your reference smd. For an animated model, you would want to use the "skeletal animation" smd. You can also specify as many sequences as you like here. $sequence flaps_down "Z:/warzone/models/smds/enemy_ship_flaps_down_ani.smd" loop fps 30 would be how I would name an animation for the wing flaps of my ship moving down.

$collisionmodel "Z:/warzone/models/smds/enemy_ship_ref.smd" { - this is the collision model.
$Mass 2000 - this is the mass in kilograms of the model (for physics)
$concave - all collision models MUST be concave. Which means they must be built from several boxes if you're making something like an archway model that the player can walk under/through.

If you have a custom collision model, then you would specify it above. If, like in my example, you don't have a custom collision model, simply specify your reference smd and the SDK will generate one for you automatically.

After creating this QC I run studiomdl from the command prompt:

Start - Run - cmd [enter] - don't type anything in the [ ] just press the key

now inside the command prompt window I type:

cd "%studiomdl%" [enter] - yes you need the quotes

cd g: [enter] - this switches to the hard drive you have steam installed in. If you installed steam on your C: drive which is the default location, then you would type cd c: instead of cd g:

cd bin [enter]
cd ep1 [enter]
cd bin [enter]

now you are in the proper directory for running studiomdl

studiomdl - Z:\warzone\models\smds\enemy_ship.qc [enter]

A little trick that I have to save time is that I open the directory where my smd and qc file is located in My Computer, copy the "address" and then after typing studiomdl - I right click on the command prompt window and choose paste from the drop down. Then I only have to type \enemy_ship.qc

After waiting a few seconds, your model should compile and place itself in the correct location for viewing in Hammer or the model viewer.
User avatar
TorQueMoD
Been Here A While
Been Here A While
 
Joined: Wed Oct 19, 2005 7:15 am
Location: Vancouver, Canada

Return to Custom Asset Help

Who is online

Users browsing this forum: No registered users