Left 4 Dead 2

Left 4 Dead 2

机瞄模组 [VScript]
 此主题已被置顶,因此可能具有重要性
Minimum Instructions For Lazy Modders To Create ADS Mod
This guide explains, step by step, how to create a minimal ADS functionality for a weapon viewmodel using Blender + Blender Source Tools, intended for beginners or lazy modders who want a minimal workflow.
Key Points of This Article
  1. To make ADS work, you need to add at least a single ACT_PRIMARY_VM_IDLE sequence with one frame.
  2. Using the fadein and fadeout blending options automatically interpolates the ACT_PRIMARY_VM_IDLE_TO_LOWERED animation.
  3. Decompiling may break IK, but replacing ikrule “\w+” touch with ikrule “\w+” release often allows ignoring broken IK.
Prerequisites
  • your weapon mod
  • Blender (any stable 2.8+ recommended)
  • Blender Source Tools add-on installed and enabled
  • Crowbar (to extract smd files from vpk)
  • studiomdl.exe (to recompile the model)
Overview (what we will do)
  • Import the existing viewmodel and its idle_raw.smd into Blender.
  • Edit the armature’s pose to create a single-frame ADS pose.
  • Export that single-frame pose as a new SMD named ads_idle.smd and put it into the decompiled folder so the mod can use it as ACT_PRIMARY_VM_IDLE.
Step-by-step instructions
1. Import model and animation
  • extract .mdl and related files from vpk and decompile with Crowbar
  • In Blender, use File → Import → Source Engine (.smd/.qc) from the Blender Source Tools.
  • Import the weapon model and the idle_raw.smd animation. (If you have another simple SMD with a pose you prefer, that’s okay — we only need a starting pose.)
2. Trim animation to a single pose
  • Switch to Pose Mode for the armature.
  • Select all bones (press a).
  • Open the Dope Sheet / Action Editor so you can see keyframes.
  • Delete all keyframes from frame 2 onward so only frame 1 remains. This ensures the animation is a single static pose (an “idle” pose).
3. Create the ADS pose (the single-frame ADS idle)
  • With the armature still in Pose Mode, pose the rig into the ADS position:
    • Select the weapon’s top-level bone (commonly ValveBiped.weapon_bone) and the hand root bones simultaneously (e.g., ValveBiped.Bip01_L_Hand and ValveBiped.Bip01_R_Hand).
    • Move the weapon toward the camera attachment point (ValveBiped.attach_camera). This makes the weapon align with the view/camera for aiming.
    • Apply rotation adjustments first, then translate (move) the bones. Rotating before moving usually preserves natural orientation and avoids odd offsets.
  • Once happy with the pose, insert a keyframe for all selected bones at frame 1 (press i). Now frame 1 contains your ADS pose.
4. Export and place the new SMD
  • Export the animation as an SMD using Blender Source Tools: Properties → Scene → Source Engine Export and choose to export the current action/animation.
  • The exporter will produce an SMD (often named idle_raw.smd if you overwrote). Rename the exported file to ads_idle.smd.
  • Copy ads_idle.smd into the decompiled model folder for your viewmodel animation (the same folder with existing SMDs and QC). Replace or add it alongside other animations.
5. Editing the .qc file
Append following code. Replace [your animation folder] with proper foldername.
$Sequence "ads_idle" { "[your animation folder]\ads_idle.smd" activity "ACT_PRIMARY_VM_IDLE" 1 fadein 0.1 fadeout 0.1 fps 30 loop ikrule "lhand" release contact 0 fakeorigin 0 0 0 fakerotate 0 0 0 floor 0 height 0 radius 0 range 0 0 60 60 target 0 ikrule "rhand" release contact 0 fakeorigin 0 0 0 fakerotate 0 0 0 floor 0 height 0 radius 0 range 0 0 60 60 target 1 }
6. Recompile .qc with studiomdl.exe
You might notice some strange hand movements. This is because the IK broke when you decompiled or added new animations. Rewriting the QC file carefully might fix it, but if you're in a hurry, here's a quick fix: Replace all ikrule “\w+” touch “\w+” with ikrule “\w+” release in .qc file.
最后由 Wabisuke 4 Dead 编辑于; 10 月 23 日 下午 7:34
< >
正在显示第 1 - 4 条,共 4 条留言
4512369781  [开发者] 10 月 21 日 上午 2:57 
Thanks a lot!:steamthumbsup:
kouga  [开发者] 10 月 21 日 上午 9:59 
good stuff
Wabisuke 4 Dead 10 月 23 日 下午 7:31 
I created this mod myself following this guide. Give it a try. :steamhappy:
Stalinator ☭ 10 月 31 日 上午 9:51 
Best tutorial im making new ads mods :zhand:
< >
正在显示第 1 - 4 条,共 4 条留言
每页显示数: 1530 50