View unanswered posts | View active topics It is currently Thu Dec 26, 2024 6:05 pm



Reply to topic  [ 9 posts ] 
 TimeScale 
Author Message
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post 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
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post 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
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post 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
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: TimeScale
IsPastRealMS(5000) == true then


Mon Jul 20, 2009 7:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.063s | 13 Queries | GZIP : Off ]