Left 4 Dead 2
No hay suficientes valoraciones
Survivor Item Attachments
Por Urik
A venture in simplifying placements of item attachments for survivors.
   
Premiar
Favoritos
Favorito
Quitar
intro
edit: I don't recall how long ago it was, but it must've been like 2017 when this guide was written. I wasn't sure about it so I never published it. Now I'm thinking "**** it", let's just publish it and whatever. I'm not even going to review anything I wrote back then.
It's also the only guide that has made it past "draft" state - I've got a few other "stubs", but they're not worth anything in my opinion and at this point I hate it all so much I don't see myself finishing them anymore.
Premise
Hey, it's my first guide here, and hopefully I'll retain retain the courage to share more of what I know.
There's a lot of stuff I've never mentioned, regarding specifics about textures, hud, particles, and so on. For the longest time it's been my intent to share some of that, but my procrastination, self issues, mood and reluctance to go back to L4D2 modding got the best of me during recent years. Another part of it was the fact that I always seen video as the preferred medium, but it never happened that way either.
Journalism hasn't ever been my forte, but after completing this, I see the benefits of this form of tutorials. And while it is time consuming and mundane, it isn't as bad as I thought it would be.
Introduction
Ever since I did my first survivor mod, one of the annoying final steps of the process was attachment positioning for item placement. The fact that it comes after I already endured an intercourse with rigging, bone weighting and texture retouching, only added to the frustration. And since HLMV can't actually render the items for those attachments, the only way to check was to load the game. That meant a vicious cycle of :
  • making a tweak
  • recompiling the model
  • re-loading the map because it's the only way to reload the model in-game
And to top it off, there comes HLMV's own way of treating the 3D axes which are in completely wrong order (ZYX, apparently?), which turned the process into a happy quiz of "let's guess where the funk will it go if I change this digit".

Hence, eventually the idea came about to have the items placements positioned via custom bones that can be used for the attachments in .QC, and have all tweaks done "in house" in 3ds Max.
Behind The Scenes
The item offsets, as well as default placements on each survivor were figured with the help of screen ripping tool called 3D Ripper DX, which allows to capture contents of the screen as one scene, retaining the layout of objects in it. It was then matched up in 3ds Max to figure out item offsets, rather precisely. At later stages, when "capturing" placements for each survivor, I'd break their animation files by editing the game archives to force them into a T-pose so that they can be matched up with their recompiled originals.
Textures were converted to JPG format and saved with filesize in mind, but they're only for reference.
I'll mention them once again down the line.
Disclaimer: Software
The projects in the download are for 3dx Max 2012. It's what I still use to this day, but anyhow, I figured, at this point, most Max users would have at least the 2012 release. If there turns out do be the demand, I would make the 2010 files as well.
As for Blender,
I don't use it, but still, some efforts to provide compatible files have been made. However, none of what I tried seemed to allow to import the bones and yet preserve weights. So until someone who actually knows how to use Blender manages to port the files, I only have this:
Contents, Unpacking & Setup
In the download, you'll find .max projects and .jpg images for the textures.
For each survivor, there's Attachments_<name>.max project and also Survivor_<name>_w_Attachments.max
The latter also includes full skeleton and mesh of the original survivor, and the attachment bones have been linked to the skeleton; it's meant for reference use. I'll go into further defail in the next section.

Extract the contents to wherever you like. If you open one of the project files, 3ds Max should pick up on the textures as long as they're in the same folder; however, if you import these projects in your scenes, you might not get the textures. So, if you're getting this:

The you could fix that by configuring user paths ( press "browse" or customize > configure user paths ):


Note: it may require re-opening the file after these changes to get textures to load.
Let's Get It On!
We'll use Ellis for example.
First, let's open Survivor_Ellis_w_Attachments.max :

This is regular decompiled Ellis, with full skeleton. The items are positioned exactly how they are in the original. The attachment bones ( more about them later ) are linked to the skeleton bones accordingly. The point of this is that if we wish, we can leave this window open and use it down the line as a reference.

