Data Realms Fan Forums http://45.55.195.193/ |
|
Creating a gun that shoots two bullets, but with a delay http://45.55.195.193/viewtopic.php?f=1&t=25937 |
Page 1 of 1 |
Author: | Miggles [ Fri Oct 21, 2011 5:45 am ] |
Post subject: | Creating a gun that shoots two bullets, but with a delay |
Essentially what I want is a script that shoots one bullet, and then shoots the next only a small while after, perhaps a tenth of a second. How would I do this? |
Author: | Duh102 [ Fri Oct 21, 2011 6:54 am ] |
Post subject: | Re: Creating a gun that shoots two bullets, but with a delay |
Would you want the second bullet to have a different heading and location than the first? To say track the gun? If so, that'd be more complicated. But if you're ok with the second bullet coming out of nowhere, then you could simply do the following: Code: function Create(self) self.oldPos = Vector(self.Pos.X, self.Pos.Y); self.oldVel = Vector(self.Vel.X, self.Vel.Y); self.timer = new Timer(); end function Update(self) if self.timer:IsPastSimMS(10000) then local particle = CreateMOPixel("YourParticleHere"); particle.Pos = self.oldPos; particle.Vel = self.oldVel; MovableMan:AddParticle(particle); end end |
Author: | Major [ Fri Oct 21, 2011 8:21 am ] |
Post subject: | Re: Creating a gun that shoots two bullets, but with a delay |
Or just use an AEmitter. |
Author: | Asatruer [ Fri Oct 21, 2011 5:55 pm ] |
Post subject: | Re: Creating a gun that shoots two bullets, but with a delay |
Or if you are talking about a standard 2-round burst fire mode, you could just borrow the code from Coalition.rte/Devices/Weapons/Burst.lua and tailor it to your needs. |
Author: | Azukki [ Fri Oct 21, 2011 11:18 pm ] |
Post subject: | Re: Creating a gun that shoots two bullets, but with a delay |
Do you want the second shot to be unavoidable? If so, you could take a look at the script for the Lightning assault rifle in Shadow Echelon, and try suiting that to your purposes, by taking out the other features and the full auto mode, and adjusting the RPMs. |
Author: | Miggles [ Sat Oct 22, 2011 7:25 am ] |
Post subject: | Re: Creating a gun that shoots two bullets, but with a delay |
What I was thinking was that the gun took the casing and ejected it at high velocity at the enemy, coming from a separate muzzle. If by unavoidable you mean that the gun always fires two bullets, then yes, because it wouldn't be a fire mode. |
Author: | Major [ Sat Oct 22, 2011 11:06 am ] |
Post subject: | Re: Creating a gun that shoots two bullets, but with a delay |
Unfortunately the casing eject angle is unchangeable and ejects at exactly the same time as the bullet is fired. |
Author: | Asatruer [ Sat Oct 22, 2011 4:57 pm ] |
Post subject: | Re: Creating a gun that shoots two bullets, but with a delay |
But you could just make a null Shell so nothing is ejected, and just make a fake one that is "ejected" in the style you are describing. Getting it to come out of a second muzzle (I presume you mean under the first) I am pretty sure has been done before, but I cannot recall where. Just one idea about how to do that is maybe an attachment that, through lua, detects when the gun fires and then also "fires". |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |