View unanswered posts | View active topics It is currently Thu Apr 27, 2017 12:00 pm



Reply to topic  [ 4 posts ] 
 Unknown Crash Cause 
Author Message

Joined: Mon Jul 11, 2016 5:06 am
Posts: 7
Reply with quote
Post 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.


Fri Jul 15, 2016 2:16 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 6998
Location: Here
Reply with quote
Post Re: Unknown Crash Cause
That's weird. Try

a.ToDelete = true;

instead of MovableMan:RemoveActor(a)


Fri Jul 15, 2016 2:40 am
Profile

Joined: Mon Jul 11, 2016 5:06 am
Posts: 7
Reply with quote
Post 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.


Fri Jul 15, 2016 3:48 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 610
Location: Halifax, Canada
Reply with quote
Post 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.


Fri Jul 15, 2016 10:52 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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.021s | 15 Queries | GZIP : Off ]