Page 1 of 1

Add a custom muzzle flash effect

PostPosted: Sun Aug 14, 2011 11:39 pm
by MisterMusician
Hello everyone,

I would create a new muzzle flash for news weapons but the problem is that I don't know where to begin. The only
thing that I did is to modify the color and the image of the muzzle flash ( smg ) with a .vtf file.
The problem is that affect every weapons.
But I would like to knowhow to modify the shape of the muzzle flash and do I must use a particle .pcf file or just a .vtf ?

Thanks.

Re: Add a custom muzzle flash effect

PostPosted: Sun Aug 14, 2011 11:59 pm
by Jangalomph
If you want to be simple. Just use a new vtf :)

using a PCF takes a little more work.

Re: Add a custom muzzle flash effect

PostPosted: Mon Aug 15, 2011 12:13 am
by MisterMusician
Well, I think I'll use a pcf but how do I get it work on a specifed weapon ? For exemple, if I want to change the Smg's muzzle flash, how I can do this ? Because I didn't find where are located valve's muzzle.

Edit : I saw in the .qc file that it uses "SMG MUZZLE1" so I tried to name the vtf with the same words but without succes :/

Re: Add a custom muzzle flash effect

PostPosted: Mon Aug 15, 2011 12:33 am
by Gary

Re: Add a custom muzzle flash effect

PostPosted: Mon Aug 15, 2011 12:43 am
by MisterMusician
This one is for NPC, I forgot to precise that I would like to modify the view model muzzle flash.
But I'll try something else base on this.

Re: Add a custom muzzle flash effect

PostPosted: Mon Aug 15, 2011 1:21 am
by Jangalomph
You've gotta compile it in the QC file.

Example useing AR2.

Code: Select all
/*
==============================================================================

IRifle

==============================================================================
*/

$modelname weapons/v_IRifle.mdl
$cdmaterials models\Weapons\V_hand models\Weapons\V_irifle

// whole body
$body studio "IRifle_reference.smd"

$origin 0 0 67

//Muzzle flash
$attachment "muzzle" "Base" 0 0 20 rotate -90

$poseparameter "VentPoses" 0 1


// OLD MUZZLES - CONTROLLED BY ENGINE PARTICLES - DELETE ( COMMENT )

$sequence IR_idle "Idle" loop fps 30 activity ACT_VM_IDLE 1 node Ready
//$sequence IR_fire "Fire01" fps 30 snap activity ACT_VM_PRIMARYATTACK 1 { event AE_MUZZLEFLASH 0 "COMBINE MUZZLE" } node Fire
//$sequence fire2 "Fire02" snap fps 30 activity ACT_VM_RECOIL1 1 { event AE_MUZZLEFLASH 0 "COMBINE MUZZLE" } node Fire
//$sequence fire3 "Fire03" snap fps 30 activity ACT_VM_RECOIL2 1 { event AE_MUZZLEFLASH 0 "COMBINE MUZZLE" } node Fire
//$sequence fire4 "Fire04" snap fps 30 activity ACT_VM_RECOIL3 1 { event AE_MUZZLEFLASH 0 "COMBINE MUZZLE" } node Fire
//$sequence IR_fire2 "Alt_fire" fps 30 snap activity ACT_VM_SECONDARYATTACK 1 { event AE_MUZZLEFLASH 0 "COMBINE MUZZLE" }


// NEW MUZZLES USING OB PARTICLE SYSTEM


// How it works? - We changing old "event AE_MUZZLEFLASH" to new OB Thing "event AE_CL_CREATE_PARTICLE_EFFECT"
// "muzzle_ar2" - The Name Of Muzzle ( NOT .pcf file! the name of particle inside .pcf file )
// "follow_attachment" - moving to bone
// "muzzle" - bone name, where particle dispatching


$sequence IR_fire "Fire01" fps 30 snap activity ACT_VM_PRIMARYATTACK 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_ar2 follow_attachment muzzle" }
$sequence fire2 "Fire02" snap fps 30 activity ACT_VM_RECOIL1 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_ar2 follow_attachment muzzle" }
$sequence fire3 "Fire03" snap fps 30 activity ACT_VM_RECOIL2 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_ar2 follow_attachment muzzle" }
$sequence fire4 "Fire04" snap fps 30 activity ACT_VM_RECOIL3 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_ar2 follow_attachment muzzle" }
$sequence IR_fire2 "Alt_fire" fps 30 snap activity ACT_VM_SECONDARYATTACK 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_ar2 follow_attachment muzzle" }

// TEH END OF NEW CODE

$sequence IR_reload "Reload" fps 30 activity ACT_VM_RELOAD 1 node Ready {
{ event AE_CL_PLAYSOUND 1 "Weapon_AR2.Reload_Rotate" }
{ event AE_CL_PLAYSOUND 19 "Weapon_AR2.Reload_Push" }
}

$sequence IR_draw "Draw" fps 30 snap activity ACT_VM_DRAW 1 node Ready
$sequence IR_holster "Holster" fps 30 activity ACT_VM_HOLSTER 1 node Ready
$sequence idletolow "idle_to_low" fps 30 activity ACT_VM_LOWERED_TO_IDLE 1  transition Ready Low
$sequence lowtoidle "Low_to_idle" fps 30 activity ACT_VM_IDLE_TO_LOWERED 1 transition Low Ready
$sequence lowidle "Low_idle" fps 30 loop activity ACT_VM_IDLE_LOWERED 1 node Low
$sequence shake "Shake" fps 30 loop activity ACT_VM_FIDGET 1 node Fire

