Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsJedi Knight and Mysteries of the Sith Editing Forum → Muzzle Flashes (and other templatey-type-things)
Muzzle Flashes (and other templatey-type-things)
2001-05-31, 10:43 AM #1
OK, I can manage to make a muzzle flash, only I cant position it to fire from the starting place of the gun, and I've tried orienting it differently and it just doesn't work.

Also, can you have more than one template loaded, eg. creatething=+one template+another template ?
http://jaggedconscience.serveftp.com/

Jagged Conscience
2001-05-31, 11:02 AM #2
I don't think you can merge templates like that. You might be able to spawn the 2 different templates in the same location.

------------------
"Sometimes nothing can be a real cool hand."
Have Lightsaber Will Travel
Have Lightsaber Will Travel JK Editing tips, troubleshooting information, resources and more.
www.swgalaxies.net For all your Star Wars Galaxies needs
The Massassi A SW Galaxies Player Association
2001-06-01, 9:34 AM #3
How do you get muzzle flashes? I got the template, the SPR, and told it to fire it in the gun cog. Nothing. WHY? Where can I get a tutorial?
2001-06-01, 11:03 PM #4
I suppose I'd better post what I have, it seems to work only it is offset to the left in external mode and to the right in internal (although not very noticable). OK, here's my stuff:

static.jkl:
Code:
##### Templates information ####
Section: TEMPLATES

World templates 100

#Name:           Based On:        Params:

_weapon           none               type=weapon collide=1 move=physics thingflags=0x20000000 timer=10.000000 mass=5.000000 physflags=0x200 maxrotvel=90.000000 damageclass=0x2 typeflags=0x1
_explosion        none               orient=(0.000000/0.000000/0.000000) type=explosion typeflags=0x1 damageclass=0x4
_particlething    none               orient=(0.000000/0.000000/0.000000) type=particle collide=2 timer=0.150000 typeflags=0x3f material=00gsmoke.mat range=0.010000 rate=30.000000 maxthrust=4.000000 elementsize=0.004000 count=20
+bloodcloud       _particlething     material=bloody.mat move=physics mass=5.000000 range=0.010000 count=100 rate=0 pitchrange=10 yawrange=10 vel=(0.000000/0.000000/-0.200000)
+muzzleflash      _particlething     orient=(0.000000/0.000000/0.000000) material=sparky.mat range=0.002500 rate=50
+muzzleflash2     _explosion         orient=(0.000000/0.000000/0.000000) thingflags=0x1 light=1.000000 timer=0.100000 sprite=muzzleflash.spr
+bullethole       _explosion         orient=(0.000000/0.000000/0.000000) thingflags=0x1 light=0.000000 timer=100.0000 sprite=bullethole.spr creatething=_particlething
+smflash          _explosion         thingflags=0x1 light=0.400000 timer=0.100000 typeflags=0x0
+laserhit         _explosion         thingflags=0x1 light=0.200000 timer=0.500000 sprite=fleshwound.spr soundclass=exp_laserhit.snd typeflags=0x33 blasttime=0.300000 maxlight=0.400000
+laserfleshhit    +laserhit          soundclass=exp_fleshy.snd
+bullet1          _weapon            orient=(0.000000/0.000000/0.000000) thingflags=0x20000001 light=0.400000 model3d=rpt0.3do size=0.001000 movesize=0.001000 mazrotvel=0.000000 vel=(0.000000/7.000000/0.000000) explode=+bullethole fleshhit=+bloodcloud damage=50.000000 mindamage=20.000000 typeflags=0x20440d rate=20.000000

end
################################

Not all of that is used, and that's obviously not the entire static.jkl.

weap_bryar.cog:

Code:
symbols

model       povModel=gunv.3do                   local
model       weaponMesh=gung.3do                 local

keyframe    mountAnim=bryvmnt.key               local
keyframe    dismountAnim=bryvdis.key            local
keyframe    povfireAnim=bryvpst1.key            local
keyframe    holsterAnim=kyhlstr.key             local

