- Quick Links - |
Visitor No.72282 |
- Random Picture - | ||||||
|
How to make a body piercing projectile
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.
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.
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".
I think this explained all, it's simple but when done, looks cool =)
|
This site is developed using PHP under Apache server 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 |