[TUTORIAL] Complete Guide to Adding Custom Objects to your TF2 Map

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
I still cannot get this to work. I have taken a screenshot of the output from the batch file to see if anyone can help. This is the same problem I ran into before and I am at a loss on how to deal with it. I'm on my last nerve with model compiling for steam. What an archaic system.

qbgeupgiko.jpg
 

Hawk

L7: Fancy Member
Dec 3, 2007
419
213
Ah... I remember my last nerve.

That screenshot for the compile does give me some clues. First of all, I can tell your collision model isn't completely convex. It also looks like the process isn't finishing, so there's no end product to look at. But there's still a little more I need to know.

What software did you export your .SMD files from?
Are testbox_ref and testbox_idle singular objects?
Do all of your models have UVs and textures assigned to them?
 

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
Ah... I remember my last nerve.

That screenshot for the compile does give me some clues. First of all, I can tell your collision model isn't completely convex. It also looks like the process isn't finishing, so there's no end product to look at. But there's still a little more I need to know.

What software did you export your .SMD files from?
Are testbox_ref and testbox_idle singular objects?
Do all of your models have UVs and textures assigned to them?

1. XSI Mod Tool - used the valve tool for export

2. The object is a one object cube - used for test purposes as the simplest shape I could make.

3. All models have UVs and textures - I followed the Noesis tutorial to the letter in this regard.

I have never manged to compile without the p4lib.dll error. The "check for write enable" error I have received before. I've even gone as far as changing file permission via DOS to solve the problem, to no avail.

I honestly have no clue what is going on. I can easily compile custom textures with spec maps etc., but this is just beyond me.
 
Last edited:

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
I FINALLY GOT A MODEL TO COMPILE! HURRAY!

Here's what I was doing wrong.

The error that says p4lib.dll doesn't seem to do anything negative to the model.

However, the error that said "check for write enable" meant that the compiler could not find the directory, and in turn, was not willing to make that directory. So I went and made the directory myself, and voila! Compiled model.

I still have issues with the texture - ie. its not working at all. But I'm still really pumped about actually getting the model to compile, so its not bothering me too much :p
 

Buddikaman

L3: Member
Dec 31, 2007
107
11
This is a fantastic tutorial! Ive been looking around for tutorials on importing objects and they all stink, this has helped me alot. I only wish it was 3dsmax. Good luck on your map!

-Buddikaman-
 
Last edited:

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
After a bunch of work trying to get my texture to show, I'm going to give up on this particular model. I recall when doing the texture I did not follow one important step in making the UV Map. I did this because the UV map was changing the colors for whatever reason. I was using a red corrugated metal texture, and every time I would UV map it would change each side of the cube to purple, green, yellow etc., and the texture changed color as well.

In any event, I'm going to start another one just to make sure I follow everything to the letter this time.

Thanks again for the great work on this tutorial.
 

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
I gave it another shot tonight. I got a successful compile, but still no texture showing up. Pink and black in model viewer. I double checked the directory structure and everything looks ok.

Can an improper UV map/XSI texture application cause this? I made damn sure I followed your guide very closely. There was one step that you detailed that DID NOT work for me - that is when you said to apply lambert, add your texture, and then apply to selected. I had to take one extra step to get the texture to show., and that was creating a new UV projection. I wonder if something happened there.

Any advice? I can feel I'm so close now.
 

Hawk

L7: Fancy Member
Dec 3, 2007
419
213
I'm glad you figured out the directory problem. I probably couldn't have figured that one out.

I had to take one extra step to get the texture to show., and that was creating a new UV projection. I wonder if something happened there.

My tutorial assumes that wherever you brought you model from, you had it fully UV mapped. I've never actually needed to project new UVs in Mod Tool, so I'm not sure what that's about.

But I do have some ideas. Did you try Source MDL Texture Info? For the very first model I made, I couldn't figure out how to get the textures set up. Then I downloaded that tool and made a batch file for it. I dragged my model onto and it analyzed it, telling me exactly what directory my model was looking at to find textures.
 

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
Thanks for the link to the tool, Hawk. I downloaded it and ran it on my model. It is telling me that my texture must be in the following path:

"<modname>\materials\custom_railing_1\railingtexture_diffuse\"

I see there is an extra "\" in there, which would indicate it wants another folder. I'm going to try and make that folder and see what happens.

HAH! Spelling error. "raillingtexture_diffuse" vs. "railingtexture_diffuse". I'm going to have to go check all of the spellings now.
 
Last edited:

Deadeye2007

L2: Junior Member
Jan 6, 2008
52
0
TA DA! I got a working, textured model!!!! You can't even imagine how excited I am right now. Thank you so much for all of your help, Hawk. I very much appreciate your time and efforts.
 

