Jump to content


Photo

How to make Gun flash


  • Please log in to reply
2 replies to this topic

#1 primaveranz

primaveranz

    Master Director

  • Pioneers
  • 5409 posts
  • Gender:Male

Posted 19 October 2011 - 09:21 PM

I have created a variant of the Shotgun and am trying to add the Shotgun Muzzle Flash mesh. However, whereas in the Shotgun template that mesh is invisible in MW and only appears when the gun is fired, when I add it to my new template and add the appropriate material references and set all the same properties e.g. Smooth transparency, two-sided etc., it is visible in the Modders Workshop and appears as a fixed appendage to the gun in Moviestorm. When the gun fires the screen flashes erratically.
If I remove the "flash" mesh the gun works fine but no flash appears when the gun is fired.

What am I missing? And can I make a completely new gun which is not a variant of an existing MS one and still give it a muzzle flash?

"If we only use 1/3 of our brain, what's the other 1/3 for?"


#2 Ben_S

Ben_S

    Master Director

  • Mods
  • 4811 posts

Posted 20 October 2011 - 09:49 AM

The thing that you cannot set in the modders workshop is the alpha in the colour. If you open your new template up in a text editor, then you should see a bit something like this (which is from the shotgun):
CODE
    <material>
      <name>MuzzleFlash_Side_01 [8]</name>
      <ambientColor>0.5859375 0.5859375 0.5859375 0.0</ambientColor>
      <diffuseColor>0.5859375 0.5859375 0.5859375 0.0</diffuseColor>
      <emissiveColor>1 1 1 0.0</emissiveColor>
      <specularColor>0.0 0.0 0.0 1.0</specularColor>
      <shininess>0.0</shininess>
      <maps>
        <entry>
          <string>emissiveMap</string>
          <string>Textures/Flash_01.dds</string>
        </entry>
        <entry>
          <string>diffuseMap</string>
          <string>Textures/Flash_01.dds</string>
        </entry>
      </maps>
      <flags>
        <string>ALPHA_BLEND</string>
        <string>TWO_SIDED</string>
        <string>USE_MATERIAL_COLOURS</string>
        <string>DONT_CAST_SHADOWS</string>
        <string>DONT_SHOW_SHADOWS</string>
      </flags>
      <parameters/>
    </material>
    <material>
      <name>MuzzleFlash_Front_01 [9]</name>
      <ambientColor>0.5859375 0.5859375 0.5859375 0.0</ambientColor>
      <diffuseColor>0.5859375 0.5859375 0.5859375 0.0</diffuseColor>
      <emissiveColor>0.7607843 0.7607843 0.7607843 0.0</emissiveColor>
      <specularColor>0.0 0.0 0.0 1.0</specularColor>
      <shininess>0.0</shininess>
      <maps>
        <entry>
          <string>emissiveMap</string>
          <string>Textures/Flash_Front_01.dds</string>
        </entry>
        <entry>
          <string>diffuseMap</string>
          <string>Textures/Flash_Front_01.dds</string>
        </entry>
      </maps>
      <flags>
        <string>ALPHA_BLEND</string>
        <string>TWO_SIDED</string>
        <string>USE_MATERIAL_COLOURS</string>
        <string>DONT_CAST_SHADOWS</string>
        <string>DONT_SHOW_SHADOWS</string>
      </flags>
      <parameters/>
    </material>


Note the colours in the shotgun end with 0.0 in the alpha, where as the ones in your template end with 1.0 in the alpha. You need to change your ones to 0.0, then when you get to the fire animation, the code changes the two materials 8 and 9 (the material names may also be important) so that they are no longer transparent.
You might be better just copying this section from the shotgun into your props template.


QUOTE
And can I make a completely new gun which is not a variant of an existing MS one and still give it a muzzle flash?

Yes, but you would need to be able to make held prop animations, both for the prop and the character. The 'fire' animation uses a different class of transition (there is a dropdown when setting up the animation).

Ben Sanders
Moviestorm Ltd

#3 primaveranz

primaveranz

    Master Director

  • Pioneers
  • 5409 posts
  • Gender:Male

Posted 21 October 2011 - 02:26 AM

That fixed it Ben. Thanks!

"If we only use 1/3 of our brain, what's the other 1/3 for?"



  • Please log in to reply


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users