|
FAQ
• Search • Login
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Author |
Message |
Djinn
Joined: Sun Oct 29, 2006 4:26 am Posts: 298
|
Recursive Rockets
Hey all, been a while, trying to get a hang of this Lua stuff gradually by reverse engineering neat stuff, but I figured I's start with something simple enough.
Essentially, what I'm trying to do is have a Rocket fire out TDExplosives that gib (or explodes after timer, if the engine supports that now) into more of those rockets. That's the core of what I want to do, but I have additional ideas that I'm unsure how to implement: Ideally, each of these TDExplosives should have a semi-random chance of gibbing into the base rocket. Also, if possible, I want to make sure the rockets spawn facing up regardless of the manner their spawning TDE landed, though if there's a strategy for this that works without Lua that would also be nice.
As always, thanks for your help, and I'm very impressed with everything the community has managed to create.
|
Thu Feb 11, 2010 11:58 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Recursive Rockets
function Create(self) self.lifetimer = Timer(); end
function Update(self) if self.lifetimer:IsPastSimMS(5000) == true then local chance = math.random(1,4) if chance == 1 then local acrocket = CreateACRocket("Presetname","RTE") acrocket.Pos = self.Pos; acrocket.Vel = Vector(0,0); acrocket.RotAngle = 0; MovableMan:AddActor(acrocket) end end end
Script for TDE's that'd cover what you need.
|
Fri Feb 12, 2010 12:18 am |
|
|
Djinn
Joined: Sun Oct 29, 2006 4:26 am Posts: 298
|
Re: Recursive Rockets
Thank you once again good sir.
For the reference of others, I inserted a 'self:GibThis();' after 'local chance = math.random(1,1)', because otherwise it made unlimited copies and did crazy ♥♥♥♥. As it stands, the code just makes the one copy after 5000ms. Next I'll try to modify it using altitude so that they won't pop before touching the ground.
|
Fri Feb 12, 2010 1:42 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Recursive Rockets
Add self.lifetimer:Reset(); after the if chance == 1 line. Pretty sure Grif just accidentally forgot it, cuz with it, it has a 1 in 4 chance of gibbing into "another rocket" like u said. So yea.
Edit: so what else do you want it to do?
|
Fri Feb 12, 2010 1:53 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Recursive Rockets
there's no need to reset it if it gibs regardless of hitting the chance or not
he wanted 1/4 tde's to explode into an acrocket, and with the modification I told him to make, that's what happens
|
Fri Feb 12, 2010 4:33 am |
|
|
|
|
Page 1 of 1
|
[ 5 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
|
|