Now, next step is to EITHER open Attachments_Ellis.max, and then import > merge our custom Ellis replacement scene into it, OR do vice versa ( open mod project, and import Attachments_Ellis.max into it ). If you do the latter, though, you might not get textures loaded for attachments IF they're not your in Autodesk user paths, but I mentioned this already.
[/previewicon]

Now, you'll see all these new objects ( meshes ) in your scene. There are also bones for each attachment. If you press H to open "Select From Scene" window, you'll see all the new objects:

( note: In more recent versions of 3ds Max, objects might be displayed hierarchically - but you probably already know that )
The meshes ( the actual items ) have the at_ prefix, whereas their bones have bone_ prefix.
Note that the bones are named after the attachments in .QC - for ease of reference.
For sake of clarity, let's list the attachments and the items they're responsible for:

bone name
attachment
items
bone_medkit
medkit
medkit, defibrillator
bone_melee
melee
melee weapons
bone_molotov
molotov
molotov, pipe bomb, bile bomb
bone_pills
pills
pain pills, adrenaline
bone_pistol
pistols
pistol, magnum pistol ( desert eagle )
bone_primary
primary
primary weapons

First of all, let's hide a few items ( meshes ) that I don't want here: at_molotov, at_medkit, at_chainsaw. These weren't originally included, but I later added them as extra.
You can select multiple items with ctrl+left mouse, or from "select from scene" menu, and then right click > hide selection


Now, how do we position these items? The rule is to ONLY move their respective bones.
In fact, if you select the meshes, the transform gizmos are actually offset way behind; it wasn't intentional, but it helps to notice if you accidentally selected the mesh.

So, let's start with pistol attachment, and select bone_pistol:
Then proceed tweaking it until we're satisfied. We can use the coordinates input boxes below with "offset mode" enabled, and press up/down buttons to move it by fractions of a unit:

Same goes for rotation. Here is the final result:

Notice I positioned it somewhat in the center of holster in the X axis, so that if some custom model extends either way, there's a bit extra space. Although, it won't always help :

But hey, you can't avoid everything! Now, let's go over to the pills/adrenaline by selecting bone_pills:

Now this is nasty, init? Not only they're offset from one another, they're also at an angle. So depending on how much you let pills "sink" into the body, there's going to be more or less gap to adrenaline.
I ended up rotating the pills a couple times to find a middle ground where adrenaline sorta comes in contact with the hip:

Onto the pipebomb ( bone_molotov ):

Has this been a more close-fitting model, we probably wouldn't need to tweak much. But the puffy vest hides upper half of the pipe bomb, so I'll tilt it to the side to remedy that:

Now, while we're at it, let's check how molotov will look by unhiding it ( right click > unhide by name > at_molotov ):

Splendid. Let's move onto... bone_medkit, which, currently, has just defibrillator visible:

( I've hidden everything else so it doesn't get in the way ).
Now that I think of it, I'm glad I did add the medkit mesh afterall. Because there's some offset between them as well. Let's unhide the at_medkit:

Now, you see, there's quite an offset angle between them in X axis. So it we were to rotate the bone in negative X for the defibrillator to match the spine surface, medkit's top half would start "overhanging" from the top... so, again, compromise, baby:


Alright, enough of this ICU ( and I see you, you're a fine nurse )
To the primary weapon ( bone_promary, at_snipermilitary):

Once again, the warm puffy vest sinks the gun in it, so let's just pull it outta there and align nicely.

Note that generally, the gun's grip/handle height should be somewhat in line with defibrillator's top:

Last but not by any means least in importance, the melee attachment ( bone_melee, at_katanaguitar ):

Same thing here. Let's just pull it back a bit.
We want the guitar to be somewhat in contact with the body, or close to, and yet not have katana blade completely submerged into it.
Edit: I realized later that's not quite the case. Just look at the reference files, the neck of guitar doesn't contact the body, and neither does katana. You'll see more of this mentioned in the "Aftermath" section.
Bottom line: I shouldn't put the guitar neck and katana so close to the body

Time to unhide at_chainsaw and see how it plays along:

As usual, it sinks in left shoulder blade a bit, but I'm okay with that.
Finishing Up: Linking Bones & .QC
Guess what? I hit a char limit in the previous section. Anyhow, now what?

Assuming we're satisfied, let's proceed to linking bones. First, hide ALL the mesh so it doesn't get in the way:

To link a bone, select it, then select the link tool at top left corner, and link the attachment bones to their respective parents:


Here's the reference:

bone_medkit
ValveBiped.Bip01_Spine4
bone_melee
ValveBiped.Bip01_Spine4
bone_primary
ValveBiped.Bip01_Spine4
bone_molotov
ValveBiped.Bip01_Spine
bone_pills
ValveBiped.Bip01_Spine
bone_pistol
ValveBiped.Bip01_R_Thigh

Notes
  • Original Zoey has pistol attached to ValveBiped.jiggle_holster which is a custom jigglebone for her holster.
  • Depending on your model model, you can choose different bones to parent to, at your discretion.
For example, here's pills attached to ValveBiped.Bip01_Pelvis on a robotic model:


You can check your success by twisting the parent bones around

Once we're done linking the bones, let's bring back the model-related mesh, but not the attachments mesh, and then export the .smd:

In the Ellis .QC, add the new attachments:
$attachment "pistol" "bone_pistol" 0 0 0 rotate 0 0 0 $attachment "primary" "bone_primary" 0 0 0 rotate 0 0 0 $attachment "melee" "bone_melee" 0 0 0 rotate 0 0 0 $attachment "medkit" "bone_medkit" 0 0 0 rotate 0 0 0 $attachment "molotov" "bone_molotov" 0 0 0 rotate 0 0 0 $attachment "pills" "bone_pills" 0 0 0 rotate 0 0 0


Don't forget to comment out the old attachments:
The Aftermath
Assuming our compiling went fine, we're left with testing our work in game.
Let's head over to main head archive ( explained: left4dead2\pak01_dir.vpk ), open it with notepad++, and replace all survivor_mechanic with survivor_mechanix with "match case" checked:
Don't forget to save it, of course. But don't close it, as you might want to undo it later.

Note: for L4D1 survivors, you'd have to edit _dlc1 and _dlc2 archives. But I might mention things like these in vpk editing guide, if I ever make one.

Upon loading the game, I fired up a survial of Parish:Bridge from the console before the workshop had the chance to initialize.
Ouch.. Perhaps I shoul've tilted the melee bone forward a bit, the guitar sinks into lower spine. The vest is somehow to blame again.
Although, it happens to original survivors as well, to a lesser degree:
Pills and pistol are fine, though.
One more thing I noticed just now, that frying pan seems to be offset towards the front:
Which is more apparent in my model:

Now I also noticed guitar's neck doesn't come in contact with spine in original survivors. I should've followed the reference more closely:

Anyway, the point was to show the process, and this just showcases the probable inevitability of further tweaking.
If we were to tweak this further, the process would be:
  • go back to 3ds Max, tweak, re-export smd
  • compile
  • re-load the map in L4D2

Note that in order to tweak a given attachment bone position, you'd have to first unlink it, move it, and then relink it back!!! But you won't have to unlink for rotation.



And DON'T FORGET to undo changes to the vpk archive(s) when you're done, to be able to join online games. Or restore them from backup ( which I didn't mention you should have ), or verify game cache.
Conclusion
I'll admit the ending might be somewhat abrupt, but it kinda burned me out at this point.
Hopefully it's been helpful, and I definitely went into way more detail than I thought I would.
6 comentarios
dsaS 11 NOV 2023 a las 11:07 
jimbo 24 ABR 2022 a las 11:42 
no life?
chucknra 23 MAY 2021 a las 19:34 
Awesome!
Miyumi 7 MAY 2021 a las 12:28 
Ohhh very helpful! Thank you for this!
Tsuey 25 JUN 2019 a las 7:38 
Thoroughly entertaining and informative!
Urik  [autor] 19 JUN 2019 a las 4:26 
I am slightly frightened to finally publish this. And if anyone will have questions, it's not like I actually remember any of that stuff well at this point.