| Author | 
            Message | 
        
        
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Unknown crash reason.  
					
						Alright, me and CC48 have been at it but can't seem to get this to work. It crashes before it gives any errors but were guessing its somewhere based on switching control back to the user. I can't tell you what the script's purpose is. Don't want to show anyone right now, not till intial release. Heres the code Thanks. Also if it gives any motivation, whoever manages to find out gets a sneak at it. Code: function Create(self)           self.gopen = false    self.gotweap = false;    self.gotactor = false;
     self.gOffset = Vector(-0, -75);    self.vectx = Vector(10,0)    self.vectxx = Vector(-10,0)    self.vecty = Vector(0,10)    self.vectyy = Vector(0,-10)         self.frone = "YOU CAN'T KNOW WHAT THIS IS YET";     self.frtwo = "YOU CAN'T KNOW WHAT THIS IS YET";     self.frthree = "YOU CAN'T KNOW WHAT THIS IS YET";     self.alone = "YOU CAN'T KNOW WHAT THIS IS YET";     self.altwo = "YOU CAN'T KNOW WHAT THIS IS YET";     self.althree = "YOU CAN'T KNOW WHAT THIS IS YET";     self.htone = "YOU CAN'T KNOW WHAT THIS IS YET";     self.httwo = "YOU CAN'T KNOW WHAT THIS IS YET";     self.htthree = "YOU CAN'T KNOW WHAT THIS IS YET";
      self.mainweaponclass = "YOU CAN'T KNOW WHAT THIS IS YET";
     self.c = CreateActor("YOU CAN'T KNOW WHAT THIS IS YET");
     print("YOU CAN'T KNOW WHAT THIS IS YET")       for weapon = 1,MovableMan:GetMOIDCount()-1 do         self.gun = MovableMan:GetMOFromID(weapon);       if self.gotweap == false then          if self.gun.PresetName == self.frone or self.gun.PresetName == self.frtwo or self.gun.PresetName == self.frthree or self.gun.PresetName == self.alone or self.gun.PresetName == self.altwo or self.gun.PresetName == self.althree or self.gun.PresetName == self.HTone or self.gun.PresetName == self.HTtwo or self.gun.PresetName == self.HTthree then             if self.gun.ClassName == self.mainweaponclass then                self.gotweap = true                self.parentgun = ToHDFirearm(self.gun)             else                self.gotweap = false                self.ToDelete = true             end          else             self.ToDelete = true          end       end    end end
      function Update(self)    self.actor = MovableMan:GetMOFromID(self.parentgun.RootID);    if MovableMan:IsActor(self.actor) and self.actor.Team == 0 and self.actor.PresetName ~= "YOU CAN'T KNOW WHAT THIS IS YET" then       self.user = ToActor(self.actor)       self.angle = ToActor(self.user):GetAimAngle(true);       self.control = self.user:GetController().Player       self.gotactor = true    end    for particle in MovableMan.Particles do       if particle.PresetName == self.PresetName then          self.ToDelete = false          self.ToSettle = false          self.PinStrength = 1000       end    end    if UInputMan:KeyPressed(7) then       if self.gopen == false then          if self.user:IsPlayerControlled() and self.gotactor == true then             self.gopen = true             self.g = CreateAEmitter("YOU CAN'T KNOW WHAT THIS IS YET")             MovableMan:AddParticle(self.g);             self.g.Pos = self.user.Pos + self.gOffset             self.g.ToDelete = false             self.g.ToSettle = false             self.g.PinStrength = 1000             if MovableMan:IsActor(self.c) == false then                self.c.Pos = self.g.Pos;                self.c.Team = 0                MovableMan:AddActor(self.c);             end             ActivityMan:GetActivity():SwitchToActor(self.c,self.control,-1);          end   
        -- I BELEIVE IT CRASHES SOMEWHERE FROM HERE.
        else          ActivityMan:GetActivity():SwitchToActor(self.user,self.control,self.user.Team)          self.g.ToDelete = true          self.c.ToDelete = true             self.gopen = false       end
        -- TO HERE, MAYBE IM WRONG THOUGH.
     end    if self.c:IsPlayerControlled() then       self.leftright = 0;       self.updown = 0;       self.cMovement = UInputMan:GetMouseMovement(0);       if UInputMan:KeyHeld(1) then          self.leftright = -1;       elseif UInputMan:KeyHeld(4) then          self.leftright = 1;       end                      if UInputMan:KeyHeld(23) then          self.updown = -1;       elseif UInputMan:KeyHeld(19) then          self.updown = 1;       end                   self.keymove = Vector(self.leftright * 2, self.updown * 2);       self.desiredPos = self.c.Pos + self.cMovement + self.keymove       self.c.Pos = self.desiredPos;       if self.c.Pos.X < self.vectx.X and self.c.Pos.X > self.vectxx.X and self.c.Pos.Y < self.vecty.Y and self.c.Pos.Y > self.vectyy.Y then          print("In Range")       end    end    if self.parentgun.ToDelete == true or self.parentgun == nil then       self.ToDelete = true       self.gotweap = false    end end
  function Destroy(self)    print("YOU CAN'T KNOW WHAT THIS IS YET") end  
					
							
  
							
    							Last edited by Coops on Wed Oct 27, 2010 10:43 pm, edited 1 time in total. 
    						 
						
  
			 | 
		
		
			| Wed Oct 27, 2010 10:20 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Petethegoat 
				
				
					 Joined: Mon Jun 15, 2009 4:02 pm Posts: 905
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						It would be helpful if you actually said what the error was. 
					
  
			 | 
		
		
			| Wed Oct 27, 2010 10:36 pm | 
			
				
					 
					
					 
				    
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						It crashes before it gives any errors. 
					
  
			 | 
		
		
			| Wed Oct 27, 2010 10:40 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						It seems to be focused around getting rid of self.c and swicthing control to self.user 
					
  
			 | 
		
		
			| Wed Oct 27, 2010 10:52 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Roast Veg 
				Data Realms Elite 
				
					 Joined: Tue May 25, 2010 8:27 pm Posts: 4522 Location: Constant motion
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						Coops9753 wrote: self.htone = "YOU CAN'T KNOW WHAT THIS IS YET";     self.httwo = "YOU CAN'T KNOW WHAT THIS IS YET";     self.htthree = "YOU CAN'T KNOW WHAT THIS IS YET";
  -snip-
  if self.gun.PresetName == self.frone or self.gun.PresetName == self.frtwo or self.gun.PresetName == self.frthree or self.gun.PresetName == self.alone or self.gun.PresetName == self.altwo or self.gun.PresetName == self.althree or self.gun.PresetName == self.HTone or self.gun.PresetName == self.HTtwo or self.gun.PresetName == self.HTthree then[/code] Probably not your crash, but I think it's an error you should fix.  
					
  
			 | 
		
		
			| Wed Oct 27, 2010 10:56 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 TheLastBanana 
				DRL Developer 
				
					 Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						CC has issues with switching actors. If, for any reason, it switches the same user's control more than once in a single frame, it'll crash. 
					
  
			 | 
		
		
			| Wed Oct 27, 2010 11:40 pm | 
			
				
					 
					
					 
				    
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						How do I avoid this properly then? 
					
  
			 | 
		
		
			| Wed Oct 27, 2010 11:54 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 TheLastBanana 
				DRL Developer 
				
					 Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						Well, judging by the code, I have to assume you've got multiple instances of the script running. Have a check that makes sure it hasn't switched it once already. 
					
  
			 | 
		
		
			| Thu Oct 28, 2010 12:03 am | 
			
				
					 
					
					 
				    
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						Only one instance of the script is running at once and this doesnt seem to work either, this is what I added Code:    if self.user:IsPlayerControlled() == false and self.g.ToDelete == true then       self.c.ToDelete = true       ActivityMan:GetActivity():SwitchToActor(self.user,self.control,0);    end
   
					
  
			 | 
		
		
			| Thu Oct 28, 2010 12:31 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 TheLastBanana 
				DRL Developer 
				
					 Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						Have you tried removing the switching altogether? 
					
  
			 | 
		
		
			| Thu Oct 28, 2010 12:36 am | 
			
				
					 
					
					 
				    
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						Yes, no crashes.. It has to do with switching with the actors, If i comment out the switch back to the user and keep the self.c.ToDelete then it still crashes so maybe it has something to do with ownership?
  EDIT: I think I know whats going on, its fine when it switches to self.user aslong as self.c doesnt die or lose control at the same time. 
					
  
			 | 
		
		
			| Thu Oct 28, 2010 12:46 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Coops 
				
				
					 Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
				 
				 
			 | 
			
				
				  Re: Unknown crash reason.  
					
						Got it..
  it seems it didn't like self.control and liked the number 0 more. 
					
  
			 | 
		
		
			| Fri Oct 29, 2010 1:36 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
	
		 |