Author |
Message |
Dex98
Joined: Thu Jan 05, 2012 8:18 am Posts: 76 Location: In a Sauna, roasting to death
|
Explosive bullets
I`m planning on doing a sniper rifle with some explosive bullets. (Part of a weapons pack i have been making) Does anybody know how to make the bullets explode If someone would know a piece of LUA code that could help and would be so kind to post it here, that would help alot! Sincerely: a LUA noob
|
Thu Jan 12, 2012 7:55 pm |
|
|
LordVonKain
Joined: Sat Oct 22, 2011 4:49 am Posts: 826 Location: England
|
Re: Explosive bullets
i suggest you check the Warhammer pack since the bolter's there have explosives rounds although personally i don't see how practical would a sniper with Bolt rounds could be. That said this is cortex command, where practicality isn't used much.
|
Thu Jan 12, 2012 7:59 pm |
|
|
Mehman
Joined: Tue Nov 17, 2009 7:38 pm Posts: 909 Location: France
|
Re: Explosive bullets
Attaching this script to an MOPixel will make it explosive: Code: function Create(self) self.Vel = self.Vel.Normalized*math.random(110,114); --adjust velocity here self.Sharpness = 50; end
function Update(self) local ray = SceneMan:CastObstacleRay(self.Pos , self.Vel*1.05*TimerMan.DeltaTimeSecs*FrameMan.PPM , Vector() , Vector() , self.ID , 0 , 1); if ray > 0 or self.ToDelete == true then local lr = CreateAEmitter("Bullet Explosive"); lr.Pos = self.Pos+((self.Vel/125)*ray); lr.Vel = Vector(0,0); MovableMan:AddMO(lr); lr:GibThis(); self.ToDelete = true; end end
In order to work you must define an AEmitter called "Bullet Explosive"(without quotes) that gibs into the explosion.
|
Thu Jan 12, 2012 8:04 pm |
|
|
Dex98
Joined: Thu Jan 05, 2012 8:18 am Posts: 76 Location: In a Sauna, roasting to death
|
Re: Explosive bullets
LordVonKain wrote: i suggest you check the Warhammer pack since the bolter's there have explosives rounds although personally i don't see how practical would a sniper with Bolt rounds could be. That said this is cortex command, where practicality isn't used much. Just testing if making the bullet emit a tiny explosion, would increase the damage without raping terrain. Oh and thanks for the tip.
|
Thu Jan 12, 2012 8:16 pm |
|
|
Dex98
Joined: Thu Jan 05, 2012 8:18 am Posts: 76 Location: In a Sauna, roasting to death
|
Re: Explosive bullets
Mehman wrote: In order to work you must define an AEmitter called "Bullet Explosive"(without quotes) that gibs into the explosion. And how do you do that isn`t it annoying when you know everything else about making a mod and then you find out you dont realize a thing that is probably the most simple thing in the world?
|
Thu Jan 12, 2012 9:22 pm |
|
|
Mehman
Joined: Tue Nov 17, 2009 7:38 pm Posts: 909 Location: France
|
Re: Explosive bullets
Dex98 wrote: And how do you do that Do you know how to creates things using .ini files?(yes that basic modding stuff) If so then just create the explosion effect(just an emitter that gibs into pixels, glows and other effects, like a small grenade) as you would any other object, if not then read a tutorial or two, it's very simple.
|
Thu Jan 12, 2012 9:34 pm |
|
|
Dex98
Joined: Thu Jan 05, 2012 8:18 am Posts: 76 Location: In a Sauna, roasting to death
|
Re: Explosive bullets
Mehman wrote: Dex98 wrote: And how do you do that Do you know how to creates things using .ini files?(yes that basic modding stuff) If so then just create the explosion effect(just an emitter that gibs into pixels, glows and other effects, like a small grenade) as you would any other object, if not then read a tutorial or two, it's very simple. Ok thanks. It`s working now Planning on releasing the mod soon...
|
Fri Jan 13, 2012 7:01 am |
|
|
ryry1237
Joined: Sun Dec 25, 2011 7:23 am Posts: 269
|
Re: Explosive bullets
I thought you don't need Lua to make bullets explode and all you had to do was just set the GibImpulseLimit = (any number less than 20) and attach a few AddGib stuff to it.
|
Fri Jan 13, 2012 7:35 am |
|
|
Xery
Joined: Sat Feb 26, 2011 10:29 am Posts: 163
|
Re: Explosive bullets
ryry1237 wrote: I thought you don't need Lua to make bullets explode and all you had to do was just set the GibImpulseLimit = (any number less than 20) and attach a few AddGib stuff to it. MOPixel has no gibs. You can use other kinds of MOs, but they don't have tails like that. Well, in the WWM mod, there's a sniper using one aemitter and one mopixel to acheve it without lua.
|
Fri Jan 13, 2012 2:32 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Explosive bullets
What's wrong with an old-fashioned TDExplosive?
|
Fri Jan 13, 2012 2:38 pm |
|
|
ryry1237
Joined: Sun Dec 25, 2011 7:23 am Posts: 269
|
Re: Explosive bullets
Gotcha! wrote: What's wrong with an old-fashioned TDExplosive? You can't make explosives explode from exploding explosives via timer by just altering the .ini files. Although that shouldn't matter for this thread unless Dex98 wants to make a shotgun that shoots exploding bullets that explode based on time. Xery wrote: MOPixel has no gibs. You can use other kinds of MOs, but they don't have tails like that. Well, in the WWM mod, there's a sniper using one aemitter and one mopixel to acheve it without lua. Did he attach the aemitter to the MOPixel or the MOPixel to the aemitter?
|
Fri Jan 13, 2012 3:37 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Explosive bullets
@ryry1237: What are you talking about? We're talking about a gun bullet here. Make it a TDExplosive and he has what he wants.
|
Fri Jan 13, 2012 4:54 pm |
|
|
Mehman
Joined: Tue Nov 17, 2009 7:38 pm Posts: 909 Location: France
|
Re: Explosive bullets
Gotcha! wrote: We're talking about a gun bullet here. Make it a TDExplosive and he has what he wants. Yes but TDExplosives don't have trails, so I think MOPixels look better for tiny explosives such as bullets, but it's a matter of taste.
|
Fri Jan 13, 2012 6:41 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Explosive bullets
Another way you could use Lua to make exploding bullets is to just check the magnitude of the bullet's velocity, instead of casting rays. It's a lot more efficient if you have a lot of bullets at the same time, and as long as your bullet has zero sharpness, zero bounce, and maximum friction, works pretty well in my experience.
|
Sat Jan 14, 2012 5:22 am |
|
|
Amazigh
Data Realms Elite
Joined: Sun Feb 24, 2008 2:10 am Posts: 1531 Location: Ye Olde England
|
Re: Explosive bullets
The sniper in this mod has exploding bullets with NO Lua at all. It's a slightly old mod, but it should still work in the current build. Might need a couple reference changes but nothing major. Just posting to prove that you don't need to use Lua for everything when simple ini coding will give the same result.
|
Sat Jan 14, 2012 3:00 pm |
|
|
|