View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:27 am



Reply to topic  [ 8 posts ] 
 Freeze Time script does nothing. 
Author Message

Joined: Sat Jan 13, 2007 11:04 pm
Posts: 2932
Reply with quote
Post Freeze Time script does nothing.
numgun wrote:
I'm requesting a script that would allow the player to freeze time during a match, but still be able to look around and issue AI modes to his units. Would this be possible? As an example, if you have played Mass Effect, you can freeze the time and select your powers, order commands for your squad mates or change weapons during that time. This would work similar except you can only look around in observation mode, switch between units and assign AI modes for them, order stuff from space, but nothing else as the time is frozen.

Alternatively(if above is impossible) I'm requesting a slow-motion toggle script that slows time to 1/4 of normal timescale when Z button is pressed. When Z is pressed again, time would return to normal.


I guess these scripts can be bound to the brain or something, but the point is that they can be used anytime during the game.


Then Geti came up with this quick untested script:

Code:
function Create(self)
   self.isSlowed = false --switch var
end

function Update(self)
   if self:GetController():IsState(26) and not self.isSlowed then
      --NOTE: slowmo is bound to "Z"
      TimerMan.TimeScale = TimerMan.TimeScale / 100;
      TimerMan.DeltaTimeSecs = TimerMan.DeltaTimeSecs / 100;
      --if this works (untested) it should prevent the game from getting VERY choppy, and instead make everything beautifully slow.
      self.isSlowed = true;
   end
   if self:GetController():IsState(3) and self.isSlowed then
      --unslowmo is bound to "C"
      TimerMan.TimeScale = TimerMan.TimeScale * 100;
      TimerMan.DeltaTimeSecs = TimerMan.DeltaTimeSecs * 100;
      self.isSlowed = false;
   end
end


I put the script on the braincase and made it so when the player presses "Left", time should slow down and "Right" to restore it. However this script does nothing and then theres the issue that I dont know how to make it work more globally so it can be used anytime and anywhere by pressing Z for example. What do?


Sun Jun 27, 2010 6:15 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Freeze Time script does nothing.
According to the comments, "self:GetController():IsState(<number>)" should be "UInputMan:KeyPressed(<number>)".


Sun Jun 27, 2010 7:16 pm
Profile

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Freeze Time script does nothing.
You can't do a "Get Controller state" on a Brain case because it is an actor with no limbs,
therefore it can't be moving left or right it it won't return that is is moving left or right.

You can apply it to a Crab with invisible legs though. And change 26 to "Controller.MOVE_RIGHT" or "Controller.MOVE_LEFT".

But if you just want it to be bound to Z globally then CaveCricket has it spot on.


Also, I just tested your slow mo stuff by using the console and it DOES work beautifully slow, just like old CC. Thanks for that little tip.

EDIT: I think it modified my CC permanently... make sure you undo the modification afterward.


Mon Jun 28, 2010 6:06 am
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Freeze Time script does nothing.
wait, what, zalo?

I use plain Actors as controllers for stuff all the time

they work fine


Mon Jun 28, 2010 6:14 am
Profile

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Freeze Time script does nothing.
I remember dealing with this situation when I made the plasma zombie.
I had an actor and I needed to read whether it was moving left or right
or not and it wouldn't output what I needed so I tried it as a crab and it worked.
Maybe you're doing something differently than I am.


Also, putting the slowmo code into the console modified my Settings.ini so be careful.


Mon Jun 28, 2010 6:30 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Freeze Time script does nothing.
Oh yeah, the deltatime thing will write to settings.ini, forgot to say that O_o;
Sorry about the gimped controller stuff before.
Will globally bind Z to slowmo and unslowmo. I'm tired, expect ridiculous comments and semi-functionality. If worst comes to worst and it's broken, I'm sure daman will jump on the opportunity to correct me.
Code:
function Create(self)
   self.isSlowed = false; --switch var
   self.hitkey = false; --woo repeat functionality
