| Author | 
            Message | 
        
        
			| 
				
				 Mind 
				
				
					 Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
				 
				 
			 | 
			
				
				  TimeScale  
					
						Okay, trying to slow down time under conditions, but it won't work.  Just using this as an example, when an actor gets within 200 pixels, i want the timescale to be 0.1 of what it normally is, but it's not working.  Here's the code. Code: function Create(self)    self.TimeModifier = 0.1 end
 
 
  function Update(self)    for actor in MovableMan.Actors do       local avgx = actor.Pos.X - self.Pos.X;       local avgy = actor.Pos.Y - self.Pos.Y;       local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);       if dist < 200 then          TimerMan.TimeScale = self.TimeModifier       end    end end Appreciate any help!    
					
  
			 | 
		
		
			| Sun Jul 19, 2009 9:28 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Kyred 
				
				
					 Joined: Sun May 31, 2009 1:04 am Posts: 308
				 
				 
			 | 
			
				
				  Re: TimeScale  
					
						If you read what I said before here, ignore it.  Cuz it was dumb.
  Really, your script should work =/ 
					
							
  
							
    							Last edited by Kyred on Mon Jul 20, 2009 3:45 am, edited 1 time in total. 
    						 
						
  
			 | 
		
		
			| Mon Jul 20, 2009 3:38 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Mind 
				
				
					 Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
				 
				 
			 | 
			
				
				  Re: TimeScale  
					
						Kyred, I so appreciate your help, but Grif helped me to figure out the problem I was having is that if an aemitter gibs an aemitter, lua in null on it.  (pretty sure on that now)  But thanks so much for finding that out!  I hope to use that in the future    
					
  
			 | 
		
		
			| Mon Jul 20, 2009 3:44 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Kyred 
				
				
					 Joined: Sun May 31, 2009 1:04 am Posts: 308
				 
				 
			 | 
			
				
				  Re: TimeScale  
					
						Ah, okay.  Lol, I re-read what I posted and noticed that what I said didn't make logical since.  For some reason, I thought TimerMan.TimeScale was being set to 1 every instance of the loop.  But yeah, 'break' is useful. 
					
  
			 | 
		
		
			| Mon Jul 20, 2009 3:47 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: TimeScale  
					
						A break and a toggle would be nice on the default homing script so that it doesn't home in on multiple actors at once. 
					
  
			 | 
		
		
			| Mon Jul 20, 2009 3:50 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: TimeScale  
					
						It doesn't need one.  The loop only runs when it is trying to find an actor to home in on.  Once an actor is selected, it will keep going after it until the actor no longer exists, at which point it finds a different actor. 
					
  
			 | 
		
		
			| Mon Jul 20, 2009 4:50 am | 
			
				
					 
					
					 
				    
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: TimeScale  
					
						Hmm? The current one will home in, for example, between two actors if both are within range. 
					
  
			 | 
		
		
			| Mon Jul 20, 2009 6:13 am | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Mind 
				
				
					 Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
				 
				 
			 | 
			
				
				  Re: TimeScale  
					
						Just variables, so i wont make a new topic.... (lol) I'm trying to make q 0.16 for 5 seconds, then make it randomly 0.09 or -0.09 after those 5 seconds.  Problem is, q is 0.16 even after the 5 seconds.  Any help? Code:    q = 0.16    if self.timerH:IsPastRealMS(5000) then       q = math.random(1,2)       if q == 1 then          q = 0.09       elseif q == 2 then          q = -0.09       end    end Timer is right i know.  
					
  
			 | 
		
		
			| Mon Jul 20, 2009 6:42 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
			| 
				
				 Grif 
				REAL AMERICAN HERO 
				
					 Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
				 
				 
			 | 
			
				
				  Re: TimeScale  
					
						IsPastRealMS(5000) == true then 
					
  
			 | 
		
		
			| Mon Jul 20, 2009 7:26 pm | 
			
				
					 
					
					 
				  
			 | 
    	
		
	
	
		  | 
	
	
	
		 |