UPDATE, still need help spawning ACrab, need lua help.   
	
        
        
            | Author | 
            Message | 
         
        
			| 
				
				 Foogooman 
				
				
					 Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
				 
				 
			 | 
			
				
				  Re: Problem involving teams when spawning an ACrab via emitter  
					
						Geti wrote: try replacing "Create" with "Update" if no console errors are happening i didnt make a silly typo somewhere, so the script probably isnt getting run. that and also: are you sure you're firing the right particle, it seems you have 3.. No that didn't work either... I can't seem to get the script to run at all. Any other reason it might not be running? All the names I put in are correct, it's applied to the correct MOSParticle being fired from the gun... I don't think it's a silly mistake with the names, so I don't know.  
					
  
			 | 
		 
		
			| Sun Aug 23, 2009 7:19 pm | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Geti 
				
				
					 Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
				 
				 
			 | 
			
				
				  Re: Problem involving teams when spawning an ACrab via emitter  
					
						are you totally sure the MOSP is being fired? also, is there any more code than what you've posted to the MOSP (use pastebin). a tiny lifetime could be screwing with it.. you could just use a copy of a blood drop MOPixel with the script attached, for example, and see if that works. 
					
  
			 | 
		 
		
			| Sun Aug 23, 2009 9:43 pm | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Foogooman 
				
				
					 Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
				 
				 
			 | 
			
				
				  Re: Problem involving teams when spawning an ACrab via emitter  
					
						Geti wrote: are you totally sure the MOSP is being fired? also, is there any more code than what you've posted to the MOSP (use pastebin). a tiny lifetime could be screwing with it.. you could just use a copy of a blood drop MOPixel with the script attached, for example, and see if that works. I'm sure it's being fired, I gave it a large sprite which comes from the gun when fired, and no I'm not using any code on it in addition to what you've provided. It has a 350 lifetime. I tested it with a copy of the blood drop MOPixel with the script attatched like you recommended and when I fire the gun, a drop of blood comes out and that's it. I just used a different script to see if it was my fault or the script's fault for not working. I applied the "swamer" script from luaguns, and it worked on my weapon. The drop of blood was heat seeking the nearest enemy. So, definitely a problem with the script.  
					
							
  
							
    							Last edited by Foogooman on Mon Aug 24, 2009 5:53 am, edited 1 time in total. 
    						 
						
  
			 | 
		 
		
			| Sun Aug 23, 2009 9:53 pm | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Geti 
				
				
					 Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						is anything happening in the console? also; try adding   to the start of the script (inside the function), and then check the console. if it prints anything, the script is working, if not, you arent attaching scripts correctly. to define a copyof, you need to add a new presetname (just in case you arent)  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 5:52 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Foogooman 
				
				
					 Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						Geti wrote: is anything happening in the console? also; try adding   to the start of the script (inside the function), and then check the console. if it prints anything, the script is working, if not, you arent attaching scripts correctly. to define a copyof, you need to add a new presetname (just in case you arent) I got a console error, fetching it now, don't go anywhere. Code: ERROR: CoalitionPunisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:10: ')' expected (to close '(' at line 8) near 'for'  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 5:55 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Geti 
				
				
					 Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						im writing an essay at the moment, not planning on leaving the computer for a least 30 min or so. hold on, posting fix <_< i knew id make a typo. 
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 5:58 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Geti 
				
				
					 Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						http://pastebin.com/m6d258792enjoy. i just ♥♥♥♥ up the box definition big time, missed the last bracket.  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 6:02 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Foogooman 
				
				
					 Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						Still not working :/ Code: SYSTEM: Scene "Grasslands" was loaded ERROR: Could not find the requested Scene Area named: LZ Team 1 ERROR: Could not find the requested Scene Area named: Landing Zone ERROR: Could not find the requested Scene Area named: LZ Team 2 ERROR: Could not find the requested Scene Area named: Landing Zone SYSTEM: Activity "Skirmish Defense" was successfully started ERROR: ...Punisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:17: attempt to index field 'parent' (a nil value) ERROR: ...Punisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:17: attempt to index field 'parent' (a nil value) ERROR: ...Punisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:17: attempt to index field 'parent' (a nil value) ERROR: ...Punisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:17: attempt to index field 'parent' (a nil value) ERROR: ...Punisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:17: attempt to index field 'parent' (a nil value)  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 6:05 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						http://pastebin.com/m1eaf1c4dGame's probably complaining about self.Pos not being a good enough vector reference, it needs a straight up named vector.  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 6:18 am | 
			
				
					 
					
					 
				  
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Foogooman 
				
				
					 Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						Grif wrote: http://pastebin.com/m1eaf1c4d
  Game's probably complaining about self.Pos not being a good enough vector reference, it needs a straight up named vector. I get this error when using that script: Code: ERROR: ...Punisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:17: attempt to index field 'parent' (a nil value)  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 6:23 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 6:30 am | 
			
				
					 
					
					 
				  
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Foogooman 
				
				
					 Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						Grif wrote: http://pastebin.com/m541c2d82 You just moved the error up a line   Code: ERROR: ...Punisher.rte\Devices\Weapons\DroneLauncher\Drone.lua:18: attempt to index field 'parent' (a nil value) It's just a problem with the function you guys are using to define the team. "self.parent.Team" doesn't seem to be a valid function. I can replace it with "0" and it spawns a crab on my team just fine, but I DO want it to work for green team too.  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 6:32 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 mail2345 
				
				
					 Joined: Tue Nov 06, 2007 6:58 am Posts: 2054
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						No, the problem is that the parent isn't in the box. 
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 7:16 am | 
			
				
					 
					
					 
				  
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Foogooman 
				
				
					 Joined: Sat Nov 18, 2006 8:11 pm Posts: 267
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						mail2345 wrote: No, the problem is that the parent isn't in the box. mail2345 to save the day! Well I'm terrible with lua, but here is my attempt: Code: function Create(self)         --create the crab         local crab = CreateACrab("Drone 2", "CoalitionPunisher.rte")         --position it         crab.Pos = self.Pos;         --create a box for finding who shot us.         local box = Box(Vector(self.Pos.X - 40,self.Pos.Y - 40),Vector(self.Pos.X + 40, self.Pos.Y + 40));         --look at all the actors on the scene         for actor in MovableMan.Actors do                 --if they are within the box                 if box:WithinBox(actor.Pos) == true then                         -- they are our parent! assign this                         self.parent = actor;                   break;                 end         end
          --make the crab the same team as our parent    local box = Box(Vector(self.Pos.X - 41,self.Pos.Y - 41),Vector(self.Pos.X + 41, self.Pos.Y + 41));    for actor in MovableMan.Actors do    if box:WithinBox(actor.Pos) == true then    crab.Team = self.parent.Team;         --give it the same velocity as the particle that spawned it         crab.Vel = self.Vel;         --add it to the game         MovableMan:AddActor(crab);         --delete ourself.         self.ToDelete = true; end end end Don't get any console errors, but it doesn't work :/ Not surprised, I don't really know what I'm doing.  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 7:21 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
			| 
				
				 Geti 
				
				
					 Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
				 
				 
			 | 
			
				
				  Re: UPDATE, still need help spawning ACrab, need lua help.  
					
						http://pastebin.com/m6c13c465just made the box bigger, added an if to check if the parent existed or not, and loved the addition of grif's break. edit: missed a comment.  
					
  
			 | 
		 
		
			| Mon Aug 24, 2009 9:42 am | 
			
				
					 
					
					 
				    
			 | 
    	
		 
	
	
		  | 
	 
	
	
		 | 
	 
	
	 
	
	
 
	 
	
	
		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
  | 
 
 
 
 
	 |