Hawk

L7: Fancy Member
Dec 3, 2007
419
213
No problem. It's thanks to people like Snipergen and spaceweasels that I even figured it out when I did... Just passing along the knowledge.
 
G

Gearloose

Awesome tutorial, Hawk - thanks very much. I'll be trying my hand at creating a model soon thanks to you.
 

oxy

L5: Dapper Member
Nov 27, 2007
208
30
Humm.. great tutorial..

I have tried many different things. I am trying to get a model from Maya to TF2 and I am close using your method...

Here is what is going on.


My QC File:
Code:
/*
----------------
Ball QC
----------------
*/

$modelname ball.mdl
$origin 0 0 0 90
$scale 1.0
$body "Body" "ball_ref.smd"
$staticprop
$surfaceprop "solidmetal"
$upaxis Z
$cdmaterials "ball/"

$sequence "idle" "ball_ref.smd" fps 30

$collisionmodel "ball_col.smd"
{
    //Mass in kilograms
    $mass 5.0
    $concave
}


My Error:
Code:
C:\Steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\ball>cd c:\Steam\ste
amapps\oxygencube\sourcesdk\bin\orangebox\bin\

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orangebox\bin>studiomdl.exe -nop4 -g
ame "c:\Steam\steamapps\oxygencube\team fortress 2\tf" "c:\Steam\steamapps\oxyge
ncube\sourcesdk_content\tf\modelsrc\ball\ball.qc"
WARNING: AppFramework : Unable to load module p4lib.dll!
all paths:c:\steam\steamapps\oxygencube\team fortress 2\tf\;c:\steam\steamapps\o
xygencube\sourcesdk\bin\orangebox\tf\;c:\steam\steamapps\oxygencube\sourcesdk\bi
n\orangebox\hl2\;c:\steam\steamapps\oxygencube\sourcesdk\bin\hl2\
qdir:    "c:\steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\ball\"
gamedir: "c:\Steam\steamapps\oxygencube\team fortress 2\tf\"
g_path:  "c:\Steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\ball\ball.
qc"
Building binary model files...
Working on "ball.qc"
SMD MODEL ball_ref.smd
ERROR: c:\steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\ball\ball.qc(
58): - bad command {
ERROR: Aborted Processing on 'ball.mdl'

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orangebox\bin>pause
Press any key to continue . . .


Thanks for any help you guys can give me, I can't complete my ambulance if I can't compile.
 

Hawk

L7: Fancy Member
Dec 3, 2007
419
213
Hmmmm... that's a tough one. Based on what I see there I can't exactly tell what's going on. But I guess the first things I would try would be making sure all the necessary files (like the .smd files) are in the proper directory. Then, I'd try opening up ball_ref.smd in Mod Tool to make sure it loads properly. My best guess would be a problem with the .smd files, because your .qc file looks good.
 

oxy

L5: Dapper Member
Nov 27, 2007
208
30
Ok.. after moving the VMT / VMF files to the same directory as the .SMD's I loaded the Reference.SMD up in ModTool.

This is what I got.

Not sure why the ball is looking like this?

Untitled-1-3.jpg



What does it mean when the edges are highlighted like this?

Untitled-2.jpg
 

oxy

L5: Dapper Member
Nov 27, 2007
208
30
So.. I have gone through the entire process again, creating a new model in Maya, new materials, new SMD's, new .QC and I am still getting the same error.

Here is the .QC I am trying to use:
Code:
/*
----------------
Pilar QC
----------------
*/

$modelname pilar.mdl
$origin 0 0 0 90
$scale 1.0
$body "Body" "pilar_ref.smd"
$staticprop
$surfaceprop "metal"
$upaxis Z
$cdmaterials "pilar/"

$sequence "idle" "pilar_ref.smd" fps 30

$collisionmodel "pilar_col.smd"
{
    //Mass in kilograms
   $mass 1.0
   $concave
}


Here is the error that the prompt is printing:
Code:
C:\Steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\pilar>cd c:\Steam\st
eamapps\oxygencube\sourcesdk\bin\orangebox\bin\

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orangebox\bin>studiomdl.exe -nop4 -g
ame "c:\Steam\steamapps\oxygencube\team fortress 2\tf" "c:\Steam\steamapps\oxyge
ncube\sourcesdk_content\tf\modelsrc\pilar\pilar.qc"
WARNING: AppFramework : Unable to load module p4lib.dll!
all paths:c:\steam\steamapps\oxygencube\team fortress 2\tf\;c:\steam\steamapps\o
xygencube\sourcesdk\bin\orangebox\tf\;c:\steam\steamapps\oxygencube\sourcesdk\bi
n\orangebox\hl2\;c:\steam\steamapps\oxygencube\sourcesdk\bin\hl2\
qdir:    "c:\steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\pilar\"
gamedir: "c:\Steam\steamapps\oxygencube\team fortress 2\tf\"
g_path:  "c:\Steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\pilar\pila
r.qc"
Building binary model files...
Working on "pilar.qc"
SMD MODEL pilar_ref.smd
ERROR: c:\steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\pilar\pilar.q
c(59): - bad command {
ERROR: Aborted Processing on 'pilar.mdl'

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orangebox\bin>pause
Press any key to continue . . .



Here is a hint. When I comment out this area of the .QC:
Code:
$collisionmodel "pilar_col.smd"
//{
    //Mass in kilograms
 //   $mass 1.0
 //   $concave
//}


It compiles but completely skips the collision process so my model doesn't show a Physics Model in model viewer. This is the printing:
Code:
C:\Steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\pilar>cd c:\Steam\st
eamapps\oxygencube\sourcesdk\bin\orangebox\bin\

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orangebox\bin>studiomdl.exe -nop4 -g
ame "c:\Steam\steamapps\oxygencube\team fortress 2\tf" "c:\Steam\steamapps\oxyge
ncube\sourcesdk_content\tf\modelsrc\pilar\pilar.qc"
WARNING: AppFramework : Unable to load module p4lib.dll!
all paths:c:\steam\steamapps\oxygencube\team fortress 2\tf\;c:\steam\steamapps\o
xygencube\sourcesdk\bin\orangebox\tf\;c:\steam\steamapps\oxygencube\sourcesdk\bi
n\orangebox\hl2\;c:\steam\steamapps\oxygencube\sourcesdk\bin\hl2\
qdir:    "c:\steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\pilar\"
gamedir: "c:\Steam\steamapps\oxygencube\team fortress 2\tf\"
g_path:  "c:\Steam\steamapps\oxygencube\sourcesdk_content\tf\modelsrc\pilar\pila
r.qc"
Building binary model files...
Working on "pilar.qc"
SMD MODEL pilar_ref.smd
---------------------
writing c:\Steam\steamapps\oxygencube\team fortress 2\tf\models/pilar.mdl:
bones          964 bytes (1)
animations     112 bytes (1 anims) (1 frames) [0:00]
sequences      220 bytes (1 seq)
ik/pose        164 bytes
eyeballs         0 bytes (0 eyeballs)
flexes           0 bytes (0 flexes)
textures        72 bytes
keyvalues        0 bytes
bone transforms        0 bytes
collision        0 bytes
total         1712
---------------------
writing c:\Steam\steamapps\oxygencube\team fortress 2\tf\models/pilar.vvd:
vertices      5232 bytes (109 vertices)
tangents      1744 bytes (109 vertices)
total         7040 bytes
---------------------
Generating optimized mesh "c:\Steam\steamapps\oxygencube\team fortress 2\tf\mode
ls/pilar.sw.vtx":
body parts:         8 bytes
models:            20 bytes
model LODs:        12 bytes
meshes:             9 bytes
strip groups:      25 bytes
strips:            27 bytes
verts:            981 bytes
indices:          960 bytes
bone changes:      16 bytes
everything:      2082 bytes
---------------------
Generating optimized mesh "c:\Steam\steamapps\oxygencube\team fortress 2\tf\mode
ls/pilar.dx80.vtx":
body parts:         8 bytes
models:            20 bytes
model LODs:        12 bytes
meshes:             9 bytes
strip groups:      25 bytes
strips:            27 bytes
verts:            981 bytes
indices:          960 bytes
bone changes:      16 bytes
everything:      2082 bytes
---------------------
Generating optimized mesh "c:\Steam\steamapps\oxygencube\team fortress 2\tf\mode
ls/pilar.dx90.vtx":
body parts:         8 bytes
models:            20 bytes
model LODs:        12 bytes
meshes:             9 bytes
strip groups:      25 bytes
strips:            27 bytes
verts:            981 bytes
indices:          960 bytes
bone changes:      16 bytes
everything:      2082 bytes

Completed "pilar.qc"

c:\Steam\steamapps\oxygencube\sourcesdk\bin\orangebox\bin>pause
Press any key to continue . . .


I have attached my ...sourcesdk_content/tf and all of it's contents as a .ZIP file. I would love if somebody could help me out.:confused1::sad::bored:
 
Last edited:

Snipergen

L13: Stunning Member
Nov 16, 2007
1,051
150
Ok so your collision mesh is bad. You do know that you have to build a very low poly collision mesh and export this as a diffrent .smd right? You can't just use the original model for collisions, that's too complex, build it from some extruded cubes etc.