Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Help with this KGC Day/Night script

Hero

Member

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    Ã¢â€”† 昼夜切り替ã
 

khmp

Sponsor

Code:
  # â—† Day/Night System
  #  0 - Time runs based on your elapsed game time.
  #  1 - Time runs based on the number of steps you've taken.
  #  2 - Time runs based off real time.  (Sensitive/Experimental)
  METHOD = 1

It looks like you just change the constant to 1 to get the day night schedule to be based on step count. I'll post the script I found.

KGC (English Translation By: Koru-chan)
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    â—† Day/Night System - KGC_DayNight â—† VX â—†
#_/    â—‡ Last update : 2008/02/01 â—‡
#_/----------------------------------------------------------------------------
#_/  Making Day and Night in your game.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ Customize ★
#==============================================================================

module KGC
module DayNight
  # â—† Day/Night System
  #  0 - Time runs based on your elapsed game time.
  #  1 - Time runs based on the number of steps you've taken.
  #  2 - Time runs based off real time.  (Sensitive/Experimental)
  METHOD = 1

  # â—† This is the number of the variable for the phases.
  # In this variable, the present phase will be housed.
  # â—† Translator's note: in other words, when making your
  # game, I would either set it to a variable you're not
  # using or avoid the default variable it uses.
  PHASE_VARIABLE     = 11
  # â—† This is the number of the variable that keeps the
  # information for the days.
  #  Days are kept here as they elapse.
  PASS_DAYS_VARIABLE = 12

  # â—† Stopping script behavior during an event.
  STOP_ON_EVENT = true
  # â—† In a battle, the following will make only the
  #  background change tone.
  #  Setting this to "false" will tone everything.
  TONE_BACK_ONLY_IN_BATTLE = true

  # â—† Setting the phases.
  #  Each phases uses the following setup.
  #   ["name", color tone (Tone), duration]
  #  It's possible to increase phases, but the other
  #  phases will not just automatically adjust.
  #  You'll have to set them yourself so they fit
  #  within the day's time frame.
  #
  #  [name]
  #    The name of the phase.
  #    The name has no significance over performance.
  #  [color tone]
  #    Color of the screen or background.
  #    If you don't know much about this, you'd be
  #    better off not editing.
  #  ***Translator's note for beginners***
  #  The way the tones are listed below are by the
  #  amount of red, green, and blue, the fourth number
  #  being saturation.  If you go into the event
  #  command for changing the screen tint, you can
  #  mess around with the tint until you find something
  #  you like.  When you okay it, the event window will
  #  show you the actual numeric values for the tone you
  #  want.  You can simply copy those numbers below into
  #  the phase you want them for.
  #
  #  [Duration]
  #    The time before the next phase occurs.
  #    If you chose for phases to change according to
  #    number of steps, the duration number is the number
  #    of steps before the phase change.
  #    In the case of a real-time system, it's changed to
  #    a 24 hour system.
  PHASE = [
    ["noon",   Tone.new(   0,    0,   0), 300],  # Phase 0
    ["evening", Tone.new( -32,  -96, -96), 100],  # Phase 1
    ["night",   Tone.new(-128, -128, -32), 250],  # Phase 2
    ["morning",   Tone.new( -48,  -48, -16), 100],  # Phase 3
  ]  # â†
 

Hero

Member

I know you use method 1, but I was wondering where you can change the number of steps it takes to change the day's phase. Anyway, I'll check out that translated script and report back if I figure anything out. And thanks for the avatar comment :) . It's Ark from Terranigma if you didn't already know.
 

khmp

Sponsor

Oh my apology inside the script is this method:
Code:
  #--------------------------------------------------------------------------
  # â—‹ Transition: Number of Steps
  #--------------------------------------------------------------------------
  def update_daynight_step
    # If it's not active, it returns.
    return if @daynight_x == $game_player.x && @daynight_y == $game_player.y

    @daynight_x = $game_player.x
    @daynight_y = $game_player.y
    # Count addition
    $game_system.daynight_counter += 1
    # State transition decision
    count = $game_system.daynight_counter
    if count >= $game_system.daynight_phase_object[2]
      transit_daynight_next
    end
  end

I'm not sure what line it is specifically so search the code CTRL-F and use this as the line to look for:
def update_daynight_step

Inside you'll see a line that increments Game_System.daynight_counter by 1. Change that 1 to whatever value you want. Probably you could use a float like 0.5 if you want the transition to be slower, or change it to 2 and speed it up. But think of it like this:
$game_system.daynight_counter += (1 / number_of_steps)

Good luck with it Hero! :thumb:
 

Azule

Member

I was wondering.... how do you get it so you can show the week name... example: when a message is displayed it shows the day of the week name in the message? And I was also wondering, how do you make an event only happen at night time or daytime?

oh, and how do i get it to run off of "real time" instead of steps? i changed "method= 1" to "method= 2" and it doesn't seem like it works....

Please don't double post ~ Atemu
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top