sound       outSound=pistout1.wav               local
sound       mountSound=df_bry_ready.wav         local
sound       dismountSound=PutWeaponAway01.wav   local
sound       fireSound=pistol-1.wav              local

template    projectile=+bullet1                 local
template    muzzleflash=+muzzleflash            local
template    muzzleflash2=+muzzleflash2          local

thing       player                              local
thing       victim                              local
thing       potential                           local

flex        dot                                 local
flex        maxDot                              local

flex        fireWait=0.6                        local
flex        holsterWait                         local
flex        fireDelay=0.4                       local
flex        powerBoost                          local
flex        autoAimFOV=30                       local
flex        autoAimMaxDist=5                    local

int         weaponIndex                         local
int         trackID=-1                          local
int         dummy=0                             local
int         dummy2=0                            local
int         dummy3=0                            local
int         view                                local
int         mode                                local
int         holsterTrack                        local

message     activated
message     deactivated
message     selected
message     deselected
message     autoselect
message     fire
message     timer

end

# ========================================================================================

code

fire:


   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0)
   {
      Return;
   }

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 11) < 1.0)
   {
      PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
      if(GetAutoSwitch() & 1)
         SelectWeapon(player, AutoSelectWeapon(player, 1));
      Return;
   }

   SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0);
   dummy = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
   dummy2 = FireProjectile(player, muzzleflash, -1, -1, '0.015 0.06 0.015', '0 0 0', 1.0, 0x1, -1, -1);
   dunny3 = FireProjectile(player, muzzleflash2, -1, -1, '0.015 0.06 0.015', '0 0 0', 1.0, 0x1, -1, -1);
   ChangeInv(player, 11, -1.0);
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   powerBoost = GetInv(player, 63);
   ChangeFireRate(player, fireWait/powerBoost);

   Return;

# ........................................................................................

activated:
   player = GetSourceRef();
   mode = GetSenderRef();

   jkSetWaggle(player, '0.0 0.0 0.0', 0);
   powerBoost = GetInv(player, 63);
   ActivateWeapon( player, fireWait/powerBoost, mode );
   Return;

# ........................................................................................

deactivated:
   player = GetSourceRef();
   mode = GetSenderRef();

   jkSetWaggle(player, '10.0 7.0 0.0', 350);
   DeactivateWeapon( player, mode );
   Return;

# ........................................................................................

selected:
   player = GetSourceRef();

   // Setup the meshes and models.
   jkSetPOVModel(player, povModel);
   jkSetWeaponMesh(player, weaponMesh);
   SetArmedMode(player, 1);

   // Play mounting sound.
   PlayMode(player, 41);
   PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);

   // Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
   // The animation is held at the last frame after it is played.
   trackID = jkPlayPOVKey(player, mountAnim, 0, 0x14);
   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   // Clear saber flags, and allow activation of the weapon
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 2);
   SetMountWait(player, GetKeyLen(mountAnim));

   Return;

# ........................................................................................

deselected:
   player = GetSourceRef();
   weaponIndex = GetSenderRef();
   
   PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
   jkPlayPOVKey(player, dismountAnim, 0, 0x18);
   
   holsterWait = GetKeyLen(holsterAnim);
   SetMountWait(player, holsterWait);
   holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
   SetTimerEx(holsterWait, 2, 0.0, 0.0);
   if (trackID != -1)
   {
      jkStopPOVKey(player, trackID, 0);
      trackID = -1;
   }
   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   Return;

# ........................................................................................

autoselect:
   player = GetSourceRef();

   // If the player has the weapon
   if(GetInv(player, 2) != 0.0)
   {
      // If the player has ammo
      if(GetInv(player, 11) != 0.0)
      {
         ReturnEx(500.0);
      }
      else
      {
         ReturnEx(-1.0);
      }
   }
   else
   {
      ReturnEx(-1.0);
   }

   Return;

# ........................................................................................

timer:
   StopKey(player, holsterTrack, 0.0);
   Return;

end

