Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ################################################################################
- # IXFURU'S STEPS CALENDER
- ################################################################################
- # This script controls time through player steps. Tracks day,
- # night effects, tracking of dates based on a custom calender. This script also
- # adds unique features like birthdays, holidays and lifespans. Greatly
- # customizable with 200 lines of options. This script also adds up to four
- # new scenes to a project, Scene_Clock, Scene_Calender and Scene_Lifespan,
- # Scene_Birthday.
- # This script enables you to set variables to be altered based on time elapse,
- # with fully customizable months, seasons and more. Just place the script
- # in the script editor above main and below materials. Then, read through the
- # module and change things to better suit your own project. Pay close attention
- # to the scripts you assign here and make sure you set their ids up accordingly
- # in the game editor. You can set the current time at any point in the game
- # with script call: $game_calender.set_time(year, month, day, hour)
- ################################################################################
- # CREDIT:
- #First of all, if you use this script AND you use the default images for
- #backgrounds and windowskins in your scenes, you should credit WORATANA who
- # made the utility from which the windowskins were generated, and Enterbrain,
- # EvilEagle, MatsuoKaito, FirstSeed, wallpapersexpress.com and
- # ultimate-nature-wallpapers.com.
- # !!! DO NOT REDISTRIBUTE THE IMAGES HEREIN FOR COMMERCIAL PROJECTS!!!
- # You can use this script in any project you want. In non-commercial, please just
- # give me(Ixfuru) credit. For commercial, contact me on the forums of RPGMakerVX.net,
- # or RMRK.net. You can also visit my personal forum on RPGMakerVX.net in the
- # FINISH LINE user forum. Thanks and I hope you enjoy it.
- ################################################################################
- module Steps_Calender
- CALENDER_SWITCH = 18 # This is the main switch which controls time. It should
- # be noted that you CAN still use the Scenes and time alterations with this
- # switch OFF; However, all time will have to be adjusted manually, as if off,
- # it won't track time through steps.
- # How many steps in an hour
- TIME_STEPCHECK = 60
- # Alternately, you can use an in-game variable to track the Steps Calender steps which
- # the party has taken with the following script call in a common
- # event parallel process:
- # $game_variables[x] = $game_calender.hoursteps
- # However, this is not recommnded, as they are already tracked for you and can
- # be viewed in Scene_Clock. If you choose to do this, I can't assure you that
- # there will be no lag.
- #Hour Altered variables are variables you wish to altered each time the
- #hour is passed. This is good for say a specific status which only has
- #effect for a given amount of time. Like say, drunk! You're drunk, but when
- #some time passes, you get less and less intoxicated. The set up is like
- #follows:
- # variable_id => [minimum, maximum, amount]
- # wherein, the variable_id is the id of variable in the database, the
- # minimum is the least value this variable can reach. Maximum is the max
- # value, and amount is the amount by which the variable is altered each
- # time the player has taken TIME_STEPCHECK steps.
- HOUR_ALTERED_VARIABLES = {#<<<<Don't touch this!!
- 30 => [0, 10, -1]
- } #<<<Don't touch this!!!
- DAY_HOURS = 24 #The amount of hours in a day.
- # Day Altered Variables are variables you wish to alter each time a day passes.
- # setup is like this:
- # variable_id => [minimum, maximum, amount]
- DAY_ALTERED_VARIABLES = { #<<<<Don't touch this!!!
- 31 => [0, 10000, 1]
- } #<<<<Don't touch this!!!
- MONTH_DAYS = 30 #The amount of days in a month
- # Month Altered Variables are variables which you wish to alter each time a
- # month passes. Setup:
- # variable_id = [minimum, maximum, amount]
- MONTH_ALTERED_VARIABLES = { #<<<Don't touch this!!!
- 32 => [0, 3, 1]
- }
- YEAR_MONTHS = 12 #The amount of months in a year
- #Below, set up the names of the months. Make sure you edit a month's data
- #for every month you placed in the YEAR_MONTHS constant. Setup:
- # month_id => month_name
- MONTHS = {
- 1 => "January",
- 2 => "February",
- 3 => "March",
- 4 => "April",
- 5 => "May",
- 6 => "June",
- 7 => "July",
- 8 => "August",
- 9 => "September",
- 10 => "October",
- 11 => "November",
- 12 => "December"
- }
- #Year Altered Variables are variables which you wish to alter each time a year
- # passes. (There is setup for birthdays, if you wish to use it, so you can
- # use this for any thing else you wish to use.) Setup:
- # variable_id = [minimum, maximum, amount]
- YEAR_ALTERED_VARIABLES = {
- 33 => [0, 20, -1]
- }
- #Seasons are setup to adjust switches, which you can then use to alter graphics,
- # alter some kind of gardening system, etc. You set them up like this:
- #Season_id => [month_start, day_start, , month_end, day_end, switch_id, season_name]
- #For best results, make sure one season ends and another season starts the day
- # after. LIMITATION: You can't have two seasons in one month. You HAVE to
- # have a month start and month end storing different values!
- USE_SEASONS = true # should script check for season changes
- SEASONS = { #<<<Don't delete this!!!
- 1 => [11, 16, 2, 15, 38, "Winter"],
- 2 => [2, 16, 5, 15, 39, "Spring"],
- 3 => [5, 16, 8, 15, 40, "Summer"],
- 4 => [8, 16, 11, 15, 41, "Fall"]
- }#<<<Don't delete this!!!
- #If you are using the seasons system, you can put images into the system folder
- # with the same name as the season in the above array. This will be used as the
- # calender back, instead of the default one when the calender scene is viewed,
- # dependent upon the current season. If none are listed for specific day,
- # then the default CALENDER_BACK will be displayed instead.
- #Birthdays are set up with switches, which activate on the actor's birthday and
- # then deactivate when the day is over. You can use this switch then to set up
- # events in the editor to occur only when it's the actor's birthday.
- # Setting this up requires use of the following guide:
- # actor_id => switch_id
- # Actor birthdays will be set up through the Scene_Birthday, which you can
- # call with this. There is a variable which you MUST set prior to
- # calling the scene. If you don't set it, and it's at zero, it'll set itself
- # to 1 by default before calling the scenes. The variable can be set up at
- # line 277, and is used to tell who's birthday is currently being editted.
- # $scene = Scene_Birthday.new
- # You can also bypass the scene if you wish, and just set the birthdays
- # manually via script calls:
- # $game_actors[x].birthday_month
- # and
- # $game_actors[x].birthday_day
- # This will do little good, if you are not using the birthday system, but
- # it's little good unless you're using the birthday system included, as nothing
- # special on the given day unless you work it in somehow yourself. Nonetheless,
- # the option's there.
- USE_BIRTHDAYS = true #should the script check for birthdays
- BIRTHDAY_SWITCHES = {#<<<<Don't delete this!!!
- 1 => 30,
- 2 => 31,
- 3 => 32,
- 4 => 33,
- 5 => 48
- }#<<<Don't delete this!!!
- BIRTHDAY_ME = "Fanfare1" # Sound Effect which will alert there is a birthday.
- BIRTHDAY_STATUS_STRING = "BIRTHDAY!" # String shown in status window when actor birthday.
- BIRTHDAY_STATUS_COLOR = 6 # text color of birthday string
- BIRTHDAY_STATUS_ICON = 152 #Icon signifying birthday
- BIRTHDAY_GOLD_GIFT = 1000 #Amount of gold given on birthday
- BIRTHDAY_STATE = 20 #State given on birthday
- BIRTHDAY_COMMON_EVENT = 2
- #Holidays are much the same, in that they are run off switches, giving you ample
- # ability to use the switch to correspond with the given day. Setup:
- # month_id => day => [switch_id, holiday_name, music_effect, common_event]
- #Replace the month_id with the key value of the month's name in MONTHS constant.
- #Then, replace the day with the given month's day you wish to have the holiday
- # fall on. For instance in the first two, '6 => 2 =>' Would say 6th month, 2nd
- # day. The first position in the inner array is the switch id of the switch you
- # want to activate on the given day. Next the first string is the holiday's
- # name. The second string is the Music Effect from AUDIO/ME file that you want
- # to play. The last variable is the number of common event you wish to call.
- # You MUST place a variable there, but if you don't want anything to happen,
- # just leave the common event in the database blank.
- USE_HOLIDAYS = true #should the script check for holidays
- HOLIDAYS = { #<<<<Don't delete this!!!
- 1 => {1 => [34, "New Years", "FanFare2", 3],
- 23 => [35, "Gamers Day", "FanFare2", 4]},
- 7 => {4 => [36, "Independence Day", "FanFare2", 5]},
- 12 => {25 => [37, "Christmas", "FanFare2", 6]}
- } #<<<<<<<<<<Don't delete this!!!
- # Lifespan is a way to give an actor a set number of years he/she can live.
- # You can access the lifespan of an actor by calling this script call:
- # $scene = Scene_Lifespan.new
- # to add time place:
- # $game_actors[x].add_lifespan_time(years, months, days, hours, end_game?)
- # to subtract time place:
- # $game_actors[x].subtract_lifespan_time(years, months, days, hours, end_game?)
- # replace the x with the actor's id. The year, month, day and hour specifies
- # the exact moment the actor will cease to exist. It should be clarified,
- # that upon reaching this date, the actor will be removed from party and any
- # atttempt to add them, will fail. Also, if there are no actors left after the
- # actor's removal, the game will end. The 'end_game?' element array, tells
- # whether or not the game should end regardless of whether or not there are
- # other actors in the party. Set to true, it will end, set to false, it will
- # continue without the actor. Below is the default value for lifespan. This
- # value will be added to the value of the start date, producing a default
- # lifespan for all actors who's lifespan has not been stated with script calls.
- # To check the lifespan of an actor, call $scene = Scene_Lifespan.new(actor_id)
- # This will call up a window in which the actor's lifespan will be visible.
- USE_LIFESPAN = true #should the script check for lifespan
- DLS_YRS = 50
- DLS_MTHS = 6
- DLS_DAYS = 10
- LIFESPAN_BACK = 'EBCorridor' #spcifies which picture in graphic/system folder to place
- # as background for lifespan scene.
- #The following will specify a common event to run when an actor dies due to
- # LIFESPAN.
- LIFESPAN_DEATH_EVENT = 1
- LIFESPAN_RUNOUT = " has died of old age."
- # You can bypass the lifespan and make an actor 'deceased' by calling this
- # script call:
- # $game_actors[x].make_deceased
- # Further, you can revive a deceased actor with:
- # $game_actors[x].erase_deceased
- # Replace the x in these two calls with the id of the actor you wish to affect.
- # In addition, you can check if an actor is deceased by using a script in a
- # conditional branch:
- # $game_actors[x].is_deceased?
- #The following four values specify the start up value for the year, month,
- # day and hour in which the game will commense when "new game" is selected.
- START_YEAR = 2000
- START_MONTH = 4
- START_DAY = 1
- START_HOUR = 8
- #The following will specify the 'segments' of a day. The setup:
- # segment_id => [segment_name, begin, end, red, green, blue, gray, switch_id]
- # Segment_id will be the hash key for the given day segment. Set segment_name
- # to whatever you want to the part of day. Set begin and end to the values of
- # hours between which the segment will be active. Set the colors, R, G, B, GRAY
- # to values between 0-255 which will account for TINT of the screen during
- # those hours. Set switch_id to the switch which you want to turn on during
- # this part of the day. Much like seasons, adjust the segments, so that one
- # starts one hour after the other ends. It is also very important that whatever
- # you choose, all start times must be lower than end times, as the script uses
- # >= start and <= end. Therefor, if you placed a segment beginning at 22 and
- # ending at 5, the script will set this for >= 22 and <= 5 which is impossible
- # and therefor won't work.
- USE_DAY_SEGMENTS = true
- DAY_SEGMENTS = { #<<< Don't delete this!!!
- 1 => ["Morning", 6, 11, 0, 0, 0, 0, 42],
- 2 => ["Afternoon", 12, 17, 0, 0, 0, 43],
- 3 => ["Evening", 17, 23, -68, -68, -68, 0, 44],
- 4 => ["Night", 0, 5, -170, -170, -170, 0, 45]
- }
- #The following is an array of switches which will alter the script to disregard
- # the day_segment tinting, this is crucial to games where you will have well-lit
- # interiors. You would then set the no tint switch when entering the interior
- # and the tint would return to 0, 0, 0, 0 for the duration of your time there.
- NO_TINT_SWITCHES = [46, 47]
- #The following group of constants will be used within the Calender Scene for
- # a more custom appearance. You can call the calender scene at any time,
- # using $scene = Scene_Calender.new
- CALENDER_BACK = "FSCalender" # Finds a file in your system folder to be displayed as
- # the background.
- CALENDER_HEADING = "CALENDER"
- CALENDER_HEADING_SIZE = 55
- CALENDER_HEADING_COLOR = 20
- YEAR_STRING = "Year: " #displays next to the value for year
- MONTH_STRING = "Month: " #displays next to month value
- DAY_STRING = "Day: " #displays next to value of day
- HOUR_STRING = "Time: " #displays next to the hour value
- CALENDER_TEXT_SIZE = 30 #font size of calender information
- CALENDER_STRING_COLOR = 27 #color of parameter strings in calender scene
- CALENDER_VALUES_COLOR = 21 #color of values in calender parameters
- CALENDER_WINDOWSKIN = "CalenderWindow"
- CALENDER_OPACITY = 0 # set this from 0 (transparent) to 255. This will be used
- # to determine how dark you want the Windowskin in the
- # Scene_Calender drawn. It also applies to the Optional
- # Windows of Scene_Calender.
- #
- # The next few are of course optional, dependent upon if you chose to use the
- # birthdays, holidays, seasons and segments part of the script.
- #For this first array, the script will display the different information for
- # the given optional parts in all four corners.
- # [upper_left, bottom_left, upper_right, bottom_right]
- # Use the following ids for each birthdays = 1, holidays = 2, seasons = 3,
- # segments = 4. So this:
- # [3, 2, 4, 1]
- # Would say to show the seasons in the upperleft, the holidays in the
- # lowerleft, the segments in the upper right and the holidays in the lower
- # right of the window.
- OPTIONAL_ALIGNMENT = [1, 4, 2, 3]
- SEASON_STRING = "Season: "
- BIRTHDAY_STRING = "Birthdays: "
- HOLIDAY_STRING = "Holidays: "
- SEGMENT_STRING = "T.O.D.: "
- OPTIONAL_COLOR = 10
- # A final scene can be called from a script call:
- # $scene = Scene_Clock.new
- # This will be good for a quick look at what time it is if the player happens
- # upon a wall clock or something.
- CLOCK_IMAGE = "MatsuoKaito" # an image from the system folder
- CLOCK_HEADING = "CLOCK" # the title heading of the clock scene
- CLOCK_COLOR = 14
- CLOCK_SIZE = 44
- CLOCK_WINDOWSKIN = "ClockWindow"
- CLOCK_OPACITY = 0 # from 0-255, used to determine how dark you want the Window
- # Skin drawn during Scene_Clock
- # These constant is used during multiple scenes.
- ACTOR_FACE_VARIABLE = 34 #Variable set to identify which actor's time stats are being veiwed
- ACTOR_NAME_COLOR = 11 #text color for actor's name
- #These constants are used during the LIFESPAN scene:
- LS_BANNERTEXT_COLOR = 25
- LS_BANNERTEXT_SIZE = 45
- LS_SYSTEMTEXT_COLOR = 16
- LS_HEADING = "LIFESPAN"
- LS_YEARS_STRING = "Years to Live:"
- LS_MONTHS_STRING = "Months to Live:"
- LS_DAYS_STRING = "Days to Live:"
- LS_WINDOWSKIN = "LifeSpanWindow"
- LS_OPACITY = 0 # from 0-255 (see OPACITY settings for CLOCK)
- #Next, you can set the time during which a sleep at the inn runs its course.
- # With the editor, you can use this script call to advance time to the
- # INN_TIME:
- # $game_calender.inn_call
- # Set up the constant below with what hour you wish a sleep at the inn to
- # advance to.
- INN_TIME = 7
- # Here, you will set the PopUp Window Sound Effect. This window will display
- # information if say an actor has died from old age, or you try to add an
- # actor who has deceased...Must be in the SE folder of the Audio Directory.
- POPUP_SE = "Flash1"
- POPUP_WAIT = 180 # how many frames the popup will be visible before disposing
- #The last value to be set is this boolean. This will allow access to the
- # calender from the menu, if true. And if not, it will only allow access by
- # using script call.
- MENU_CALENDER = true
- ##############################################################################
- # END OF EDITTABLE REGION:
- # Any further editting is done so at your own risk!!
- ##############################################################################
- end
- ################################################################################
- # GAME CALENDER (Custom Class)
- ################################################################################
- class Game_Calender
- include Steps_Calender # include the module
- attr_accessor :hour
- attr_accessor :day
- attr_accessor :month
- attr_accessor :year
- attr_accessor :season
- attr_accessor :holiday
- attr_accessor :birthday
- attr_accessor :segment
- attr_accessor :tinting
- attr_accessor :hoursteps
- attr_accessor :stepchecker
- #=============================================================================
- # Initialize
- #=============================================================================
- def initialize
- @stepchecker = TIME_STEPCHECK
- @hoursteps = 0
- @tinting = []
- @bd_music_played = false
- @hd_music_played = false
- @big_days = []
- @bd_gold_given = false
- @bd_event_run = false
- @hd_event_run = false
- @bd_state_applied = false
- @tint_set = false
- @hour = START_HOUR
- @day = START_DAY
- @month = START_MONTH
- @year = START_YEAR
- if USE_SEASONS == true
- get_seasons
- determine_current_season(@month, @day)
- end
- if USE_BIRTHDAYS == true
- get_birthdays
- determine_current_birthday(@month, @day)
- end
- if USE_HOLIDAYS == true
- get_holidays
- determine_current_holiday(@month, @day)
- end
- if USE_DAY_SEGMENTS == true
- get_segments
- determine_current_segment(@hour)
- end
- end
- #=============================================================================
- # Get Seasons
- #=============================================================================
- def get_seasons
- @seasons = SEASONS.keys
- end
- #=============================================================================
- # Get Holidays
- #=============================================================================
- def get_holidays
- @holidays = HOLIDAYS.keys
- end
- #=============================================================================
- # Get Birthdays
- #=============================================================================
- def get_birthdays
- @birthdays = []
- for member in $game_party.members
- @birthdays.push(member.id)
- end
- end
- #=============================================================================
- # Get Segments
- #=============================================================================
- def get_segments
- @segments = DAY_SEGMENTS.keys
- end
- #=============================================================================
- # Determine Current Season
- #=============================================================================
- def determine_current_season(month, day)
- unless @seasons.empty?
- for i in @seasons #once for every season in keys
- if SEASONS[i][0] < SEASONS[i][2] #does the season have a start
- # month less than the end date?
- if month >= SEASONS[i][0] and month <= SEASONS[i][2]
- if month == SEASONS[i][0] and day >= SEASONS[i][1]
- @season = SEASONS[i][5]
- turn_off_season_switches
- $game_switches[SEASONS[i][4]] = true
- elsif month == SEASONS[i][2] and day <= SEASONS[i][3]
- @season = SEASONS[i][5] # set season string
- turn_off_season_switches # call deactivation of all season switches
- $game_swithces[SEASONS[i][4]] = true #turn on appropriate switch
- else
- @season = SEASONS[i][5]
- turn_off_season_switches
- $game_switches[SEASONS[i][4]] = true
- end
- end
- elsif SEASONS[i][0] > SEASONS[i][2]
- if month >= SEASONS[i][0] and month <= MONTHS.size or month > 0 and month <= SEASONS[i][2]
- if month == SEASONS[i][0] and day >= SEASONS[i][1]
- @season = SEASONS[i][5]
- turn_off_season_switches
- $game_switches[SEASONS[i][4]] = true
- elsif month == SEASONS[i][2]
- @season = SEASONS[i][5]
- turn_off_season_switches
- $game_switches[SEASONS[i][4]] = true
- else
- @season = SEASONS[i][5]
- turn_off_season_switches
- $game_switches[SEASONS[i][4]] = true
- end
- end
- end
- end
- end
- end
- #=============================================================================
- # Control Season Switch
- #=============================================================================
- def turn_off_season_switches
- unless @seasons.empty?
- for i in @seasons # once for every key of the hash
- $game_switches[SEASONS[i][4]] = false # turn off all switches
- end
- end
- end
- #=============================================================================
- # Determine Current Holiday
- #=============================================================================
- def determine_current_holiday(month, day)
- for holiday in @holidays
- if month == holiday
- checkdays = HOLIDAYS[holiday].keys
- for check in checkdays
- if day == check
- @holiday = HOLIDAYS[holiday][check][1]
- turn_off_holiday_switches
- if HOLIDAYS[holiday][chkeck][0] != nil
- $game_switches[HOLIDAYS[holiday][check][0]] = true
- if hd_music_played == false
- Audio.me_play('Audio/ME/' + HOLIDAY[holiday][check][2], 80, 100)
- @hd_music_played = true
- end
- end
- if hd_event_run == false
- $game_temp.common_event_id = HOLIDAY[holiday][check][3]
- hd_event_run = true
- end
- end
- end
- end
- end
- end
- #=============================================================================
- # Turn Off Holiday Switches
- #=============================================================================
- def turn_off_holiday_switches
- unless @holidays.empty?
- for i in @holidays
- x = HOLIDAYS[i].keys
- for a in x
- if HOLIDAYS[i][a][0] != nil
- $game_switches[HOLIDAYS[i][a][0]] = false
- end
- end
- end
- end
- end
- #=============================================================================
- # Determine Current Birthday
- #=============================================================================
- def determine_current_birthday(month, day)
- for i in $game_party.members
- if i.birthday_month == month
- if i.birthday_day == day
- bdid = i.id
- @big_days.push(bdid)
- if BIRTHDAY_SWITCHES[bdid] != nil
- $game_switches[BIRTHDAY_SWITCHES[bdid]] = true
- if BIRTHDAY_GOLD_GIFT != nil
- if @bd_gold_given == false
- $game_party.gold += BIRTHDAY_GOLD_GIFT
- end
- end
- end
- if @bd_music_played == false
- Audio.me_play('Audio/ME/' + BIRTHDAY_ME, 80, 100)
- @bd_music_played = true
- end
- if BIRTHDAY_COMMON_EVENT != nil
- if @bd_event_run == false
- $game_temp.common_event_id = BIRTHDAY_COMMON_EVENT
- end
- end
- if BIRTHDAY_STATE != nil
- if @bd_state_applied == false
- i.add_state(BIRTHDAY_STATE)
- @bd_state_applied = true
- end
- end
- end
- end
- end
- adjust_birthday_switches
- end
- #=============================================================================
- # Determine Current Segment
- #=============================================================================
- def determine_current_segment(hour)
- for segment in @segments
- if hour >= DAY_SEGMENTS[segment][1]
- if hour <= DAY_SEGMENTS[segment][2]
- @segment = DAY_SEGMENTS[segment][0]
- turn_off_segment_switches
- if DAY_SEGMENTS[segment][7] != nil
- $game_switches[DAY_SEGMENTS[segment][7]] = true
- end
- change_segment_tone(segment)
- end
- end
- end
- end
- #=============================================================================
- # Turn Off Segment Switches
- #=============================================================================
- def turn_off_segment_switches
- unless @segments.empty?
- for i in @segments
- if DAY_SEGMENTS[i][7] != nil
- $game_switches[DAY_SEGMENTS[i][7]] = false
- end
- end
- end
- end
- #=============================================================================
- # Change Segment Tone
- #=============================================================================
- def change_segment_tone(segment)
- for i in NO_TINT_SWITCHES
- if $game_switches[i] == true
- @tone = Tone.new(0, 0, 0, 0)
- $game_map.screen.start_tone_change(tone, 12)
- else
- @tinting[0] = DAY_SEGMENTS[segment][3]
- @tinting[1] = DAY_SEGMENTS[segment][4]
- @tinting[2] = DAY_SEGMENTS[segment][5]
- @tinting[3] = DAY_SEGMENTS[segment][6]
- tone = Tone.new(@tinting[0], @tinting[1], @tinting[2], @tinting[3])
- $game_map.screen.start_tone_change(tone, 12)
- @tone_set = true
- end
- end
- end
- #=============================================================================
- # Each Step Adjust
- #=============================================================================
- def each_step_adjust
- if @hoursteps >= TIME_STEPCHECK
- @hour += 1
- adjust_hour_altered_variables(1)
- if USE_DAY_SEGMENTS == true
- determine_current_segment(@hour)
- end
- @stepchecker += TIME_STEPCHECK
- @hoursteps = 0
- end
- if @hour > DAY_HOURS - 1
- @day += 1
- @hour = 0
- adjust_day_altered_variables(1)
- make_daily_changes
- end
- if @day > MONTH_DAYS
- @month += 1
- @day = 1
- adjust_month_altered_variables(1)
- if USE_SEASONS == true
- determine_current_season(@month, @day)
- end
- end
- if @month > YEAR_MONTHS
- @year += 1
- @month = 1
- adjust_year_altered_variables(1)
- end
- end
- #=============================================================================
- # Adjust Hour Altered Variables
- #=============================================================================
- def adjust_hour_altered_variables(amount)
- unless HOUR_ALTERED_VARIABLES.empty?
- hav = HOUR_ALTERED_VARIABLES.keys
- for v in hav
- $game_variables[v] += HOUR_ALTERED_VARIABLES[v][2] * amount #adjust the variable
- end
- if $game_variables[v] > HOUR_ALTERED_VARIABLES[v][1] #is variable more than max
- $game_variables[v] = HOUR_ALTERED_VARIALBES[v][1] #set variable to max
- end
- if $game_variables[v] < HOUR_ALTERED_VARIABLES[v][0] #is variable less than minimum
- $game_variables[v] = HOUR_ALTERED_VARIABLES[v][0] #set variable to minimum
- end
- end
- end
- #=============================================================================
- # Adjust Day Altered Variables
- #=============================================================================
- def adjust_day_altered_variables(amount)
- unless DAY_ALTERED_VARIABLES.empty?
- dav = DAY_ALTERED_VARIABLES.keys
- for d in dav
- $game_variables[d] += DAY_ALTERED_VARIABLES[d][2] * amount
- end
- if $game_variables[d] > DAY_ALTERED_VARIABLES[d][1]
- $game_variables[d] = DAY_ALTERED_VARIABLES[d][1]
- end
- if $game_variables[d] < DAY_ALTERED_VARIABLES[d][0]
- $game_variables[d] = DAY_ALTERED_VARIABLES[d][0]
- end
- end
- end
- #=============================================================================
- # Adjust Month Altered Variables
- #=============================================================================
- def adjust_month_altered_variables(amount)
- unless MONTH_ALTERED_VARIABLES.empty?
- mav = MONTH_ALTERED_VARIABLES.keys
- for m in mav
- $game_variables[m] += MONTH_ALTERED_VARIABLES[m][2] * amount
- end
- if $game_variables[m] > MONTH_ALTERED_VARIABLES[m][1]
- $game_variables[m] = MONTH_ALTERED_VARIABLES[m][1]
- end
- if $game_variables[m] < MONTH_ALTERED_VARIABLES[m][0]
- $game_variables[m] = MONTH_ALTERED_VARIABLES[m][0]
- end
- end
- end
- #=============================================================================
- # Adjust Year Altered Variables
- #=============================================================================
- def adjust_year_altered_variables(amount)
- unless YEAR_ALTERED_VARIABLES.empty?
- yav = YEAR_ALTERED_VARIABLES.keys
- for y in yav
- $game_variables[y] += YEAR_ALTERED_VARIABLES[y][2] * amount
- end
- if $game_variables[y] > YEAR_ALTERED_VARIABLES[y][1]
- $game_variables[y] = YEAR_ALTERED_VARIABLES[y][1]
- end
- if $game_variables[y] < YEAR_ALTERED_VARIABLES[y][0]
- $game_variables[y] = YEAR_ALTERED_VARIABLES[y][0]
- end
- end
- end
- #=============================================================================
- # Adjust Birthday Switches
- #=============================================================================
- def adjust_birthday_switches
- unless @birthdays.empty?
- for bd in @birthdays
- $game_switches[bd] = false
- end
- end
- unless @big_days.empty?
- for bds in @big_days
- $game_switches[bds] = true
- end
- end
- end
- #=============================================================================
- # Make Daily Changes
- #=============================================================================
- def make_daily_changes
- if USE_BIRTHDAYS == true
- @big_days.clear
- @bd_gold_given = false
- @bd_music_played = false
- @bd_event_run = false
- adjust_birthday_switches
- @hd_music_played = false
- @hd_event_run = false
- for member in $game_party.members
- member.remove_state(BIRTHDAY_STATE)
- end
- end
- if USE_LIFESPAN == true
- for actor in $game_party.members
- actor.gradual_decrement_lifespan
- end
- end
- if USE_BIRTHDAYS == true
- determine_current_birthday(@month, @day)
- end
- if USE_HOLIDAYS == true
- determine_current_holiday(@month, @day)
- end
- end
- #=============================================================================
- # Set Time
- #=============================================================================
- def set_time(hour, day, month, year)
- mta = 0
- dta = 0
- hta = 0
- if year > @year
- adjust_year_altered_variables(year - @year)
- mta = ((year * YEAR_MONTHS) + month) - @month
- adjust_month_altered_variables(mta)
- dta = ((mta * MONTH_DAYS) + day) - @day
- adjust_day_altered_variables(dta)
- hta = ((dta * DAY_HOURS) + hour) - @hour
- adjust_hour_altered_variables(hta)
- elsif month > @month
- adjust_month_altered_variables(month - @month)
- dta = ((month * MONTH_DAYS) + day) - @day
- adjust_day_altered_variables(dta)
- hta = ((dta * DAY_HOURS) + hour) - @hour
- adjust_hour_altered_variables(hta)
- elsif day > @day
- adjust_day_altered_variables(day - @day)
- hta = ((dta * DAY_HOURS) + hour) - @hour
- adjust_hour_altered_variables(hta)
- elsif hour > @hour
- adjust_hour_altered_variables(hour - @hour)
- end
- span = 0
- if USE_LIFESPAN == true
- if year = @year
- if month < @month
- span = 1
- elsif month > @month
- span = 0
- elsif month == @month
- if day < @day
- span = 1
- elsif day > @day
- span = 0
- end
- end
- elsif year > @year
- span = 0
- elsif year < @year
- span = 1
- end
- end
- @hour = hour
- @day = day
- @month = month
- @year = year
- set_time_adjustment
- if USE_LIFESPAN == true
- for actor in $game_party.members
- if span == 0
- actor.modify_lifespan_add
- elsif span == 1
- actor.modify_lifespan_subtract
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Set Time Adjustment
- #-----------------------------------------------------------------------------
- def set_time_adjustment
- sth = @hour
- std = @day
- stm = @month
- sty = @year
- if sth >= DAY_HOURS
- std = std + (sth / DAY_HOURS)
- sth = sth % DAY_HOURS
- end
- if std >= MONTH_DAYS
- stm = stm + (std / MONTH_DAYS)
- std = std % MONTH_DAYS
- end
- if stm >= YEAR_MONTHS
- sty = sty + (stm / YEAR_MONTHS)
- stm = stm % YEAR_MONTHS
- end
- @hour = sth
- @day = std
- @month = stm
- @year = sty
- if USE_SEASONS == true
- determine_current_season(@month, @day)
- end
- if USE_DAY_SEGMENTS == true
- determine_current_segment(@hour)
- end
- if USE_HOLIDAYS == true
- determine_current_holiday(@month, @day)
- end
- if USE_BIRTHDAYS == true
- determine_current_birthday(@month, @day)
- end
- end
- #-----------------------------------------------------------------------------
- # Increment Steps
- #-----------------------------------------------------------------------------
- def increment_steps
- if $game_switches[CALENDER_SWITCH] == true
- @hoursteps += 1
- each_step_adjust
- end
- end
- #-----------------------------------------------------------------------------
- # Inn Call
- #-----------------------------------------------------------------------------
- def inn_call
- if @hour >= INN_TIME
- @day += 1
- @hour = INN_TIME
- else
- @hour = INN_TIME
- end
- set_time_adjustment
- end
- end # End of Class!
- ################################################################################
- # GAME TEMP
- ################################################################################
- class Game_Temp
- attr_accessor :birthday_month
- attr_accessor :birthday_day
- attr_accessor :birthday_actor_id
- alias sc_gt_initialize initialize unless $@
- def initialize
- sc_gt_initialize
- @birthday_month = 1
- @birthday_day = 1
- @birthday_actor_id = 1
- end
- end
- ################################################################################
- # GAME ACTOR
- ################################################################################
- class Game_Actor < Game_Battler
- include Steps_Calender
- attr_accessor :birthday_day
- attr_accessor :birthday_month
- attr_accessor :birthday_switch
- attr_accessor :lifespan_years
- attr_accessor :lifespan_months
- attr_accessor :lifespan_days
- attr_accessor :deceased
- attr_accessor :end_game
- alias sc_ga_setup setup unless $@
- def setup(actor_id)
- sc_ga_setup(actor_id)
- if USE_BIRTHDAYS
- get_birthday_switch
- end
- if USE_LIFESPAN
- get_actor_lifespan
- check_for_deceased
- @end_game = false
- end
- end
- #-----------------------------------------------------------------------------
- # Get Birthday Switch
- #-----------------------------------------------------------------------------
- def get_birthday_switch
- unless BIRTHDAY_SWITCHES.empty?
- if BIRTHDAY_SWITCHES.has_key?(@actor_id)
- @birthday_switch = BIRTHDAY_SWITCHES[@actor_id]
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Get Actor Lifespan
- #-----------------------------------------------------------------------------
- def get_actor_lifespan
- @lifespan_years = DLS_YRS
- @lifespan_months = DLS_MTHS
- @lifespan_days = DLS_DAYS
- end
- #-----------------------------------------------------------------------------
- # Gradual Decrement Lifespan
- #-----------------------------------------------------------------------------
- def gradual_decrement_lifespan
- @lifespan_days -= 1
- modify_lifespan_subtract
- check_for_deceased
- end
- #-----------------------------------------------------------------------------
- # Check for Deceased
- #-----------------------------------------------------------------------------
- def check_for_deceased
- if @lifespan_days <= 0
- if @lifespan_months <= 0
- if @lifepsan_years <= 0
- Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
- @info_window = Window_Quickfo.new(@name + LIFESPAN_RUNOUT)
- Graphics.wait(240)
- make_deceased
- @info_window.dispose
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Set Birthday
- #-----------------------------------------------------------------------------
- def set_birthday(month, day)
- @birthday_month = month
- @birthday_day = day
- end
- #-----------------------------------------------------------------------------
- # Add Lifespan Time
- #-----------------------------------------------------------------------------
- def add_lifespan_time(years, months, days, end_game = false)
- if @deceased == true
- string = "But this actor has deceased!"
- Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
- @info_window = Window_Quickfo.new(string)
- Graphics.wait(POPUP_WAIT)
- @info_window.dispose
- else
- @lifespan_days += days
- @lifespan_months += months
- @lifespan_years += years
- @end_game = end_game
- modify_lifespan_add
- end
- end
- #-----------------------------------------------------------------------------
- # Subtract Lifespan Time
- #-----------------------------------------------------------------------------
- def subtract_lifespan_time(years, months, days, end_game)
- if @deceased == true
- string = "But this actor has deceased!"
- Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
- @info_window = Window_Quickfo.new(string)
- Graphics.wait(POPUP_WAIT)
- @info_window.dispose
- else
- @lifespan_days -= days
- @lifespan_months -= months
- @lifespan_years -= years
- @end_game = end_game
- modify_lifespan_subtract
- end
- end
- #-----------------------------------------------------------------------------
- # Modify Lifespan Add
- #-----------------------------------------------------------------------------
- def modify_lifespan_add
- lsd = @lifespan_days
- lsm = @lifespan_months
- lsy = @lifespan_years
- if lsd >= MONTH_DAYS # is lifespan days more or equal to days in a month
- lsm = lsm + (lsd / MONTH_DAYS)
- lsd = lsd % MONTH_DAYS
- end
- if lsm >= YEAR_MONTHS # is lifespan months more eual to months in a year
- lsy = lsy + (lsy / YEAR_MONTHS)
- lsm = lsy % YEAR_MONTHS
- end
- @lifespan_days = lsd # reset the lifespan values
- @lifespan_months = lsm
- @lifespan_years = lsy
- end
- #-----------------------------------------------------------------------------
- # Modify Lifespan Subtract
- #-----------------------------------------------------------------------------
- def modify_lifespan_subtract
- lsd = @lifespan_days
- lsm = @lifespan_months
- lsy = @lifespan_years
- if lsy < 0 # is lifespan years less than 0
- until lsy == 0
- lsy += 1
- lsm -= YEAR_MONTHS
- end
- end
- if lsm < 0 # is lifespan months less than 0
- until lsm == 0
- lsm += 1
- lsd -= MONTH_DAYS
- end
- end
- if lsd < 0 # is lifepsan days less than 0
- lsd = 0
- end
- @lifespan_days = lsd # reset lifespan values
- @lifespan_months = lsm
- @lifespan_years = lsy
- end
- #-----------------------------------------------------------------------------
- # Make Deceased
- #-----------------------------------------------------------------------------
- def make_deceased
- if LIFESPAN_DEATH_EVENT != nil
- $game_temp.common_event_id = LIFESPAN_DEATH_EVENT
- end
- @lifespan_years = 0
- @lifespan_months = 0
- @lifespan_days = 0
- @deceased = true
- $game_party.check_for_deceased_actor
- end
- #-----------------------------------------------------------------------------
- # Erase Deceased
- #-----------------------------------------------------------------------------
- def erase_deceased
- @deceased = false
- end
- #-----------------------------------------------------------------------------
- # Is Deceased?
- #-----------------------------------------------------------------------------
- def is_deceased?
- if @deceased == true
- return true
- else
- return false
- end
- end
- end
- ################################################################################
- # GAME_PARTY
- ################################################################################
- class Game_Party < Game_Unit
- include Steps_Calender
- attr_accessor :gold
- #--------------------------------------------------------------------------
- # Add an Actor (Overwritten Method!!!)
- #--------------------------------------------------------------------------
- def add_actor(actor_id)
- if USE_LIFESPAN == true
- if $game_actors[actor_id].deceased == true
- Audio.se_play("Audio/SE/" + POPUP_SE, 100, 80)
- @info_window = Window_Quickfo.new("But this actor is deceased!")
- Graphics.wait(POPUP_WAIT)
- @info_window.dispose
- elsif @actors.size < MAX_MEMBERS and not @actors.include?(actor_id)
- @actors.push(actor_id)
- $game_player.refresh
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Check for deceased Actor
- #-----------------------------------------------------------------------------
- def check_for_deceased_actor
- for actor in $game_party.members
- if actor.deceased == true
- remove_actor(actor)
- $game_player.refresh
- end
- end
- end
- end
- ################################################################################
- # GAME PLAYER
- ################################################################################
- class Game_Player < Game_Character
- include Steps_Calender
- alias sc_gpl_increase_steps increase_steps unless $@
- def increase_steps
- sc_gpl_increase_steps
- $game_calender.increment_steps
- $game_party.check_for_deceased_actor
- end
- end
- ################################################################################
- # WINDOW BASE
- ################################################################################
- class Window_Base < Window
- include Steps_Calender
- def draw_birthday_string(x, y)
- self.contents.font.color = text_color(BIRTHDAY_STATUS_COLOR)
- self.contents.draw_text(x, y, self.width, WLH, BIRTHDAY_STATUS_STRING)
- self.contents.font.color = normal_color
- end
- end
- ################################################################################
- # WINDOW STATUS
- ################################################################################
- class Window_Status < Window_Base
- include Steps_Calender
- alias sc_ws_refresh refresh unless $@
- def refresh
- sc_ws_refresh
- if USE_BIRTHDAYS == true
- if $game_switches[BIRTHDAY_SWITCHES[@actor.id]] == true
- draw_icon(BIRTHDAY_STATUS_ICON, 32, 130, enabled = true)
- draw_birthday_string(80, 130)
- end
- end
- end
- end
- ################################################################################
- # SCENE BASE
- ################################################################################
- class Scene_Base
- include Steps_Calender
- alias sc_sb_create_menu_background create_menu_background unless $@
- def create_menu_background
- if $scene.is_a?(Scene_Clock)
- @menuback_sprite = Sprite.new
- @menuback_sprite.bitmap = Cache.system(CLOCK_IMAGE)
- elsif $scene.is_a?(Scene_LifeSpan)
- @menuback_sprite = Sprite.new
- @menuback_sprite.bitmap = Cache.system(LIFESPAN_BACK)
- elsif $scene.is_a?(Scene_Calender)
- @menuback_sprite = Sprite.new
- if USE_SEASONS == true
- unless SEASONS.empty?
- seasons = SEASONS.keys
- for i in seasons
- if $game_switches[SEASONS[i][4]] == true
- @menuback_sprite.bitmap = Cache.system(SEASONS[i][5])
- end
- end
- end
- else
- @menuback_sprite.bitmap = Cache.system(CALENDER_BACK)
- end
- else
- sc_sb_create_menu_background
- end
- end
- end
- ################################################################################
- # SCENE TITLE
- ################################################################################
- class Scene_Title < Scene_Base
- alias sc_st_create_game_objects create_game_objects
- def create_game_objects
- sc_st_create_game_objects
- $game_calender = Game_Calender.new
- end
- end
- ################################################################################
- # SCENE MENU
- ################################################################################
- class Scene_Menu < Scene_Base
- include Steps_Calender
- #-----------------------------------------------------------------------------
- # Create_Command_Window (Aliased)
- #-----------------------------------------------------------------------------
- alias sc_sm_create_command_window create_command_window unless $@
- def create_command_window
- if MENU_CALENDER == true
- s1 = Vocab::item
- s2 = Vocab::skill
- s3 = Vocab::equip
- s4 = Vocab::status
- s5 = "Calender"
- s6 = Vocab::save
- s7 = Vocab::game_end
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
- @command_window.index = @menu_index
- if $game_party.members == 0
- @command_window.draw_item(0, false)
- @command_window.draw_item(1, false)
- @command_window.draw_item(2, false)
- @command_window.draw_item(3, false)
- end
- if $game_system.save_disabled
- @command_window.draw_item(4, false)
- end
- else
- sc_sm_create_command_window
- end
- end
- #-----------------------------------------------------------------------------
- # Update Command Selection (Aliased)
- #-----------------------------------------------------------------------------
- alias sc_sm_update_command_selection update_command_selection unless $@
- def update_command_selection
- if MENU_CALENDER == true
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- if $game_party.members.size == 0 and @command_window.index < 4
- Sound.play_buzzer
- return
- elsif $game_system.save_disabled and @command_window.index == 5
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- case @command_window.index
- when 0 # Item
- $scene = Scene_Item.new
- when 1,2,3 # Skill, equipment, status
- start_actor_selection
- when 4 #Calender
- $scene = Scene_Calender.new(true)
- when 5 # Save
- $scene = Scene_File.new(true, false, false)
- when 6 # End Game
- $scene = Scene_End.new
- end
- end
- else
- sc_sm_update_command_selection
- end
- end
- end
- ################################################################################
- # SCENE FILE
- ################################################################################
- class Scene_File < Scene_Base
- alias sc_sf_write_save_data write_save_data
- def write_save_data(file)
- sc_sf_write_save_data(file)
- Marshal.dump($game_calender, file)
- end
- alias sc_sf_read_save_data read_save_data
- def read_save_data(file)
- $game_calender = Marshal.load(file)
- sc_sf_read_save_data(file)
- end
- end
- ################################################################################
- # WINDOW QUICK INFO
- ################################################################################
- class Window_Quickfo < Window_Base
- def initialize(string)
- super(150, 160, 260, 90)
- @string = string
- refresh
- end
- def refresh
- self.contents.font.color = system_color
- self.contents.draw_text(4, 10, self.width, WLH, @string)
- end
- end
- ################################################################################
- # WINDOW BIRTHDAY BANNER
- ################################################################################
- class Window_Birthday_Banner < Window_Base
- def initialize
- super(141, 0, 400, 80)
- refresh
- end
- def refresh
- self.contents.font.color = system_color
- self.contents.draw_text((544 - 400) / 2, 10, self.width, WLH, "Choose your birthday")
- end
- end
- ################################################################################
- # WINDOW ACTOR INFO
- ################################################################################
- class Window_Actor_Info < Window_Base
- include Steps_Calender
- def initialize
- super(0, 0, 120, 160)
- @actor = $game_actors[$game_variables[ACTOR_FACE_VARIABLE]]
- refresh
- end
- def refresh
- draw_actor_face(@actor, 0, 0)
- self.contents.font.color = text_color(ACTOR_NAME_COLOR)
- self.contents.draw_text(0, 96, self.width, WLH, @actor.name)
- end
- end
- ################################################################################
- # WINDOW BIRTHDAY CONFIRM
- ################################################################################
- class Window_Confirm < Window_Selectable
- def initialize
- super(200, 180, 140, 90)
- @item_max = 2
- @column_max = 1
- @items_number = []
- @items_number[0] = "Confirm"
- @items_number[1] = "Cancel"
- self.index = 0
- refresh
- end
- def refresh
- create_contents
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.width, WLH, @items_number[0])
- self.contents.draw_text(0, WLH, self.width, WLH, @items_number[1])
- end
- end
- ################################################################################
- # WINDOW BIRTHDAY STATUS
- ################################################################################
- class Window_BD_Status < Window_Selectable
- include Steps_Calender
- attr_accessor :month
- attr_accessor :day
- def initialize
- super(141, 81, 400, 80)
- @month = 1
- @day = 1
- @item_max = 2
- @column_max = 1
- @items_number = []
- @items_number[0] = "Change " + MONTH_STRING + " "
- @items_number[1] = "Change " + DAY_STRING + " "
- self.index = 0
- refresh
- end
- #-------------------------------------------------------------------------------
- # Refresh
- #-------------------------------------------------------------------------------
- def refresh
- create_contents
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.width, WLH, @items_number[0] + MONTHS[@month])
- self.contents.draw_text(0, WLH, self.width, WLH, @items_number[1] + @day.to_s)
- end
- #-----------------------------------------------------------------------------
- # Add Month
- #-----------------------------------------------------------------------------
- def add_month(max)
- if @month == max
- @month = 1
- else
- @month += 1
- end
- end
- #-----------------------------------------------------------------------------
- # Subtract Month
- #-----------------------------------------------------------------------------
- def subtract_month(max)
- if @month == 1
- @month = max
- else
- @month -= 1
- end
- end
- #-----------------------------------------------------------------------------
- # Add Day
- #-----------------------------------------------------------------------------
- def add_day(max)
- if @day == max
- @day = 1
- else
- @day += 1
- end
- end
- #-----------------------------------------------------------------------------
- # Subtract Day
- #-----------------------------------------------------------------------------
- def subtract_day(max)
- if @day == 1
- @day = max
- else
- @day -= 1
- end
- end
- end
- ################################################################################
- # SCENE BIRTHDAY
- ################################################################################
- class Scene_Birthday < Scene_Base
- include Steps_Calender
- def start
- super
- if $game_variables[ACTOR_FACE_VARIABLE] == 0
- $game_variables[ACTOR_FACE_VARIABLE] = 1
- end
- @actor = $game_actors[$game_variables[ACTOR_FACE_VARIABLE]]
- @banner_window = Window_Birthday_Banner.new
- @actor_window = Window_Actor_Info.new
- @birthday_window = Window_BD_Status.new
- @birthday_window.active = true
- @month_max = YEAR_MONTHS
- @day_max = MONTH_DAYS
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- super
- @actor_window.refresh
- if @birthday_window.active == true
- @birthday_window.update
- if Input.trigger?(Input::RIGHT)
- if @birthday_window.index == 0
- Sound.play_cursor
- @birthday_window.add_month(@month_max)
- @birthday_window.refresh
- elsif @birthday_window.index == 1
- Sound.play_cursor
- @birthday_window.add_day(@day_max)
- @birthday_window.refresh
- end
- elsif Input.trigger?(Input::LEFT)
- if @birthday_window.index == 0
- Sound.play_cursor
- @birthday_window.subtract_month(@month_max)
- @birthday_window.refresh
- elsif @birthday_window.index == 1
- Sound.play_cursor
- @birthday_window.subtract_day(@day_max)
- @birthday_window.refresh
- end
- elsif Input.trigger?(Input::B)
- Sound.play_buzzer
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- $game_temp.birthday_month = @birthday_window.month
- $game_temp.birthday_day = @birthday_window.day
- $game_temp.birthday_actor_id = @actor.id
- @confirm_window = Window_Confirm.new
- @confirm_window.active = true
- @birthday_window.active = false
- end
- elsif @confirm_window.active == true
- @confirm_window.update
- @confirm_window.refresh
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @birthday_window.active = true
- @confirm_window.active = false
- @confirm_window.dispose
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- if @confirm_window.index == 0
- Sound.play_decision
- $game_actors[@actor.id].set_birthday($game_temp.birthday_month, $game_temp.birthday_day)
- $scene = Scene_Map.new
- elsif @confirm_window.index == 1
- Sound.play_cancel
- @birthday_window.active = true
- @confirm_window.active = false
- @confirm_window.dispose
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Terminate
- #-----------------------------------------------------------------------------
- def terminate
- @banner_window.dispose
- @actor_window.dispose
- @birthday_window.dispose
- @confirm_window.dispose
- end
- end
- ################################################################################
- # WINDOW_LIFESPAN
- ################################################################################
- class Window_LifeSpan < Window_Base
- include Steps_Calender
- def initialize(actor_id)
- super(0, 0, 544, 416)
- @actor = $game_actors[actor_id]
- @lsy = @actor.lifespan_years
- @lsm = @actor.lifespan_months
- @lsd = @actor.lifespan_days
- self.opacity = LS_OPACITY
- self.windowskin = Cache.system(LS_WINDOWSKIN)
- refresh
- end
- def refresh
- draw_actor_face(@actor, 12, 12)
- self.contents.font.color = text_color(ACTOR_NAME_COLOR)
- draw_actor_name(@actor, 12, 108)
- self.contents.font.color = text_color(LS_BANNERTEXT_COLOR)
- self.contents.font.size = LS_BANNERTEXT_SIZE
- self.contents.draw_text(218, 112, self.width, LS_BANNERTEXT_SIZE, LS_HEADING)
- self.contents.font.color = text_color(LS_SYSTEMTEXT_COLOR)
- self.contents.font.size = WLH
- self.contents.draw_text(218, (112 + LS_BANNERTEXT_SIZE) + 6, self.width, WLH, LS_YEARS_STRING)
- self.contents.draw_text(218, WLH + 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, LS_MONTHS_STRING)
- self.contents.draw_text(218, ((WLH * 2) + 112) + LS_BANNERTEXT_SIZE + 6, self.width, WLH, LS_DAYS_STRING)
- self.contents.font.color = normal_color
- self.contents.draw_text(218 + (LS_YEARS_STRING.length * 12), 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, @lsy.to_s)
- self.contents.draw_text(218 + (LS_MONTHS_STRING.length * 12), WLH + 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, @lsm.to_s)
- self.contents.draw_text(218 + (LS_DAYS_STRING.length * 12), (WLH * 2) + 112 + LS_BANNERTEXT_SIZE + 6, self.width, WLH, @lsd.to_s)
- end
- end
- ################################################################################
- # SCENE_LIFESPAN
- ################################################################################
- class Scene_LifeSpan < Scene_Base
- include Steps_Calender
- def initialize(actor_id)
- @id = actor_id
- end
- def start
- super
- create_menu_background
- @ls_window = Window_LifeSpan.new(@id)
- end
- def update
- super
- if Input.trigger?(Input::C)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- end
- end
- def terminate
- dispose_menu_background
- @ls_window.dispose
- end
- end
- ################################################################################
- # WINDOW_CLOCK
- ################################################################################
- class Window_Clock < Window_Base
- include Steps_Calender
- def initialize
- super(0, 0, 544, 416)
- self.windowskin = Cache.system(CLOCK_WINDOWSKIN)
- self.opacity = CLOCK_OPACITY
- refresh
- end
- def refresh
- self.contents.font.size = CLOCK_SIZE
- self.contents.font.color = text_color(CLOCK_COLOR)
- pointx = (544 / 3) + 20
- pointy = 112
- self.contents.draw_text(pointx, pointy, self.width, CLOCK_SIZE, CLOCK_HEADING)
- self.contents.font.size = WLH
- self.contents.font.color = system_color
- self.contents.draw_text(pointx, pointy + CLOCK_SIZE, self.width, WLH, HOUR_STRING + " ")
- self.contents.font.color = normal_color
- if $game_calender.hoursteps < 10
- self.contents.draw_text(pointx + (HOUR_STRING.length * 12), pointy + CLOCK_SIZE, self.width, WLH, $game_calender.hour.to_s + ":0" + $game_calender.hoursteps.to_s)
- else
- self.contents.draw_text(pointx + (HOUR_STRING.length * 12), pointy + CLOCK_SIZE, self.width, WLH, $game_calender.hour.to_s + ":" + $game_calender.hoursteps.to_s)
- end
- end
- end
- ################################################################################
- # SCENE_CLOCK
- ################################################################################
- class Scene_Clock < Scene_Base
- include Steps_Calender
- def start
- super
- create_menu_background
- @clock_window = Window_Clock.new
- end
- def update
- super
- if Input.trigger?(Input::C)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- end
- end
- def terminate
- dispose_menu_background
- @clock_window.dispose
- end
- end
- ################################################################################
- # WINDOW_CALENDER
- ################################################################################
- class Window_Calender < Window_Base
- include Steps_Calender
- def initialize
- super(0, 0, 544, 416)
- self.windowskin = Cache.system(CALENDER_WINDOWSKIN)
- self.opacity = CALENDER_OPACITY
- refresh
- end
- def refresh
- pointx = 544 / 4
- pointy = 416 / 4
- chs = CALENDER_HEADING_SIZE
- cts = CALENDER_TEXT_SIZE
- self.contents.clear
- self.contents.font.size = chs
- self.contents.font.color = text_color(CALENDER_HEADING_COLOR)
- self.contents.draw_text(pointx, pointy, self.width, chs, CALENDER_HEADING)
- self.contents.font.size = cts
- self.contents.font.color = text_color(CALENDER_STRING_COLOR)
- self.contents.draw_text(pointx, pointy + chs, self.width, cts, YEAR_STRING)
- self.contents.draw_text(pointx, pointy + chs + cts, self.width, cts, MONTH_STRING)
- self.contents.draw_text(pointx, pointy + chs + (cts * 2), self.width, cts, DAY_STRING)
- self.contents.draw_text(pointx, pointy + chs + (cts * 3), self.width, cts, HOUR_STRING)
- self.contents.font.color = text_color(CALENDER_VALUES_COLOR)
- yst = YEAR_STRING.length * 12
- mst = MONTH_STRING.length * 12
- dst = DAY_STRING.length * 12
- hst = HOUR_STRING.length * 12
- self.contents.draw_text(pointx + yst + mst, pointy + chs, self.width, cts, $game_calender.year.to_s)
- self.contents.draw_text(pointx + yst + mst, pointy + chs + cts, self.width, cts, MONTHS[$game_calender.month])
- self.contents.draw_text(pointx + yst + mst, pointy + chs + (cts * 2), self.width, cts, $game_calender.day.to_s)
- if $game_calender.hoursteps < 10
- self.contents.draw_text(pointx + yst + mst, pointy + chs + (cts * 3), self.width, cts, $game_calender.hour.to_s + ":0" + $game_calender.hoursteps.to_s)
- else
- self.contents.draw_text(pointx + yst + mst, pointy + chs + (cts * 3), self.width, cts, $game_calender.hour.to_s + ":" + $game_calender.hoursteps.to_s)
- end
- end
- end
- ################################################################################
- # Window_Optional
- ################################################################################
- class Window_Optional < Window_Base
- include Steps_Calender
- def initialize(placement, identity)
- @identity = identity
- case placement
- when 0
- super(0, 0, 140, 120)
- when 1
- super(400, 0, 140, 120)
- when 2
- super(0, 296, 140, 120)
- when 3
- super(400, 296, 140, 120)
- end
- self.opacity = CALENDER_OPACITY
- refresh
- end
- def refresh
- self.contents.font.size = 24
- self.contents.font.color = text_color(OPTIONAL_COLOR)
- case @identity
- when 1
- self.contents.draw_text(0, 0, self.width, 24, BIRTHDAY_STRING)
- self.contents.font.color = normal_color
- strings = []
- bswitches = BIRTHDAY_SWITCHES.keys
- for i in bswitches
- if $game_switches[i] == true
- strings.push($game_actors[i].name)
- end
- end
- unless strings.empty?
- for string in strings
- x = 0
- y = 24
- self.contents.draw_text(x, y, self.width, WLH, string)
- y += WLH
- end
- end
- when 2
- self.contents.draw_text(0, 0, self.width, 24, HOLIDAY_STRING)
- self.contents.font.color = normal_color
- if $game_calender.holiday != nil
- x = 0
- y = 24
- self.contents.draw_text(x, y, self.width, WLH, $game_calender.holiday.to_s)
- end
- when 3
- self.contents.draw_text(0, 0, self.width, 24, SEASON_STRING)
- self.contents.font.color = normal_color
- if $game_calender.season != nil
- x = 0
- y = 24
- self.contents.draw_text(x, y, self.width, WLH, $game_calender.season.to_s)
- end
- when 4
- self.contents.draw_text(0, 0, self.width, 24, SEGMENT_STRING)
- self.contents.font.color = normal_color
- if $game_calender.segment != nil
- x = 0
- y = 24
- self.contents.draw_text(x, y, self.width, WLH, $game_calender.segment.to_s)
- end
- end
- end
- end
- ################################################################################
- # SCENE CALENDER
- ################################################################################
- class Scene_Calender < Scene_Base
- include Steps_Calender
- def initialize(from_menu = false)
- @from_menu = from_menu
- end
- def start
- super
- create_menu_background
- @calender_window = Window_Calender.new
- determine_optional_alignment
- end
- #-----------------------------------------------------------------------------
- # Determnine Optional Alignment
- #-----------------------------------------------------------------------------
- def determine_optional_alignment
- unless OPTIONAL_ALIGNMENT.empty?
- if USE_BIRTHDAYS == true
- if OPTIONAL_ALIGNMENT.include?(1)
- @placement = OPTIONAL_ALIGNMENT.index(1)
- @bd_window = Window_Optional.new(@placement, 1)
- end
- end
- if USE_HOLIDAYS == true
- if OPTIONAL_ALIGNMENT.include?(2)
- @placement = OPTIONAL_ALIGNMENT.index(2)
- @hd_window = Window_Optional.new(@placement, 2)
- end
- end
- if USE_SEASONS == true
- if OPTIONAL_ALIGNMENT.include?(3)
- @placement = OPTIONAL_ALIGNMENT.index(3)
- @ss_window = Window_Optional.new(@placement, 3)
- end
- end
- if USE_DAY_SEGMENTS == true
- if OPTIONAL_ALIGNMENT.include?(4)
- @placement = OPTIONAL_ALIGNMENT.index(4)
- @seg_window = Window_Optional.new(@placement, 4)
- end
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- def update
- super
- if Input.trigger?(Input::C)
- Sound.play_cancel
- if @from_menu == true
- $scene = Scene_Menu.new(4)
- else
- $scene = Scene_Map.new
- end
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- if @from_menu == true
- $scene = Scene_Menu.new(4)
- else
- $scene = Scene_Map.new
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Terminate
- #-----------------------------------------------------------------------------
- def terminate
- dispose_menu_background
- @calender_window.dispose
- unless OPTIONAL_ALIGNMENT.empty?
- if USE_BIRTHDAYS == true
- if OPTIONAL_ALIGNMENT.include?(1)
- @bd_window.dispose
- end
- end
- if USE_HOLIDAYS == true
- if OPTIONAL_ALIGNMENT.include?(2)
- @hd_window.dispose
- end
- end
- if USE_SEASONS == true
- if OPTIONAL_ALIGNMENT.include?(3)
- @ss_window.dispose
- end
- end
- if USE_DAY_SEGMENTS == true
- if OPTIONAL_ALIGNMENT.include?(4)
- @seg_window.dispose
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement