Data Realms Fan Forums
http://forums.datarealms.com/

Why is this crashing CC?
http://forums.datarealms.com/viewtopic.php?f=73&t=31477
Page 1 of 1

Author:  Technomancer [ Mon Jul 23, 2012 3:13 am ]
Post subject:  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?

Author:  Asklar [ Mon Jul 23, 2012 3:36 am ]
Post subject:  Re: Why is this crashing CC?

MovableMan:AddParticle(YourParticlePointer)


I suppose that should work.

Author:  Technomancer [ Mon Jul 23, 2012 3:39 am ]
Post subject:  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.

Author:  Roast Veg [ Mon Jul 23, 2012 1:46 pm ]
Post subject:  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.

Author:  xenoargh [ Mon Jul 23, 2012 4:07 pm ]
Post subject:  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 :-)

Author:  Technomancer [ Mon Jul 23, 2012 9:19 pm ]
Post subject:  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.

Author:  Roast Veg [ Mon Jul 23, 2012 9:24 pm ]
Post subject:  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

Author:  Technomancer [ Mon Jul 23, 2012 9:45 pm ]
Post subject:  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.

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