Data Realms Fan Forums
http://45.55.195.193/

TimeScale
http://45.55.195.193/viewtopic.php?f=73&t=15930
Page 1 of 1

Author:  Mind [ Sun Jul 19, 2009 9:28 pm ]
Post subject:  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! :)

Author:  Kyred [ Mon Jul 20, 2009 3:38 am ]
Post subject:  Re: TimeScale

If you read what I said before here, ignore it. Cuz it was dumb.

Really, your script should work =/

Author:  Mind [ Mon Jul 20, 2009 3:44 am ]
Post subject:  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 :)

Author:  Kyred [ Mon Jul 20, 2009 3:47 am ]
Post subject:  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.

Author:  Grif [ Mon Jul 20, 2009 3:50 am ]
Post subject:  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.

Author:  TheLastBanana [ Mon Jul 20, 2009 4:50 am ]
Post subject:  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.

Author:  Grif [ Mon Jul 20, 2009 6:13 am ]
Post subject:  Re: TimeScale

Hmm? The current one will home in, for example, between two actors if both are within range.

Author:  Mind [ Mon Jul 20, 2009 6:42 pm ]
Post subject:  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.

Author:  Grif [ Mon Jul 20, 2009 7:26 pm ]
Post subject:  Re: TimeScale

IsPastRealMS(5000) == true then

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