View unanswered posts | View active topics It is currently Thu Mar 28, 2024 8:40 am



Reply to topic  [ 8 posts ] 
 Why is this crashing CC? 
Author Message
User avatar

Joined: Sat Jul 31, 2010 10:01 pm
Posts: 42
Reply with quote
Post Why is this crashing CC?
I have a gun that fires MOPixels. These MOPixels have a script on them that replaces them with AEmitters after a while, and deletes the MOPixel.
However, when I fire the gun, even just a few shots, the game inevitably crashes after several seconds.
The game crashes even faster if more of them (~25) go off at around the same time. The gun works fine without the script.

Can anyone tell me what I'm doing wrong here?

Code:
function Create(self)
   self.detTimer = Timer()
end

function Update(self)
   if self.detTimer:IsPastSimMS(1750) then
      local det = CreateAEmitter("Ground Flames");
      det.Pos = self.Pos;
      det.Vel = Vector(0,0);
      det.RotAngle = 1;
      self.ToDelete = true;
      SceneMan:AddSceneObject(det);
      det = null;
   end
end


Thanks.


Turns out SceneMan:AddSceneObject has a crash bug associated with it. Does anybody know the appropriate Add command for an AEmitter through MovableMan?


Mon Jul 23, 2012 3:13 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Why is this crashing CC?
MovableMan:AddParticle(YourParticlePointer)


I suppose that should work.


Mon Jul 23, 2012 3:36 am
Profile
User avatar

Joined: Sat Jul 31, 2010 10:01 pm
Posts: 42
Reply with quote
Post Re: Why is this crashing CC?
Brilliant, thanks! That works perfectly. Tried looking in the Luadocs on the wiki but the Add functions aren't listed there.


Mon Jul 23, 2012 3:39 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Why is this crashing CC?
I didn't know addsceneobject existed at all... if it works properly when used in the right circumstances, maybe our portable bases are more of a possibility.


Mon Jul 23, 2012 1:46 pm
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Why is this crashing CC?
AddSceneObject() probably cannot be used for anything that's a Particle or Emitter. You're right, that's certainly worth experimenting with; time for some "bunker kits" if it's finally possible :-)


Mon Jul 23, 2012 4:07 pm
Profile
User avatar

Joined: Sat Jul 31, 2010 10:01 pm
Posts: 42
Reply with quote
Post Re: Why is this crashing CC?
MovableObject is a child of SceneObject, and so all MOs therefore follow up and are SceneObjects. Using AddSceneObject does add Particles/Emitters when run in the game, supposedly it also works with TerrainObjects as well. But I did a search for AddSceneObject and found a topic from 3 years ago mentioning that using it causes a crash, regardless of what you use it for. I think this is still the case.

Link.

Would be nice if this got a fix though. Wonder if Data knows about it.


Mon Jul 23, 2012 9:19 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Why is this crashing CC?
So why did you need us to answer your question when you could have searched for it and got your answer anyway? :P


Mon Jul 23, 2012 9:24 pm
Profile
User avatar

Joined: Sat Jul 31, 2010 10:01 pm
Posts: 42
Reply with quote
Post Re: Why is this crashing CC?
I had searched before, but evidently searched for the wrong thing. And then when I found out that AddSceneObject didn't work, I did a search for the Movable Object alternative (on the forums and the wiki), but again, evidently searched for the wrong thing, and couldn't find anything until Asklar suggested AddParticle. That search result linked above was when I grayed/strikethroughed my original post and appended my new question at the bottom.


Mon Jul 23, 2012 9:45 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.205s | 15 Queries | GZIP : Off ]