$animation a_vent_neutral "Vent_Poses" frame 0 0
$animation a_vent_open "Vent_Poses" frame 0 0 subtract a_vent_neutral 0
$animation a_vent_closed "Vent_Poses" frame 1 1 subtract a_vent_neutral 0
$sequence VentPoses a_vent_open a_vent_closed blend "VentPoses" 1 0 delta autoplay


Just read the lines.. its pretty simple. Must be recompiled into the QC.

Re: Add a custom muzzle flash effect

PostPosted: Mon Aug 15, 2011 11:58 am
by MisterMusician
Thanks for that, I tried it but I still got a little problem.. :/

Image

I just decompile the smg model and then, recompile it with the new .qc, as you can see, the muzzle flash is far away.
I rename the muzzle bone, "ValveBiped.muzzle" as in 3d max. In the model viewer, the bones is correct but in game, it's like on the picture and the muzzle flash stay in the same direction

Edit : I fixed this problem, it was the name of the muzzle, I renamed it, here the line : $attachment ( it' was just "muzzle" before ) "ValveBiped.muzzle" "ValveBiped.muzzle" -0.00 -0.00 0.00 rotate 0.00 0.00 0.00
Now it works fine, here is my .qc if it cans help :

$modelname "weapons/v_smg1.mdl"
$model "studio" "Smg1_reference.smd"
$cdmaterials "models\Weapons\V_hand\"
$cdmaterials "models\Weapons\V_smg1\"

// Model uses material "v_hand_sheet.vmt"
// Model uses material "texture5.vmt"
// Model uses material "texture4.vmt"
// Model uses material "v_smg1_sheet.vmt"

$attachment "ValveBiped.muzzle" "ValveBiped.muzzle" -0.00 -0.00 0.00 rotate 0.00 0.00 0.00

$attachment "1" "ValveBiped.eject" -0.00 -0.00 0.00 rotate 0.00 0.00 0.00

$surfaceprop "default"

$illumposition 17.271 -1.154 -16.696

// NEW MUZZLES USING OB PARTICLE SYSTEM
// How it works? - We changing old "event AE_MUZZLEFLASH" to new OB Thing "event AE_CL_CREATE_PARTICLE_EFFECT"
// "muzzle_smg1" - The Name Of Muzzle ( NOT .pcf file! the name of particle inside .pcf file )
// "follow_attachment" - moving to bone
// "ValveBiped.muzzle" - bone name, where particle dispatching


$sequence fire01 "Fire01" rotate -90 fps 30 snap activity ACT_VM_PRIMARYATTACK 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_smg1 follow_attachment ValveBiped.muzzle" }
$sequence fire02 "Fire02" rotate -90 snap fps 30 activity ACT_VM_RECOIL1 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_smg1 follow_attachment ValveBiped.muzzle" }
$sequence fire03 "Fire03" rotate -90 snap fps 30 activity ACT_VM_RECOIL2 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_smg1 follow_attachment ValveBiped.muzzle" }
$sequence fire04 "Fire04" rotate -90 snap fps 30 activity ACT_VM_RECOIL3 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_smg1 follow_attachment ValveBiped.muzzle" }

// TEH END OF NEW CODE

$sequence altfire "altfire" rotate -90 ACT_VM_SECONDARYATTACK 1 fps 30.00 node Fire
$sequence draw "draw" ACT_VM_DRAW 1 rotate -90 fps 30.00 node Ready
$sequence reload "reload" ACT_VM_RELOAD 1 rotate -90 fps 30.00 node Ready
$sequence dryfire "dryfire" ACT_VM_DRYFIRE 1 rotate -90 fps 30.00 node Fire
$sequence idletolow "idletolow" ACT_VM_LOWERED_TO_IDLE 1 rotate -90 fps 30.00 transition Ready Low
$sequence lowtoidle "lowtoidle" ACT_VM_IDLE_TO_LOWERED 1 rotate -90 fps 30.00 transition Low Ready
$sequence lowidle "lowidle" loop ACT_VM_IDLE_LOWERED 1 rotate -90 fps 30.00 node Low


Great thanks to you guyz =)

Re: Add a custom muzzle flash effect

PostPosted: Tue Sep 06, 2011 1:56 am
by cra0kalo
Code: Select all
    $sequence fire01 "Fire01" rotate -90 fps 30 snap activity ACT_VM_PRIMARYATTACK 1 node Fire { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_smg1 follow_attachment ValveBiped.muzzle" }



Hey guys can someone explain what the "rotate" and "snap" menas

:?

Re: Add a custom muzzle flash effect

PostPosted: Wed Sep 07, 2011 1:45 am
by Jangalomph
I'm no coder, but I'm gonna take a wild guess.
Rotate may tell the animation to rotate -90 degrees. It may be referring to the particle to make it work correctly.

Snap may mean stay on this node? or make sure it stays only on act_vm_primaryattack