Data Realms Fan Forums
http://45.55.195.193/

Eternal Gibs - How do I stop this?
http://45.55.195.193/viewtopic.php?f=1&t=17164
Page 1 of 1

Author:  Ameefmu [ Fri Nov 20, 2009 3:25 pm ]
Post subject:  Eternal Gibs - How do I stop this?

Hi there.
I'm sorry if this is posted in the wrong place, after half an hour of fruitless searching, I still haven't found the IRC channel details. I'd rather not use the built-in Java IRC client, but searches on the forums didn't turn up the details. Anyway!

I've recently gotten started on my modding, and I've been picking apart other peoples creations, and messing with the variables to see what does what. I grabbed Witty's Cancer Bomb, and changed it into an erratically moving 'bee' missile. The problem is the fact that it persists forever.
I was intending for large amounts of these to be launched from a flamethrower-type gun, yet since they never disappear, this is probably a silly idea.
I'll attach the script I'm using, If anyone has a few minute of spare time, I'd love for them to tell me what I'm doing wrong, and how I could go about making these lazer bees explode or disappear after a set amount of time, rather than buzzing around eternally.

http://pastebin.com/m7d4a3c9b

There's the link to the code I'm using.
I could attach all necessary files if you'd like, if anyone wants to see the lazer bees ingame, or if the code is not sufficient to fix the problem.
Thanks a lot :)

-Ameefmu

Author:  Samohan25 [ Fri Nov 20, 2009 4:53 pm ]
Post subject:  Re: Eternal Gibs - How do I stop this?

So they simply don't dissapear? If you havn't already make a prokimity check for the nearest actor and self:GibThis if within a certian range, I'm not sure if I have the right code but I think this is how it's done.

Author:  Abdul Alhazred [ Fri Nov 20, 2009 6:20 pm ]
Post subject:  Re: Eternal Gibs - How do I stop this?

If you place the code below in a .lua file and attach it to an object (AEmitter, MOSRotating but not MOPixel), it will gib after its Sharpness number of milliseconds.

Code:
function Create(self)
    self.Life = Timer()
   self.lifeTime = self.Sharpness
   self.Sharpness = 1
end

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

Author:  Darlos9D [ Fri Nov 20, 2009 7:16 pm ]
Post subject:  Re: Eternal Gibs - How do I stop this?

instead of setting up a life timer, you can just use self.Age.

Author:  Abdul Alhazred [ Fri Nov 20, 2009 7:43 pm ]
Post subject:  Re: Eternal Gibs - How do I stop this?

Darlos9D wrote:
instead of setting up a life timer, you can just use self.Age.


I thought so as well, but according to the API description Age is ms in real time not sim time. So if you use age the object will be gibbed sooner if the game laggs (assuming that the description is correct, witch I think it is but have not verified).

Author:  Grif [ Fri Nov 20, 2009 10:40 pm ]
Post subject:  Re: Eternal Gibs - How do I stop this?

Guys, if I'm reading it right, his problem isn't that it isn't gibbing, it's that it's recursively gibbing.

Whitty's cancer bomb (probably) does that, and the code will do that.

Author:  CaveCricket48 [ Fri Nov 20, 2009 11:30 pm ]
Post subject:  Re: Eternal Gibs - How do I stop this?

"SmokeThing22" is what's causing the recursive gibbing. Delete the emission in it that spawns "SmokeThing2".

Author:  Ameefmu [ Sat Nov 21, 2009 1:39 am ]
Post subject:  Re: Eternal Gibs - How do I stop this?

Thanks very much all!

For the sake of personal growth and learning, I'm going to attempt all of these. I should have recorded a GIF of the time I set the spawn count of Smoke Thing 22 to 5, which would (as far as I know) split the gib into 6 when it came into contact with ground. Of course, the same thing would happen to the other 5 that were just spawned...

Sorry if I didn't explain the problem perfectly. Pretty much what happens is that the bomb object would come down inside the craft, which would then open up and release 1-2 gibs for each object purchased. These would weave erratically around the map, and when colliding with scenery would sometimes split. Each one would last forever unless they exited the top or the bottom of the map. I was just looking for a way to cause them to die/explode/disappear on impact, rather than buzz around eternally.

Anyway! Thanks very much. Have lots of faith in this community now.

Author:  Geti [ Sat Nov 21, 2009 5:11 am ]
Post subject:  Re: Eternal Gibs - How do I stop this?

Darlos9D wrote:
instead of setting up a life timer, you can just use self.Age.
Never ever use self.Age = 0 on an object that gibs. it means infinite recursive gibbing, in my experience.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/