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.

KCG's Day/Night Script Question?

Script In Question (Translated Version):

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/    â—†              Day-to-Night Phases - KGC_DayNight                â—† VX â—†
#_/    â—‡                  Last update : 2008/03/08                          â—‡
#_/    â—†                  Translated by Mr. Anonymous                        â—†
#_/-----------------------------------------------------------------------------
#_/  This script adds the concept of Day-to-Night phase shifting to your game.
#_/  Events that only occur during certain phase shifts, such as night, can
#_/  be created as well.
#_/=============================================================================
#_/  Note: The event command "Tint Screen" doesn't function normally while this
#_/  script is running a phase shift. To use the Tint Screen function properly,
#_/  please refer to the directions.
#_/=============================================================================
#_/ Installation: Insert above Main.
#_/-----------------------------------------------------------------------------
#_/  Terminology: Phase refers to the current state of the day, such as "Noon".
#_/                        â—† Instructions For Usage â—†
#_/ 
#_/                          â—† Stop Day-to-Night â—†
#_/  When [DN_STOP] is inserted into a Map's name (after its given name), the
#_/  Day-to-Night change stops, the timer does not stop however, and if a phase
#_/  is currently active, such as "Night", the tint remains on the map.
#_/ 
#_/                â—† Stop Day-to-Night and Time, Cancel Phase â—†
#_/ 
#_/  When [DN_VOID] is inserted into a Map's name (after its given name), the
#_/  Day-to-Night change stops, the timer is effectively frozen, and if a phase
#_/  is currently active, such as "Night", the tint is reverted back to normal.
#_/ 
#_/                      â—† Phase-Specific Encounters â—†
#_/ 
#_/  When [DN Phase#](Where Phase# refers to the phase. 0 = Noon, 1 = Evening,
#_/  2 = Night, 3 = Morning) is inserted into a specified Troop's "Notes" box
#_/  in the Troops tab of the database, the specified Troop will only appear
#_/  under those conditions.
#_/ 
#_/                        â—† Event Script Functions â—†
#_/  The following commands are available using the "Script" item in events.
#_/ 
#_/  * stop_daynight
#_/    Day to Night change is stopped.
#_/ 
#_/  * start_daynight
#_/    Day to Night change is started.
#_/ 
#_/  * get_daynight_name
#_/    Name of present phase is acquired. This function only works in other
#_/      scripts.
#_/ 
#_/  * get_daynight_week (variable_id)
#_/    Appoints the day of the week to the given variable.
#_/ 
#_/  * get_daynight_week_name
#_/    Name of the present day is aquired. This function only works in other
#_/      scripts.
#_/ 
#_/  * change_daynight_phase(phase, duration, pass_days)
#_/    Changes the current phase to a new one. Handy for Inns and the like.
#_/    Example: change_daynight_phase (3, 1, 1)
#_/      This would make one day pass, change the phase to morning, with a
#_/      duration of one frame. Duration must be set to a minimum of 1.
#_/ 
#_/  * transit_daynight_phase(duration)
#_/      Forces the phase to change at the very moment you call this.
#_/      This appears to be bugged. No matter how I've called it, I get errors.
#_/ 
#_/  * set_daynight_default(duration)
#_/      Forces the tint of the current phase to reset to the initial phase.
#_/ 
#_/  * restore_daynight_phase(duration)
#_/      Forces the tint of the current phase to reset to its normal tint.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#==============================================================================#
#                              ★ Customization ★                              #
#==============================================================================#

module KGC
module DayNight
  #                      â—† Day to Night Switch Method â—†
  #  0. Time Lapse  1.Time passes with number of steps  2.Real Time
  METHOD = 1

  #                          â—† Phase Variable â—†
  # The present phase (of day and night) is stored here.
  PHASE_VARIABLE = 11
 
  #                    â—† Passing Days Storage Variable â—†
  #  The passing days is stored here.
  PASS_DAYS_VARIABLE = 12

  #                        â—† Stop On Event Toggle â—†
  #  Stops the Day/Night Timer when an event is run by player.
  STOP_ON_EVENT = false
 
  #                        â—† Phases During Combat â—†
  #  true = Only the battleback is tinted.
  #  false = Battleback and enemies are tinted.
  TONE_BACK_ONLY_IN_BATTLE = true

  #                      â—† Setting Individual Phases â—†
  #  Each phase makes use of the Tint Screen function. The format as follows:
  #  ["Name", the color tone(Tint), time switch],
  #
  # 
 
Ok, this may not work (The reason I think it may not work is because the script says it won't :3) but I want you to try it anyway.

Make an event with call script and in call script try:

phase = KGC::Commands.get_daynight_name
case phase
when "Noon":
$game_variables[1] = 1
when "Night":
$game_variables[1] = 2
when "Evening":
$game_variables[1] = 3
when "Morning"
$game_variables[1] = 4
end

And then in the event conditionals make the event only appear if the game variable is equal to 1, 2, 3, and/or 4 for whatever phase you're looking for.
 
If you would I would appreciate it^^

Alright, got it semi-figured-out. I got it where the NPC only TALKS when its the appropriate phase, but I just can't get it where the NPC APPEARS when its the appropriate phase, in other words the NPC is still there regardless of what phase it is.

(btw don't worry about that freeze issue, that was something wrong with something or other running on one of my other maps I need to fix, nothing to do with this stuff :3)

Another edit: Finally I got it figured out, I believe.

Ok, if you look at the script it says the present phase is stored in variable 11... so here's what I did starting with page 1:

@> Conditional Branch: Variable [0011: EventAppear] == 0
@> Control Self Switch A = ON
:Else
@> Control Self Switch A = OFF
:Branch End

This is all running a parallel process with no sprites or anything. 0 is the present phase, if I change it to another phase the event won't appear of course.

Page two is simply the event with self switch A ON.

It seems to suffice, so does anyone see any flaws in my idea? If not its pretty much resolved I guess^^
 
lol, so what I told you the second time worked?

And yeah, what you did is pretty much what I was telling you to do.

EDIT: Haha, I just noticed this is for VX, which I've never used :3 I didn't know how similar RGSS and RGSS2 where, but I guess the answer is similar enough!
 

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