end

function Update(self)
   if UInputMan:KeyPressed(26) and not self.hitkey then
      --NOTE: this is bound to "Z" (or should be)
      if self.isSlowed then --and then mother earth was like "sloooooooooooooooooooow doooooowwwwn"
         TimerMan.TimeScale = TimerMan.TimeScale / 100;
         --this makes everything beautifully slow. (cheers for the test zalo)
         TimerMan.DeltaTimeSecs = TimerMan.DeltaTimeSecs / 100;
         self.isSlowed = true;
      else
         --and then you'll be like "♥♥♥♥ you!" and kick her in the face with your energy legs
         --this, uh, speeds it back up. *cough*
         TimerMan.TimeScale = TimerMan.TimeScale * 100;
         TimerMan.DeltaTimeSecs = TimerMan.DeltaTimeSecs * 100;
         self.isSlowed = false;
      end
      self.hitkey = true; --prevent recursion (danger will robinson?)
   else
      self.hitkey = false; --put the key back so we can hit that button (so hard) again!
   end
end

--[[MASSIVELY IMPORTANT NOTE! GAME BREAKING IS POSSIBLE
   THIS DOESN'T UNSET ITSELF WHEN THE GAME IS PAUSED AND QUIT AND BECAUSE
   IT CHANGES YOUR DELTATIME IN SETTINGS THAT CAN KILL THINGS FOREVER!
   -> WE'LL NEED SOME KIND OF "WHEN SCENEMAN IS PAUSED" HOOK TO STOP THAT
   -> WE'LL NEED MORE HOOKS WHAT THE HELL IS HARD ABOUT THAT KIND OF THING YOU'LL NEED TO HAVE INTERNAL HANDLING FOR IT ANYWAY?]]--
done? also please send that last note to data, minus the yelling for a better result. Being able to detect when any MO was created/destroyed would be nice too. not to mention working bitmaps etc.

Also, if this is going to be first party content the community would appreciate a mention. Regardless of weather it's the right time and place to say it:
All in all, it'd be nice if Dan would give the community some recognition for the (fiery) support we give, and all the constructive criticism we provide. He gets pretty thorough testing each build, and I'd actually assert that a large percentage of the attraction of CC comes from the new content produced by us each <unit time>. The ability to do so is obviously provided by Dan himself (massive thanks) but our content output keeps the game fresh, especially in the half finished state it's in. A mention of DRLFF in the credits would be nice, or even just, you know, "my supporters". It'd be nice to get a mention.
As a sidenote, the fact that he was considering wiping the forums at some point is concerning. I know some of us are less than constructive at times, and there's been quite a bit of trolling and flaming in the past, but honestly, that's no reason to literally destroy the community behind your game. We're what's keeping CC alive between builds, and that kind of disregard is frustrating. But this isn't really the time to do this rant I suppose, I'm far too tired..

Small for spacewaste.

In other news, if you haven't in the past when you were ♥♥♥♥ around with settings.ini, blow up a rocket/dropship in slow motion, that ♥♥♥♥ is cash.

Confirmation that the above works would be lovely.


Mon Jun 28, 2010 10:48 am
Profile WWW

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Freeze Time script does nothing.
If add some stuff and put it into a scene, then it is much harder to break the game because you CAN undo it when you pause.

What a coincidence, I'm making a scene right now... you wouldn't mind if I snatched a snippet here, would you?


Mon Jun 28, 2010 6:08 pm
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Freeze Time script does nothing.
zalo wrote:
you wouldn't mind if I snatched a snippet here, would you?
Not at all. That's probably a good way of going about it, integrating it into the skirmish script.

Numgun, would it be possible to request the use of GAScripted skirmishes? or a way of attaching an override script to GABasedefense?


Tue Jun 29, 2010 12:32 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 8 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.106s | 13 Queries | GZIP : Off ]