- Quick Links -


Jedi Knight modifying site

Visitor No.72282
Since July 1999

Theme :

Massassi Temple MILLENNIUM
LucasArts Entertainment Company

- Random Picture -

Lightstaff 2.0 MotS

Lightstaff 2.0 MotS

Forum Projects Documents Features Extra Links
How to make a body piercing projectile

DOWNLOAD


1

Body piercing projectile is like a bullet that goes through a body. So if you shoot people in a line, they all go down.

In Jedi Knight, all the projectiles disappear by leaving some kind of explosion template when it hits something. So in order to keep what was there, there needed to be some kind of workaround.


2

The workaround I came across to use is to reproduce the same projectile when it gets destroyed. So it will look as it went through anything in its way. The logic is very simple and the cog is also simple to make.


3

First, you will create a cog that is related to the projectile that you want it to be piercing. (That is you assign cog=proj_pierce.cog and add thingflags=0x400[change value if already existing] of the template in static.jkl)

You will add "touched" message as that will be the trigger to create a new projectile on disappearing. "Removed" may also work as projectiles gets "removed" when it "touches" something.

In order to create the new projectile of the same template from where it disappeared you will be surprised how easy it is to do.

You will do this.

   victim = GetSourceRef();
   bullet = GetSenderRef();

   dir = GetThingLVec(bullet);

   vec = VectorScale(VectorSub(GetThingPos(victim), GetThingPos(bullet)), -1);
   bullet = FireProjectile(victim, GetThingTemplate(bullet), -1, -1, vec, '0 0 0', 0, 0, 0, 0);

   SetThingVel(bullet, VectorScale(dir, 10));
   SetThingLook(bullet, dir);

This will create the same projectile from the disappearing projectile at a position a little ahead of the disappearing projectile. The reason is if you create the projectile at just where it left, it will hit the same thing forever giving instant kill for anything.

So a little space to create it behind is necessary. But not too far behind to miss a few things one behind another.

"SetThingPos" can move things outside the world geometry to cause troubles while "FireProjectile" is smart enough to create it within. So don't go combo with "CreateThing" and "SetThingPos".


4

I think this explained all, it's simple but when done, looks cool =)


Resources

proj_pierce.cog


Forum Projects Documents Features Extra Links

Top - Home - Back

PHP Apache Valid XHTML 1.0! Valid CSS!

This site is developed using PHP under Apache server
with XHTML, JavaScript, CSS and Cookie technology.

Certain parts of this site require Cookie support.

This site is best viewed with Internet Explorer 5.5, Netscape 6.0, Opera 6.0 or Mozilla 1.0 and above
at resolution 800 * 600 and higher.

Nothing on this site is made, distributed, or supported by LEC.
Please use and download all materials at your own risk.

© 1999-2004 Hideki.

This page was last modified on Sat, 30 Jul 2011 17:28:41 +0000.