View unanswered posts | View active topics It is currently Sat Dec 28, 2024 4:26 pm



Reply to topic  [ 8 posts ] 
 Creating a gun that shoots two bullets, but with a delay 
Author Message
Data Realms Elite
Data Realms Elite
User avatar

Joined: Mon Jul 12, 2010 5:39 am
Posts: 4558
Reply with quote
Post 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
Profile WWW
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post 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
Profile
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post Re: Creating a gun that shoots two bullets, but with a delay
Or just use an AEmitter.


Fri Oct 21, 2011 8:21 am
Profile
User avatar

Joined: Thu May 28, 2009 3:59 pm
Posts: 209
Reply with quote
Post 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
Profile
User avatar

Joined: Sat Nov 03, 2007 9:44 pm
Posts: 1916
Location: Flint Hills
Reply with quote
Post 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
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Mon Jul 12, 2010 5:39 am
Posts: 4558
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post 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
Profile
User avatar

Joined: Thu May 28, 2009 3:59 pm
Posts: 209
Reply with quote
Post 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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.044s | 13 Queries | GZIP : Off ]