Author |
Message |
Miggles
Data Realms Elite
Joined: Mon Jul 12, 2010 5:39 am Posts: 4558
|
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?
|
Fri Oct 21, 2011 5:45 am |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
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
|
Fri Oct 21, 2011 6:54 am |
|
|
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
Re: Creating a gun that shoots two bullets, but with a delay
Or just use an AEmitter.
|
Fri Oct 21, 2011 8:21 am |
|
|
Asatruer
Joined: Thu May 28, 2009 3:59 pm Posts: 209
|
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.
|
Fri Oct 21, 2011 5:55 pm |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
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.
|
Fri Oct 21, 2011 11:18 pm |
|
|
Miggles
Data Realms Elite
Joined: Mon Jul 12, 2010 5:39 am Posts: 4558
|
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.
|
Sat Oct 22, 2011 7:25 am |
|
|
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
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.
|
Sat Oct 22, 2011 11:06 am |
|
|
Asatruer
Joined: Thu May 28, 2009 3:59 pm Posts: 209
|
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".
|
Sat Oct 22, 2011 4:57 pm |
|
|
|