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

Unknown Crash Cause
http://forums.datarealms.com/viewtopic.php?f=73&t=46070
Page 1 of 1

Author:  Osek [ Fri Jul 15, 2016 2:16 am ]
Post subject:  Unknown Crash Cause

Hello CC modding community, I'm messing around with making an Activity and I could really use your help with a problem. I'm trying to remove all actors who might already be present on the scene except for doors. When I load this in on a map with a lot of actors and doors (like Dummy Assault) the game just crashes. It doesn't seem to matter if they are actors or emplacements.

Code:
function Deathmatch:StartActivity()

   for a in MovableMan.AddedActors do
   
      if a.ClassName ~= "ADoor" then
         
         MovableMan:RemoveActor(a)
         
      end   
   
   end
   
end


I commented out all other code, the UpdateActivity() function is completely empty and it still crashes on this. What boggles my mind is that if I remove the ClassName check and just remove all actors indiscriminately it works fine. And the problem isn't that the only thing present on the scene are doors because I also had code that adds in some actors for both teams within the StartActivity() method (it's removed now for bugtesting sake). Windows Event Viewer says the exception code is 0xc000000d meaning "An invalid parameter was passed to a service or function."

Furthermore:
If I edit Dummy Assault and remove just all the doors and try it, works.
If I edit it and remove just all the emplacements + brain and try it, works.
Leave both in and it crashes, WTF??

If I move this code to UpdateActivity() instead it crashes as well, just takes a second longer.

I need this because the idea is to allow people to play on any single map they want, but the way the Activity is going to work only a few actors should be on a team at any time and they must be shipped in.

Thank you in advance for any advice on this.

Author:  CaveCricket48 [ Fri Jul 15, 2016 2:40 am ]
Post subject:  Re: Unknown Crash Cause

That's weird. Try

a.ToDelete = true;

instead of MovableMan:RemoveActor(a)

Author:  Osek [ Fri Jul 15, 2016 3:48 am ]
Post subject:  Re: Unknown Crash Cause

Ah, that seems to work. Thanks! It's still rather odd and worrying but as long as this crash won't rear its ugly head again I'm happy with it.

Author:  Bad Boy [ Fri Jul 15, 2016 10:52 pm ]
Post subject:  Re: Unknown Crash Cause

I recall MovableMan:RemoveActor() being a buggy mess so that's probably the issue. Stick with ToDelete = true (or GibThis() if you want squishy bits). Good luck with the activity.

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