Group: Member
Posts: 33
Type: None
RM Skill: Undisclosed
I want a time system in my game, I found a system that uses common events but in battle the time does not change. I assume I need a script? How can I make it so that time will pass when the player is in battle?
Group: +Gold Member
Posts: 1,522
Type: Scripter
RM Skill: Undisclosed
I didn't read the whole thing properly, so I've made a time script.
CODE
#============================================================================== # ** VXAce: Night_Runner's Permanent Time Script. #------------------------------------------------------------------------------ # History: # Date Created: 10/April/2012 # Created for: Icenick99 # @> http://www.rpgrevolution.com/forums/index.php?showtopic=56149 # # Description: # This script will constantly update defined variables (lines 34 - 39), # like you would expect from a time system. # The time is updated every time the graphics updates. # # How to Install: # Copy this entire script. In your game's editor select Tools >> # Script Editor. # Along the left side scroll to the bottom, right click on 'Main Process' # and select 'Insert'. # Paste in the window on the right. #==============================================================================
#============================================================================== # ** Graphics #------------------------------------------------------------------------------ # Edited to update variables every frame. #==============================================================================
module Graphics #-------------------------------------------------------------------------- # * Customisation #-------------------------------------------------------------------------- SECOND_VARIABLE = 10 MINUTE_VARIABLE = 11 HOUR_VARIABLE = 12 DAY_VARIABLE = 13 MONTH_VARIABLE = 14 YEAR_VARIABLE = 15 #-------------------------------------------------------------------------- # * Alias Methods #-------------------------------------------------------------------------- class << self alias nr_timeCount_update update unless $@ end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def self.update(*args) # Run the original update nr_timeCount_update(*args) # Do nothing if the variables don't exist (title screen) return if $game_variables.nil? # Increment the seconds variable $game_variables[SECOND_VARIABLE] += 1 # If the seconds has reached a full minute if $game_variables[SECOND_VARIABLE] >= 60 # Reset the seconds $game_variables[SECOND_VARIABLE] = 0 # Increment the minutes variable $game_variables[MINUTE_VARIABLE] += 1 # If the minutes variable has reached a full hour if $game_variables[MINUTE_VARIABLE] >= 60 # Reset the minutes $game_variables[MINUTE_VARIABLE] = 0 # Increment the hours $game_variables[HOUR_VARIABLE] += 1 # If the hours variable has reached a full day if $game_variables[HOUR_VARIABLE] >= 24 # Reset the hours $game_variables[HOUR_VARIABLE] = 0 # Increment the days $game_variables[DAY_VARIABLE] += 1 # If the days variable has reached a full month if $game_variables[DAY_VARIABLE] > 30 # Reset the days $game_variables[DAY_VARIABLE] = 1 # Increment the months $game_variables[MONTH_VARIABLE] += 1 # If the months variable has reached a full year if $game_variables[MONTH_VARIABLE] > 12 # Reset the days $game_variables[DAY_VARIABLE] = 1 # Increment the years $game_variables[YEAR_VARIABLE] += 1 end end end end end end end
#============================================================================== # ** End of Script. #==============================================================================
Have a second script, read the description and see which one you prefer
CODE
#============================================================================== # ** VXAce: Night_Runner's Common Events During Battle. #------------------------------------------------------------------------------ # History: # Date Created: 10/April/2012 # Created for: Icenick99 # @> http://www.rpgrevolution.com/forums/index.php?showtopic=56149 # # Description: # This script will run a common event during battle, as it would on the map. # < Please don't try to abuse this script, it's only designed to update # a variable, nothing fancy. # />. # # How to Install: # Copy this entire script. In your game's editor select Tools >> # Script Editor. # Along the left side scroll to the bottom, right click on 'Main Process' # and select 'Insert'. # Paste in the window on the right. # # How to Use: # Set the ID of the common event to run during battle on line xx (by # default it runs common event 1 during battle). #==============================================================================
#============================================================================== # ** Scene_Battle #------------------------------------------------------------------------------ # Edited to run a common event in the background. #==============================================================================
class Scene_Battle alias nr_commoneventBattle_start start unless $@ alias nr_commoneventBattle_update update unless $@ def start(*args) # Create the common event @common_event = Game_CommonEvent.new(NR_BattleCommonEvent::Event_ID) # Run the original start nr_commoneventBattle_start(*args) end def update(*args) # Update the common event @common_event.update # Run the original update nr_commoneventBattle_update(*args) end end
#============================================================================== # ** End of Script. #==============================================================================
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.
I want a time system in my game, I found a system that uses common events but in battle the time does not change. I assume I need a script? How can I make it so that time will pass when the player is in battle?
You people and scripts. Just wait until battle's over. Why do you need complete real-time? If you really must have such a system, try this. Make an end of turn, Turn event. Variable +1 Battle Minutes, Exit Event. Have a line of code in your time system, that adds Battle Minutes to your minutes, and then afterwards clears Battle Minutes to 0. (It'll work outside the battle). 30 turns will be 30 minutes, and that's good enough for Mana Khemia.
Group: Member
Posts: 33
Type: None
RM Skill: Undisclosed
QUOTE (bulmabriefs144 @ Apr 11 2012, 06:29 PM)
QUOTE (Icenick99 @ Apr 9 2012, 05:05 PM)
I want a time system in my game, I found a system that uses common events but in battle the time does not change. I assume I need a script? How can I make it so that time will pass when the player is in battle?
You people and scripts. Just wait until battle's over. Why do you need complete real-time? If you really must have such a system, try this. Make an end of turn, Turn event. Variable +1 Battle Minutes, Exit Event. Have a line of code in your time system, that adds Battle Minutes to your minutes, and then afterwards clears Battle Minutes to 0. (It'll work outside the battle). 30 turns will be 30 minutes, and that's good enough for Mana Khemia.
I never enough though for that... Thanks for sharing but this works nicely
I want a time system in my game, I found a system that uses common events but in battle the time does not change. I assume I need a script? How can I make it so that time will pass when the player is in battle?
You people and scripts. Just wait until battle's over. Why do you need complete real-time? If you really must have such a system, try this. Make an end of turn, Turn event. Variable +1 Battle Minutes, Exit Event. Have a line of code in your time system, that adds Battle Minutes to your minutes, and then afterwards clears Battle Minutes to 0. (It'll work outside the battle). 30 turns will be 30 minutes, and that's good enough for Mana Khemia.
And if you use Yanfly's base troop events, this works perfectly
Just realized that if you have an Evented Time system like me, that if you use a MOMENT condition in your troop, then call your time system common event, then it will continuously work.
I tested it myself and it works fine. started a battle at game time 19:00 and finished it at 21:00 (Two minutes real-time) and the time system updated correctly. This works best of course like I said.. With Yanfly's base troop events. So you only need to make it once.
This post has been edited by Pharonix: Apr 23 2012, 05:06 PM
__________________________
CURRENT WORKS DEMON BLADE - RPGVXA SHINIGAMI - ~12 Pages - 3 chapters complete, 1 in progress. --------------------------------- OTHER WORKS INCANTA-corrupted. INCANTA REDUX - RPGVX - On Hold --------------------------------- LITERARY WORKS
Longer Works ANGEL OF DEATH - Short Story ~ 4 Pages. SHINIGAMI - ~12 Pages - 3 chapters complete, 1 in progress. DEMON BLADE - Book/Novel?- 34 pages - On Hold. FERAL - Short Story, Length: 6 pages], 2nd person Narrative. -R3 Writing Competition #2 - First-Place DARKSPAWN - Book - 3 Pages On Hold RELGEA CHRONICLE - Book - 118 pages DRAKENGHOUL - book - 36 handwritten pages
Poems I KNOW - Poem - 30 Lines
Song Lyrics End of Days - Song- 44 Lines Kids Killing Kids - Song - 94 Lines
-If you want this sig in another language, move to a country that speaks it.-
-Lv 13 Thread Killer
My R3 Writing Corner
My Wordpress
Relgea Chronicle
X-M-O Story Quoting.
QUOTE (X-M-O @ Jun 19 2012, 02:45 AM)
QUOTE (Pharonix)
so what's going on in this thread?
QUOTE (kayden997)
Redd's back and the first thing he does is...
QUOTE (Pharonix)
pick my mom up in 15 ...*sigh*
QUOTE (kayden997)
You know it's legit!
QUOTE (Pharonix)
Then again, I wrecked the last one...........
QUOTE (Tsutanai)
Oh ok you can have a pink frosted sprinkled doughnut