Phew, that was untiring.

Add those and gung.3do, gunv.3do and any other filenames you can spot in there (except fleshwound.spr, that should really be deleted), and remember, all sprites need a mat file to be added for them as well.

Any ideas on how to correct the offset?

BTW: Why does trailthing=template never work?
http://jaggedconscience.serveftp.com/

Jagged Conscience
2001-06-01, 11:07 PM #5
In case anybody was wondering, this is just a tester thing to get me used to editing static.jkl and stuff. It's a really bad model of a revolver, but I can post some screenies if you tell me where to upload them to.

Special thanks go to EvanC and GunBoy for their tutorials on weapons and templates.

[This message has been edited by halcyon (edited June 02, 2001).]
http://jaggedconscience.serveftp.com/

Jagged Conscience
2001-06-01, 11:47 PM #6
[http://www.massassi.net/ec/images/1286.jpg]
[http://www.massassi.net/ec/images/1287.jpg]
[http://www.massassi.net/ec/images/1288.jpg]
[http://www.massassi.net/ec/images/1289.jpg]

I'll probably post one in the showcase forum showing the blood it makes, but there we go.
http://jaggedconscience.serveftp.com/

Jagged Conscience
2001-06-02, 12:22 PM #7
I think the way that they did it in SS3 was they actually had different 3do's with and without the flash. Check it out.
2001-06-05, 2:16 AM #8
Any actual opinions on this? Good? Bad?
http://jaggedconscience.serveftp.com/

Jagged Conscience
2001-06-06, 6:28 AM #9
actually, I believe in SS3 the muzzle flash was a mesh of the gun, and when it was supposed to appear it was moved (instantly) to the front of the gun.. not too sure on the specifics
2001-06-07, 11:09 PM #10
Yep, that's pretty much how I made the flash appear.

The way the POV model's muzzle flash worked was by using a keyframe trick that made a node teleport instead of moving. The POV model had a single face mesh that had the muzzle flash texture and use attached to the weapon mesh of the weapon. It placed the mesh in the back of the gun (to keep out of sight) by making all the animations that weren't for firing (like the mounting, dismounting, and reloading animations) and made the muzzle flash appear in front of the gun during a gun fire animation and made the flash teleport behind the weapon after the key ran for one frame. To make a node teleport instead of moving, I just removed the differentials setting for the entry for the entries that caused the muzzle flash to move. I also used this method before for the clip reloads of the weapons.

For the external view. I made two external meshes for the weapon where one of them had the flash attach to it while the other gun does not have the flash on it. I then made it that when the player shot the gun, the external weapon mesh switches to the mesh with the muzzleflash and then used a timer to set it back to the non muzzleflash mesh after 0.05 seconds. I also made it set back to the non muzzleflash mesh whenever the player switched to another gun (deselected), when the player releases the fire button (deactivated) and when the player dies (killed) in case the timer isn't reached when these situtations occur (BTW, I used the killtimer cogverb too to make sure the timer isn't called when the above 3 occur). For the fast firing guns, I don't use a timer since that method will cause lag (forcing other players to update you weapon's muzzleflash every 0.05 is BAD) so I used a multi celled animation for the muzzleflash texture (cel 0 being the flash textures and cel 1 being a blank black image) and used the MaterialAnim cog verb to make the texture animate (setting the framerate for that texture to 10 works best). Then, when the gun begins to fire using the activated message, I made the gun use the muzzleflash mesh and then turned it back to the non muzzleflash mesh when the player stopped firing.

Well, that's basically how I did it. I really should write a tutorial for this effect but I never got around to it.

-- SavageX

------------------
"Everyone dies." - Boba Fett
"Be kind to nerds because one day... one will be your boss."
SavageX's Editing Corner
2001-06-08, 12:15 AM #11
Geez just do it the UJK way , attatch a thin sheet over the gun , have a mat file attatch to it. The default mat is a tranparent one , then when you fire , it changes to a muzzle flash and then changes back again after a timer has gone through.

↑ Up to the top!