Page 1 of 1

Muzzle Flash tricks

PostPosted: Tue Aug 22, 06 2:17 pm
by clyzm
There's lots of confusion about how to make muzzle flashes in DX modelling. I'll show you the easiest way.

-First you have to make a flat panel in the tip of your weapon's 3rd and First person models. It has to be considerably medium-sized.
-Then, move that muzzle flash group to the third group number (Unreal would recognize this as the 2nd group.)
-Then, entire this line of code in your texture area for 1st person import:

Code: Select all
#exec MESHMAP SETTEXTURE MESHMAP=famas1 NUM=0 TEXTURE=WeaponHandsTex
#exec MESHMAP SETTEXTURE MESHMAP=famas1 NUM=1 TEXTURE=WeaponHandsTex
#exec MESHMAP SETTEXTURE MESHMAP=famas1 NUM=2 TEXTURE=BlackMaskTex
#exec MESHMAP SETTEXTURE MESHMAP=famas1 NUM=3 TEXTURE=FamasTex1
#exec MESHMAP SETTEXTURE MESHMAP=famas1 NUM=4 TEXTURE=FamasTex1
#exec MESHMAP SETTEXTURE MESHMAP=famas1 NUM=5 TEXTURE=WeaponHandsTex


Note: I used 6 groups, you must have at least 3 groups to make the muzzle flash. Also, that is just an example of texturing I used from my FAMAS; you would replace all of those textures with the names of your textures. Anyways, notice how the NUM=2 is BlackMaskTex? That's gonna be the muzzle flash.

Now, add this below your mesh mapping:

Code: Select all
#exec MESH NOTIFY MESH=famas1 SEQ=Shoot   TIME=0.01   FUNCTION=SwapMuzzleFlashTexture


This notifies Unreal to swap a different muzzle flash texture at SEQ=Shoot, with a time of 0.01. You could add multiple lines of these if you want. By the way, FAMAS is the example here; in real importing, you would replace that with the name of your model.

OPTIONAL: If you have a fire animation that requires the muzzle flash to close during a certain period of time (for example, a shotgun = then pump anim), enter this strip of code below:

Code: Select all
#exec MESH NOTIFY MESH=famas1 SEQ=Shoot   TIME=0.01   FUNCTION=EraseMuzzleFlashTexture


NOTE: 0.01 is NOT an appropriate time, but it makes the muzzle flash disappear after 1 millisecond. You could set it to however you want.

Now, you can open up your _d files (both 3rd person & 1st) in UnrealFX and select the material group "2" faces. Hit "EDIT" and select Transparent & 2 Sided, then Unlit. Hit OK, then save them.

OPTIONAL: Maybe perhaps you want your own custom muzzle flashes instead of boring ol' DX ones?

Alright, first of all, import them using either a textureimport.uc or something else. Then enter this strip of coding into either your 1st person mesh or your WEAPON.UC mesh (I dunno which?)

Code: Select all
simulated function SwapMuzzleFlashTexture()
{
   if (!bHasMuzzleFlash)
      return;
   if (FRand() < 0.5)
      MultiSkins[2] = Texture'CustomMuzzleFlash1';
   else
      MultiSkins[2] = Texture'CustomMuzzleFlash2';

   MuzzleFlashLight();
   SetTimer(0.1, False);
}


Where 'CustomMuzzleFlash1' and 'CustomMuzzleFlash2' represent the names of your custom muzzle flashes.

Alright, that concludes it for now, happy muzzle flashing!

Re: Muzzle Flash Tricks

PostPosted: Tue Aug 22, 06 5:29 pm
by MainMan
In my prime (in my old-skool maps) I once overwrote the MuzzleFlashLight(); function to spawn some exploding stuff. Good times.