Bobadubub 1 Posted April 15, 2016 Hi all, i'm looking for a little help. In my project the player must avoid an antagonist that is chasing them for 60 seconds before giving up. The event relies on tracking the $game_system.playtime variable to change a switch when a certain time is reached. (this is all done using other people's scripts; I have almost no scripting knowledge) Unfortunately, it is possible to open your menu to freeze event movement while playtime continues to climb, go make a cup of coffee, and come back to the antagonist giving up with no effort. I would like to have playtime paused while in the menu so this is not possible. (I could only find custom pause screen scripts in my search which is NOT what I want, I want the playtime paused while in the default menu.) Thanks! Share this post Link to post Share on other sites
Aletheos 41 Posted April 15, 2016 (edited) class Scene_Map < Scene_Base alias ale2501_start start unless $@ alias ale2501_call_menu call_menu unless $@ def start ale2501_start #Do whatever start normally does @old_frame_count ||= 0 #Set the symbol old_frame_count to a value Graphics.frame_count = @old_frame_count #Set the current frame count to the old frame count end def call_menu @old_frame_count = Graphics.frame_count #Set the old frame count to the current frame count ale2501_call_menu #Call the menu as normal end end The Game_System.playtime method uses Graphics.frame_count / Graphics.frame_rate to calculate playtime in seconds When you close the menu, the Scene_Map.start method is called again. And, of course, call_menu does exactly what you think it does. Does this satisfy your request? EDIT: ...and as per usual, my solutions are not safe for saving. When reloading a saved game, the @old_frame_counter will be undefined again, and reset the time to 0. That's less than desirable, sorry. One solution is to save the Graphics.frame_counter value in a variable, without using scripts. But, I might have another idea. Be back in a sec... class Scene_Map < Scene_Base alias ale2501_call_menu call_menu unless $@ def call_menu Old_Frame_Count.set(Graphics.frame_count) ale2501_call_menu end end class Scene_Menu < Scene_MenuBase def update super Graphics.frame_count = Old_Frame_Count.get end end module Old_Frame_Count def self.set(value) @old_frame_count = value end def self.get @old_frame_count end end Version 2. Yay for modules. This should work much better. Now it continuously sets the frame counter value so long as the menu is open. Also, since you have to open the menu before it can be open, the value is set from the current frame counter, so it should be safe with old save files. Time is now properly stopped while the menu is open. Edited April 15, 2016 by Aletheos Share this post Link to post Share on other sites
Bobadubub 1 Posted April 15, 2016 Wow thanks! This appears to do the trick. Thank you very much for your time, and for your explanation. Share this post Link to post Share on other sites
Aletheos 41 Posted April 15, 2016 I'm glad it was helpful. Please tell me if you find any bugs. Share this post Link to post Share on other sites
Rikifive 3,391 Posted April 16, 2016 This thread is closed, due to being solved. If for some reason anybody would like to re-open this thread, just send me a PM. (= If you'll find bugs or/and just want to add something, feel free to message me and I'll reopen the thread for you. (= Share this post Link to post Share on other sites