Any way to make powerful bullets that don't destroy terrain?
Author
Message
deepthought
Joined: Thu Feb 16, 2012 4:04 am Posts: 2
Any way to make powerful bullets that don't destroy terrain?
Hello there, I've been a lurker around here for awhile but now I want to start modding. I'm thinking of making some kind of sniper rifle strong enough to pierce through multiple people, but the gun only results in bullets that poke deep holes in concrete. Is there any way to give a bullet good penetration against people but not terrain?
Thu Feb 16, 2012 4:31 am
Pantera1993
Joined: Wed Jul 06, 2011 5:11 pm Posts: 226
Re: Any way to make powerful bullets that don't destroy terrain?
You can increase the mass of the round, while reducing sharpness to reduce terrain rape, but this can cause the actor to be pushed back when the weapon is fired. A good way to avoid the push effect is the have the weapon fire an emitter which then fires the particle of choice. See the Coalition Heavy Sniper rifle for an idea on how to do this.
Fri Feb 17, 2012 6:21 pm
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
Re: Any way to make powerful bullets that don't destroy terrain?
I once did a rifle that fired an emitter, which it spawned a particle which had a mass of 5000 kg and a very, very low sharpness; it would pierce like 10 or 20 pixels of sand but it would crush through infinite enemies if enough space was given.
I'll see if I have it around and send it to you, you might find it useful.
Fri Feb 17, 2012 7:13 pm
p3lb0x
Forum Moderator
Joined: Fri Feb 02, 2007 3:53 pm Posts: 1896 Location: in my little gay bunker
Re: Any way to make powerful bullets that don't destroy terrain?
Alternatively, increase the sharpness if an actor is in front of the bullet with lua
Fri Feb 17, 2012 7:36 pm
Pantera1993
Joined: Wed Jul 06, 2011 5:11 pm Posts: 226
Re: Any way to make powerful bullets that don't destroy terrain?
p3lb0x wrote:
Alternatively, increase the sharpness if an actor is in front of the bullet with lua
That is a very cool idea.
Sat Feb 18, 2012 6:34 am
ryry1237
Joined: Sun Dec 25, 2011 7:23 am Posts: 269
Re: Any way to make powerful bullets that don't destroy terrain?
What would the lua code be for sharpening said bullet and then unsharpening them?
Sat Feb 18, 2012 7:47 am
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
Re: Any way to make powerful bullets that don't destroy terrain?
Here's what I do for lesser terrain damage: Start with regular sharpness, check for terrain in front of the bullet with a strength ray every update with a vector that's one third of the bullet's velocity, and switch to low sharpness if there is terrain there.
Code:
function Create(self) self.weakened = 1 end function Update(self) if self.weakened == 1 then local terrcheck = Vector(0,0); if SceneMan:CastStrengthRay(self.Pos,(self.Vel / 3),0,terrcheck,0,0,true) then self.Sharpness = self.Sharpness / 2 self.weakened = 2 end end end
Instead of dividing by two, you could divide by a higher number for even less barrier penetration, or just set sharpness to 0 to not penetrate even grass.
Now that I think about it, though, this would lessen sharpness if the target had terrain very close behind it, or if the target was a door. It also doesn't nerf the bullet if you've got the muzzle pointing straight into the ground, because the bullet's already done some penetrating before the update function ever happens. So this is a far from ideal method.
This should be way better; still uses the initial sharpness at very first, though.
Code:
function Create(self) self.inaccuracy = 0 -- raise to reduce lag but decrease detection quality self.InitialSharpness = self.Sharpness --store original sharpness value self.TerrainModifier = 0.5 -- multiply the original sharpness by this for terrain penetration self.ObjectModifier = 1 --multiply the original sharpness by this for object penetration end
function Update(self) local terrcheck = Vector(0,0); if SceneMan:CastMORay(self.Pos,(self.Vel / 3),0,0,true, self.inaccuracy) == 255 then self.Sharpness = self.InitialSharpness * self.TerrainModifier else self.Sharpness = self.InitialSharpness * self.ObjectModifier end end
Sat Feb 18, 2012 4:15 pm
DudeAbides
Joined: Thu Jan 13, 2011 1:31 pm Posts: 158
Re: Any way to make powerful bullets that don't destroy terrain?
Slick script, Azukki
Mon Feb 27, 2012 2:37 am
Dex98
Joined: Thu Jan 05, 2012 8:18 am Posts: 76 Location: In a Sauna, roasting to death
Re: Any way to make powerful bullets that don't destroy terrain?
Code:
function Update(self)
local terrcheck = Vector(0,0); if SceneMan:CastStrengthRay(self.Pos,Vector(self.Vel.X,self.Vel.Y):SetMagnitude(16),0,terrcheck,0,0,true) then self.ToDelete = true; end
end
This Should work. It's from a mod called Decimator i found somewhere
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum