View unanswered posts | View active topics It is currently Fri Dec 27, 2024 7:55 am



Reply to topic  [ 6 posts ] 
 A gib timer for AEmitters acting as rounds? 
Author Message
User avatar

Joined: Sat Feb 12, 2011 8:05 pm
Posts: 39
Location: Somewhere over the Double Rainbow
Reply with quote
Post A gib timer for AEmitters acting as rounds?
I have a gun here, whose round type is an AEmitter, edited from the revolver cannon. I am satisfied with it, except for the fact that its slugs go on until their lifetime runs out, but they just disappear. I'm looking for a way to set it so the slugs gib when the lifetime runs out, rather than disappear. The round types are AEmitters. I've tried fooling around with the Impulse cannon things, but I'm familiar with neither Lua or TDExplosives. I'll give you the rte this is in if you need it for testing.
(TL;DR:Need a script for an AEmitter round that makes it gib into its designated gib things [stated in the round] after a certain amount of time)
Thanks for the help.


Attachments:
Ironwall.rte.zip [764.43 KiB]
Downloaded 163 times
Thu Jun 07, 2012 4:37 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: A gib timer for AEmitters acting as rounds?
Easy peasy;

Code:
function Create(self)
   self.lifeTimer = Timer();
   self.lifeTime = 400+math.random(-200,200)
end

function Update(self)
   if self.lifeTimer:IsPastSimMS(self.lifeTime) then self:GibThis();
   end
end


Replace the "400+math.random(-200,200)" with the desired lifetime of the AEmitter in milliseconds, say... 2000 or whatever. You'll probably want to set it slightly less than the actual .ini-specified LifeTime just to be on the safe side.

(There's probably a slightly more efficient way to set it by getting the lifetime from the ini itself somehow, but I'm not sure. self.LifeTime instead of self.lifeTime, maybe?)


Thu Jun 07, 2012 6:05 pm
Profile YIM
User avatar

Joined: Sat Feb 12, 2011 8:05 pm
Posts: 39
Location: Somewhere over the Double Rainbow
Reply with quote
Post Re: A gib timer for AEmitters acting as rounds?
It's completely fine, don't worry about it. Thanks so much :wink:


Thu Jun 07, 2012 6:54 pm
Profile
User avatar

Joined: Sat Feb 12, 2011 8:05 pm
Posts: 39
Location: Somewhere over the Double Rainbow
Reply with quote
Post Re: A gib timer for AEmitters acting as rounds?
I just had to change the math.random function to -1,1, because it wasn't working otherwise. Anyways, thanks so much. with it gibbing in the air, I can even kill my own teammates. c:


Thu Jun 07, 2012 7:26 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: A gib timer for AEmitters acting as rounds?
You didn't need to keep that part, you know. You could just use;

Code:
self.lifeTime = 2000;


Thu Jun 07, 2012 7:29 pm
Profile YIM
User avatar

Joined: Sat Feb 12, 2011 8:05 pm
Posts: 39
Location: Somewhere over the Double Rainbow
Reply with quote
Post Re: A gib timer for AEmitters acting as rounds?
Oh, okay. heheh. :oops:


Thu Jun 07, 2012 8:02 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 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.062s | 14 Queries | GZIP : Off ]