Data Realms Fan Forums
http://forums.datarealms.com/

Seemingly Easy and Useful request
http://forums.datarealms.com/viewtopic.php?f=75&t=46034
Page 1 of 1

Author:  Birdsie [ Tue Feb 09, 2016 3:55 pm ]
Post subject:  Seemingly Easy and Useful request

I am not a coder, so I am not sure if this IS easy, but I think it might be.

Anyway, back to the point.

What I want is that time in-game stops when the player opens the BUY menu.
It'd be useful, because one would be able to choose what he wants to buy without having to stress out over the AI landing
it's troops just next to your brain.

That's all, thank you for reading this.

Author:  4zK [ Tue Feb 09, 2016 8:28 pm ]
Post subject:  Re: Seemingly Easy and Useful request

I read on the wiki that there is a pause function for the ActivityManager. Alas, upon testing it, it appeared to work just as desired (freezing all MOs but allowing player controls such as switching between actors and using the buy menu), but I noticed that all MOs still retained their spent LifeTime, which caused them to dissapear/gib/do whatever they were coded to do in X amount of time.

I really liked your idea, but I can't think of any means to properly achieve it as of now, unless you don't mind your game being broken.

I suggest that you turn down the difficulty setting or something if you feel like you're being overpowered by the AI. Remember also to save your deliveries as presets so that you can quickly re-order them.

Author:  Bad Boy [ Wed Feb 10, 2016 3:57 am ]
Post subject:  Re: Seemingly Easy and Useful request

4zK wrote:
I read on the wiki that there is a pause function for the ActivityManager. Alas, upon testing it, it appeared to work just as desired (freezing all MOs but allowing player controls such as switching between actors and using the buy menu), but I noticed that all MOs still retained their spent LifeTime, which caused them to dissapear/gib/do whatever they were coded to do in X amount of time.
Why not put it in a global script or whatever and just have it track everything's age when it's activated, then reset everything's age each frame until the effect is stopped?

Author:  4zK [ Wed Feb 10, 2016 7:48 pm ]
Post subject:  Re: Seemingly Easy and Useful request

That could work, but you'd still need a way to pause lua-based timers, as they are affected too.

Author:  Bad Boy [ Wed Feb 10, 2016 11:32 pm ]
Post subject:  Re: Seemingly Easy and Useful request

Hmm, that might be trickier. TimerMan has a function PauseSim that might do it without issues, but I don't know since I've never tried it.

If that doesn't work, there may be some collection of all timers (like MovableMan.Actors) you can iterate through (maybe TimerMan.Timers?). Unfortunately the timer class doesn't seem to have a pause or stop function, but you can probably fake it by saving every timer's ElapsedSimTimeMS and doing one of two things with it depending on whether or not ElapsedSimTimeMS is readonly:
1. If ElapsedSimTimeMS is not readonly you can just reset it to the saved value every frame
2. If it is readonly, you'd have to do things a little more convolutedly by setting the timer's StartSimTimeMS to the saved elapsed time, then calling Reset() on the timer every frame until the game is unpaused. After it's unpaused you'd also want to reset the timer's StartSimTimeMS (so you'd have to save that too, though you could just save the ones that don't have a start time of zero) so it doesn't screw up timers that don't start at zero.

I think that would solve your issue.

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