Страница 3 из 190 ПерваяПервая 123451353103 ... ПоследняяПоследняя
Показано с 21 по 30 из 1899

Тема: Поиск скриптов

  1. #21

    По умолчанию

    Если найдешь на XP - давай на XP, перепишу под VX.
    В общем то да, надо. Если сможешь закомментить по строчкам на русском - хвала тебе.

    Спойлер KGC:
    Код:
    #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    #_/    ◆ 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
      ]  # ← Do not delete PHASE!
    
      # If you want a more realistic tone for your real-time setting...
      #  ["noon",   Tone.new(  0,   0,   0), 16],  # Phase 0
      #  ["evening", Tone.new(  0, -96, -96), 20],  # Phase 1
      #  ["night",   Tone.new(-96, -96, -64),  6],  # Phase 2
      #  ["morning",   Tone.new(-48, -48, -16), 10],  # Phase 3
      # ...is an alternative to your tones.
    
      # ◆ The phase where the day changes.
      #  When the appointed phase comes into play, a new day is started.
      #  The default settings are as follows:
      #  0 - noon
      #  1 - evening
      #  2 - night
      #  3 - morning
      # ※ If using actual time, keep in mind that this script cannot
      #    keep track of the actual days.
      PASS_DAY_PHASE = 3
    
      # ◆ Fade time between phases in frames.
      #  60 frames is the default used.
      PHASE_DURATION = 60
    
      # ◆ Day of the week name.
      #  Starts from the first day, goes to the last day, then loops.
      #  The name of the day has no significance to how the script
      #  performs, so name them as you wish.
      # ※ When actual time is used, make sure to use 7 days.
      WEEK_NAME = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
    end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    $imported = {} if $imported == nil
    $imported["DayNight"] = true
    
    if $data_mapinfos == nil
      $data_mapinfos = load_data("Data/MapInfos.rvdata")
    end
    
    module KGC::DayNight
      METHOD_TIME  = 0  # Elapsed Time
      METHOD_STEP  = 1  # Number of Steps
      METHOD_RTIME = 2  # Real-time
    
      # Regular Expression
      module Regexp
        # Map Information
        module MapInfo
          # Stop transition
          DAYNIGHT_STOP = /\[DN_STOP\]/i
          # Disable night/day effect.
          DAYNIGHT_VOID = /\[DN_VOID\]/i
        end
    
        # Enemy Group
        module Troop
          # Appearance in phase
          APPEAR_PHASE = /\[DN((?:[ ]*[\-]?\d+(?:[ ]*,)?)+)\]/i
        end
      end
    
      #--------------------------------------------------------------------------
      # ○ Enemy group appearance.
      #     troop : decide per troup
      #     phase : decide per phase
      #--------------------------------------------------------------------------
      def self.troop_appear?(troop, phase = $game_system.daynight_phase)
        # Appearance decision.
        unless troop.appear_daynight_phase.empty?
          return false unless troop.appear_daynight_phase.include?(phase)
        end
        # Non-Appearance decision.
        unless troop.nonappear_daynight_phase.empty?
          return false if troop.nonappear_daynight_phase.include?(phase)
        end
    
        return true
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # □ KGC::Commands
    #==============================================================================
    
    module KGC::Commands
      module_function
      #--------------------------------------------------------------------------
      # ○ Stopping day/night change.
      #--------------------------------------------------------------------------
      def stop_daynight
        $game_system.daynight_change_enabled = false
      end
      #--------------------------------------------------------------------------
      # ○ Starting day/night change.
      #--------------------------------------------------------------------------
      def start_daynight
        $game_system.daynight_change_enabled = true
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring present phase name.
      #--------------------------------------------------------------------------
      def get_daynight_name
        return KGC::DayNight::PHASE[get_daynight_phase][0]
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring present day of the week.
      #     variable_id : the ID of the variable it replaces.
      #--------------------------------------------------------------------------
      def get_daynight_week(variable_id = 0)
        if KGC::DayNight::METHOD == KGC::DayNight::METHOD_RTIME
          week = Time.now.wday
        else
          days = $game_variables[KGC::DayNight::PASS_DAYS_VARIABLE]
          week = (days % KGC::DayNight::WEEK_NAME.size)
        end
    
        if variable_id > 0
          $game_variables[variable_id] = week
        end
        return week
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring the name of the present day of the week.
      #--------------------------------------------------------------------------
      def get_daynight_week_name
        return KGC::DayNight::WEEK_NAME[get_daynight_week]
      end
      #--------------------------------------------------------------------------
      # ○ Phase Change
      #     phase     : the phase after phase transition.
      #     duration  : time in frames for phase transition
      #     pass_days : the days that have elapsed initially  (Default: 0)
      #--------------------------------------------------------------------------
      def change_daynight_phase(phase,
          duration = KGC::DayNight::PHASE_DURATION,
          pass_days = 0)
        $game_temp.manual_daynight_duration = duration
        $game_system.daynight_counter = 0
        $game_system.daynight_phase = phase
        $game_variables[KGC::DayNight::PASS_DAYS_VARIABLE] += pass_days
      end
      #--------------------------------------------------------------------------
      # ○ Transitioning to the next phase.
      #     duration : time in frames for phase transition
      #--------------------------------------------------------------------------
      def transit_daynight_phase(duration = KGC::DayNight::PHASE_DURATION)
        $game_screen.transit_daynight_phase(duration)
      end
      #--------------------------------------------------------------------------
      # ○ Reseting the color tone to default.
      #     duration : time in frames for transition
      #--------------------------------------------------------------------------
      def set_daynight_default(duration = KGC::DayNight::PHASE_DURATION)
        $game_screen.set_daynight_default(duration)
      end
      #--------------------------------------------------------------------------
      # ○ Re-creating present phase.
      #     duration : time in frames for transition
      #--------------------------------------------------------------------------
      def restore_daynight_phase(duration = KGC::DayNight::PHASE_DURATION)
        $game_screen.restore_daynight_phase(duration)
      end
    end
    
    class Game_Interpreter
      include KGC::Commands
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ RPG::MapInfo
    #==============================================================================
    
    class RPG::MapInfo
      #--------------------------------------------------------------------------
      # ● Acquiring Map Name
      #--------------------------------------------------------------------------
      def name
        return @name.gsub(/\[.*\]/) { "" }
      end
      #--------------------------------------------------------------------------
      # ○ Acquring Original Map Name
      #--------------------------------------------------------------------------
      def original_name
        return @name
      end
      #--------------------------------------------------------------------------
      # ○ Stopping Day/Night change.
      #--------------------------------------------------------------------------
      def daynight_stop
        return @name =~ KGC::DayNight::Regexp::MapInfo::DAYNIGHT_STOP
      end
      #--------------------------------------------------------------------------
      # ○ Turning off Day/Night effect.
      #--------------------------------------------------------------------------
      def daynight_void
        return @name =~ KGC::DayNight::Regexp::MapInfo::DAYNIGHT_VOID
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ RPG::Area
    #==============================================================================
    
    unless $@
    class RPG::Area
      #--------------------------------------------------------------------------
      # ○ Acquiring Encounter List
      #--------------------------------------------------------------------------
      alias encounter_list_KGC_DayNight encounter_list
      def encounter_list
        list = encounter_list_KGC_DayNight.clone
    
        # Appearance conditional choice.
        list.each_index { |i|
          list[i] = nil unless KGC::DayNight.troop_appear?($data_troops[list[i]])
        }
        return list.compact
      end
    end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ RPG::Troop
    #==============================================================================
    
    class RPG::Troop
      #--------------------------------------------------------------------------
      # ○ Cache formation of day/night change.
      #--------------------------------------------------------------------------
      def create_daynight_cache
        @__appear_daynight_phase = []
        @__nonappear_daynight_phase = []
    
        # Phase Appearance
        if @name =~ KGC::DayNight::Regexp::Troop::APPEAR_PHASE
          $1.scan(/[\-]?\d+/).each { |num|
            phase = num.to_i
            if phase < 0
              # If the phase doesn't appear
              @__nonappear_daynight_phase << phase.abs
            else
              # If the phase does appear
              @__appear_daynight_phase << phase
            end
          }
        end
      end
      #--------------------------------------------------------------------------
      # ○ Phase Appearance
      #--------------------------------------------------------------------------
      def appear_daynight_phase
        create_daynight_cache if @__appear_daynight_phase == nil
        return @__appear_daynight_phase
      end
      #--------------------------------------------------------------------------
      # ○ Phase Non-Appearance
      #--------------------------------------------------------------------------
      def nonappear_daynight_phase
        create_daynight_cache if @__nonappear_daynight_phase == nil
        return @__nonappear_daynight_phase
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Game_Temp
    #==============================================================================
    
    class Game_Temp
      #--------------------------------------------------------------------------
      # ● Open instance variable
      #--------------------------------------------------------------------------
      attr_accessor :manual_daynight_duration # Manual phase modification flag
      #--------------------------------------------------------------------------
      # ● Object initialization
      #--------------------------------------------------------------------------
      alias initialize_KGC_DayNight initialize
      def initialize
        initialize_KGC_DayNight
    
        @manual_daynight_duration = nil
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Game_System
    #==============================================================================
    
    class Game_System
      #--------------------------------------------------------------------------
      # ● Open instance variable
      #--------------------------------------------------------------------------
      attr_writer   :daynight_counter         # Phase transition counter
      attr_writer   :daynight_change_enabled  # Day and night change validation
      #--------------------------------------------------------------------------
      # ● Object initialization
      #--------------------------------------------------------------------------
      alias initialize_KGC_DayNight initialize
      def initialize
        initialize_KGC_DayNight
    
        @daynight_counter = 0
        @daynight_change_enabled = true
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring the phase transition counter
      #--------------------------------------------------------------------------
      def daynight_counter
        @daynight_counter = 0 if @daynight_counter == nil
        return @daynight_counter
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring present phase
      #--------------------------------------------------------------------------
      def daynight_phase
        return $game_variables[KGC::DayNight::PHASE_VARIABLE]
      end
      #--------------------------------------------------------------------------
      # ○ Modifying present phase
      #--------------------------------------------------------------------------
      def daynight_phase=(value)
        $game_variables[KGC::DayNight::PHASE_VARIABLE] = value
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring the day and night change effective flag
      #--------------------------------------------------------------------------
      def daynight_change_enabled
        @daynight_change_enabled = 0 if @daynight_change_enabled == nil
        return @daynight_change_enabled
      end
      #--------------------------------------------------------------------------
      # ○ Phase advance
      #--------------------------------------------------------------------------
      def progress_daynight_phase
        self.daynight_phase += 1
        if self.daynight_phase >= KGC::DayNight::PHASE.size
          self.daynight_phase = 0
        end
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring present phase object
      #--------------------------------------------------------------------------
      def daynight_phase_object
        return KGC::DayNight::PHASE[daynight_phase]
      end
      #--------------------------------------------------------------------------
      # ○ Acquiring previous phase object
      #--------------------------------------------------------------------------
      def previous_daynight_phase_object
        return KGC::DayNight::PHASE[daynight_phase - 1]
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Game_Screen
    #==============================================================================
    
    class Game_Screen
      #--------------------------------------------------------------------------
      # ● Open instance variable
      #--------------------------------------------------------------------------
      attr_reader   :daynight_tone            # Color tone of day and night
      #--------------------------------------------------------------------------
      # ● Clear
      #--------------------------------------------------------------------------
      alias clear_KGC_DayNight clear
      def clear
        clear_KGC_DayNight
    
        clear_daynight
      end
      #--------------------------------------------------------------------------
      # ○ Clearing the variable for day and night change
      #--------------------------------------------------------------------------
      def clear_daynight
        @default_tone = Tone.new(0, 0, 0)
    
        # Coordinate initialization for movement decision
        @daynight_x = 0
        @daynight_y = 0
    
        # Count initialization for frame renewal
        @frame_count = Graphics.frame_count
        @daynight_tone_duration = 0
    
        apply_daynight
      end
      #--------------------------------------------------------------------------
      # ○ Applying the color tone of day and night
      #--------------------------------------------------------------------------
      def apply_daynight
        return if $game_map == nil
    
        # In the case of a map with day/night changes disabled
        if $game_map.daynight_void?
          if @daynight_tone_changed
            # You reset to the default color tone
            @tone = @default_tone.clone
            @daynight_tone_changed = false
          end
          @daynight_tone = @tone.clone
          return
        end
    
        # If phase isn't correct, restore default
        if $game_system.daynight_phase_object == nil
          $game_system.daynight_phase = 0
        end
    
        # Applying the present color tone
        @tone = $game_system.daynight_phase_object[1].clone
        @daynight_tone = @tone.clone
    
        # In case of real-time transition
        if KGC::DayNight::METHOD == KGC::DayNight::METHOD_RTIME
          time = Time.now
          # Transition to the correct phase
          KGC::DayNight::PHASE.each_with_index { |phase, i|
            if phase[2] <= time.hour
              start_tone_change(phase[1], 1)
              $game_system.daynight_phase = i
              break
            end
          }
        end
    
        @daynight_tone_changed = true
      end
      #--------------------------------------------------------------------------
      # ○ Acquisition of color tone
      #--------------------------------------------------------------------------
      def tone
        if $game_temp.in_battle && KGC::DayNight::TONE_BACK_ONLY_IN_BATTLE
          return @default_tone
        else
          return @tone
        end
      end
      #--------------------------------------------------------------------------
      # ● Start of color tone modification
      #     tone     : Color tone
      #     duration : Transition time
      #--------------------------------------------------------------------------
      alias start_tone_change_KGC_DayNight start_tone_change
      def start_tone_change(tone, duration)
        duration = [duration, 1].max
        start_tone_change_KGC_DayNight(tone, duration)
    
        @daynight_tone_target = tone.clone
        @daynight_tone_duration = duration
      end
      #--------------------------------------------------------------------------
      # ● Frame update
      #--------------------------------------------------------------------------
      alias update_KGC_DayNight update
      def update
        update_KGC_DayNight
    
        update_daynight_transit
      end
      #--------------------------------------------------------------------------
      # ● Color tone update
      #--------------------------------------------------------------------------
      alias update_tone_KGC_DayNight update_tone
      def update_tone
        update_tone_KGC_DayNight
    
        if @daynight_tone_duration >= 1
          d = @daynight_tone_duration
          target = @daynight_tone_target
          @daynight_tone.red = (@daynight_tone.red * (d - 1) + target.red) / d
          @daynight_tone.green = (@daynight_tone.green * (d - 1) + target.green) / d
          @daynight_tone.blue = (@daynight_tone.blue * (d - 1) + target.blue) / d
          @daynight_tone.gray = (@daynight_tone.gray * (d - 1) + target.gray) / d
          @daynight_tone_duration -= 1
        end
      end
      #--------------------------------------------------------------------------
      # ○ Phase transition update
      #--------------------------------------------------------------------------
      def update_daynight_transit
        # When manual change was done
        if $game_temp.manual_daynight_duration
          start_tone_change($game_system.daynight_phase_object[1],
            $game_temp.manual_daynight_duration)
          $game_temp.manual_daynight_duration = nil
          @daynight_tone_changed = true
        end
    
        return unless $game_system.daynight_change_enabled  # Replace current phase
        return if $game_map.daynight_stop?                  # In process of stopping
    
        if KGC::DayNight::STOP_ON_EVENT
          interpreter = ($game_temp.in_battle ? $game_troop.interpreter :
            $game_map.interpreter)
          return if interpreter.running?                    # event executing
        end
    
        case KGC::DayNight::METHOD
        when KGC::DayNight::METHOD_TIME   # Elapsed time
          update_daynight_pass_time
        when KGC::DayNight::METHOD_STEP   # Number of steps
          update_daynight_step
        when KGC::DayNight::METHOD_RTIME  # Real-time
          update_daynight_real_time
        end
      end
      #--------------------------------------------------------------------------
      # ○ Transition: Elapsed Time
      #--------------------------------------------------------------------------
      def update_daynight_pass_time
        # Count growth calculation
        inc_count = Graphics.frame_count - @frame_count
        # If the result is off, return.
        if inc_count >= 100
          @frame_count = Graphics.frame_count
          return
        end
        # Count addition
        $game_system.daynight_counter += inc_count
        @frame_count = Graphics.frame_count
    
        # State transition decision
        count = $game_system.daynight_counter / Graphics.frame_rate
        if count >= $game_system.daynight_phase_object[2]
          transit_daynight_next
        end
      end
      #--------------------------------------------------------------------------
      # ○ 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
      #--------------------------------------------------------------------------
      # ○ Transition: Real-time
      #--------------------------------------------------------------------------
      def update_daynight_real_time
        time = Time.now
        # State transition decision
        time1 = $game_system.daynight_phase_object[2]
        transit = (time1 <= time.hour)
        if $game_system.previous_daynight_phase_object != nil
          time2 = $game_system.previous_daynight_phase_object[2]
          if time1 < time2
            transit &= (time.hour < time2)
          end
        end
    
        if transit
          transit_daynight_next
        end
      end
      #--------------------------------------------------------------------------
      # ○ Transitioning to the next state
      #     duration : Transition duration
      #--------------------------------------------------------------------------
      def transit_daynight_next(duration = KGC::DayNight::PHASE_DURATION)
        $game_system.daynight_counter = 0
        $game_system.progress_daynight_phase
        # Days lapse decision
        if $game_system.daynight_phase == KGC::DayNight::PASS_DAY_PHASE
          $game_variables[KGC::DayNight::PASS_DAYS_VARIABLE] += 1
        end
        # Color tone change
        start_tone_change($game_system.daynight_phase_object[1], duration)
        @daynight_tone_changed = true
      end
      #--------------------------------------------------------------------------
      # ○ Default tone to fall back on (0, 0, 0)
      #     duration : Transition duration
      #--------------------------------------------------------------------------
      def set_daynight_default(duration)
        start_tone_change(@default_tone, duration)
      end
      #--------------------------------------------------------------------------
      # ○ Restoring present phase
      #     duration : Transition duration
      #--------------------------------------------------------------------------
      def restore_daynight_phase(duration)
        start_tone_change($game_system.daynight_phase_object[1], duration)
        @daynight_tone_changed = true
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Game_Map
    #==============================================================================
    
    class Game_Map
      #--------------------------------------------------------------------------
      # ● Setup
      #     map_id : Map ID
      #--------------------------------------------------------------------------
      alias setup_KGC_DayNight setup
      def setup(map_id)
        setup_KGC_DayNight(map_id)
    
        @screen.apply_daynight
      end
      #--------------------------------------------------------------------------
      # ○ Is day and night change stopped?
      #--------------------------------------------------------------------------
      def daynight_stop?
        info = $data_mapinfos[map_id]
        return false if info == nil
        return (info.daynight_stop || info.daynight_void)
      end
      #--------------------------------------------------------------------------
      # ○ Day and night change invalidity?
      #--------------------------------------------------------------------------
      def daynight_void?
        info = $data_mapinfos[map_id]
        return false if info == nil
        return info.daynight_void
      end
      #--------------------------------------------------------------------------
      # ● Acquisition of encounter list
      #--------------------------------------------------------------------------
      alias encounter_list_KGC_DayNight encounter_list
      def encounter_list
        list = encounter_list_KGC_DayNight.clone
    
        # Appearance of conditional decision
        list.each_index { |i|
          list[i] = nil unless KGC::DayNight.troop_appear?($data_troops[list[i]])
        }
        return list.compact
      end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Spriteset_Battle
    #==============================================================================
    
    if KGC::DayNight::TONE_BACK_ONLY_IN_BATTLE
    class Spriteset_Battle
      #--------------------------------------------------------------------------
      # ● Compilation of battleback sprite
      #--------------------------------------------------------------------------
      alias create_battleback_KGC_DayNight create_battleback
      def create_battleback
        create_battleback_KGC_DayNight
    
        if @battleback_sprite.wave_amp == 0
          @battleback_sprite.tone = $game_troop.screen.daynight_tone
        end
      end
      #--------------------------------------------------------------------------
      # ● Compilation of battle floor sprite
      #--------------------------------------------------------------------------
      alias create_battlefloor_KGC_DayNight create_battlefloor
      def create_battlefloor
        create_battlefloor_KGC_DayNight
    
        @battlefloor_sprite.tone = $game_troop.screen.daynight_tone
      end
    end
    end
    
    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
    
    #==============================================================================
    # ■ Scene_Map
    #==============================================================================
    
    class Scene_Map < Scene_Base
      #--------------------------------------------------------------------------
      # ● Start processing
      #--------------------------------------------------------------------------
      alias start_KGC_DayNight start
      def start
        $game_map.screen.clear_daynight
    
        start_KGC_DayNight
      end
    end

  2. #22
    Создатель Аватар для Рольф
    Информация о пользователе
    Регистрация
    14.04.2008
    Адрес
    Южно- Сахалинск/Пенза
    Сообщений
    10,081
    Записей в дневнике
    2
    Репутация: 108 Добавить или отнять репутацию

    По умолчанию

    Лови под xp. Когда закончу исправлять твой баг в другом скрипте, посмотрю для этого скрипта.
    http://ifolder.ru/6719395

  3. #23

    По умолчанию

    Ок, пасиб! ^_^

  4. #24
    Познающий Аватар для KARAKURT
    Информация о пользователе
    Регистрация
    11.05.2008
    Сообщений
    290
    Записей в дневнике
    5
    Репутация: 8 Добавить или отнять репутацию

    По умолчанию

    Нужен скрипт для воспроизведения видео в игре под платформу XP,
    либо, что не так с этим...
    Спойлер Скрипт:
    #================================================= =============================
    # ? MoviePlayer Module v0.5
    #------------------------------------------------------------------------------
    # By: dgam3z
    # Date: 18/10/04
    #================================================= =============================

    module MoviePlayer

    #--------------------------------------------------------------------------
    # ? The attr_acessor for those pretty functions this mod has.
    #-------------------------------------------------------------------------
    class<<self
    attr_accessor(:x,:y,:z,:width,:height,pacity)
    end

    #--------------------------------------------------------------------------
    # ? Initialize the constants.
    #-------------------------------------------------------------------------
    MULTIFILE = 1
    ONEFILE = 2

    #--------------------------------------------------------------------------
    # ? Initialize.
    #-------------------------------------------------------------------------

    @loaded = false

    #--------------------------------------------------------------------------
    # ? Loads the file(s).
    # In: name, frames, @loaded
    # Out: @rmm_name, @rmm_type, @rmm_width, @rmm_height, @loaded, @rmm_frames
    #-------------------------------------------------------------------------
    def self.load(name,frames=0)
    if not @loaded then
    #Checks if the movie is ONEFILE.
    if FileTest.exists?("Movies/"+name+".avi") then
    if frames != 0
    @rmm_frames = frames
    else
    if $DEBUG then print "Debug: Number of frames needed for this movie." end
    return 3 #Error 3: Need the number of frames.
    end

    @rmm = Sprite.new
    @rmm_name = name
    @rmm_type = ONEFILE
    @rmm_x = 0
    @rmm_y = 0
    @rmm_z = 4000
    @rmm_width = 0
    @rmm_height = 0
    @frame_counter = 0

    #Checks the size of the file.
    @rmm_width = Bitmap.new("Movies/"+@rmm_name+".png").width/@rmm_frames
    @rmm_height = Bitmap.new("Movies/"+@rmm_name+".png").height
    @loaded = true
    return 0 #No Errors: Everything wen't fine.
    end
    #Checks if the movie is MULTIFILE.
    if FileTest.exists?("Movies/"+name+"/"+name+"_0.png") then

    @rmm = Sprite.new
    @rmm_name = name
    @rmm_type = MULTIFILE
    @rmm_frames = 0
    @rmm_x = 0
    @rmm_y = 0
    @rmm_z = 4000
    @rmm_width = 0
    @rmm_height = 0
    @frame_counter = 0

    #Checks the size of the file.
    @rmm_width = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png").width
    @rmm_height = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png").height

    i = 0
    while FileTest.exist?("Movies/"+@rmm_name+"/"+@rmm_name+"_#{i}.png")
    i = i + 1
    end
    #And get the number of frames.
    @rmm_frames = i - 1
    @loaded = true
    return 0 #No Errors: Everything wen't fine.
    end
    if $DEBUG then print "Debug: File not found." end
    return 2 #Error 2: File not found.
    end
    if $DEBUG then print "Debug: Last movie not unloaded." end
    return 1 #Error 1: Needs to unload last movie first.
    end

    #--------------------------------------------------------------------------
    # ? Starts a movie.
    #-------------------------------------------------------------------------
    def self.start(trans=40)
    if not @loaded then
    if $DEBUG then print "Debug: Can't start, movie not loaded." end
    return 1 #Error 1: Not loaded.
    end

    Graphics.freeze

    if @rmm_type == ONEFILE then
    @rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+".png")
    @rmm.src_rect.set(@rmm_width*@frame_counter, 0, @rmm_width, @rmm_height)
    end

    if @rmm_type == MULTIFILE then
    @rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_0.png")
    @rmm.src_rect.set(0, 0, @rmm.bitmap.width, @rmm.bitmap.height)
    end

    @frame_counter = 1

    #Makes the transition.
    Graphics.transition(trans)
    end

    #--------------------------------------------------------------------------
    # ? Updates the movie. (changes to the next frame)
    #-------------------------------------------------------------------------
    def self.update
    if @loaded == true then
    if @rmm_type == ONEFILE then
    @rmm.src_rect.set(@rmm_width*@frame_counter, 0, @rmm_width, @rmm_height)
    end
    if @rmm_type == MULTIFILE then
    @rmm.bitmap = Bitmap.new("Movies/"+@rmm_name+"/"+@rmm_name+"_#{@frame_counter}.png")
    @rmm.src_rect.set(0, 0, @rmm.bitmap.width, @rmm.bitmap.height)
    end
    Graphics.update
    @frame_counter = @frame_counter + 1
    if @frame_counter == @rmm_frames
    @frame_counter = 0
    return true
    else
    return false
    end
    end
    end


    #--------------------------------------------------------------------------
    # ? Sets and retrieves the movie coordinates.
    #-------------------------------------------------------------------------
    def self.x; return @rmm.x; end
    def self.x=(tx); @rmm.x = tx; end
    def self.y; return @rmm.y; end
    def self.y=(ty); @rmm.y = ty; end
    def self.z; return @rmm.z; end
    def self.z=(tz); @rmm.z = tz; end

    #--------------------------------------------------------------------------
    # ? Retrieves the movie size.
    #-------------------------------------------------------------------------
    def self.width; return @rmm_width; end
    def self.height; return @rmm_height; end

    #--------------------------------------------------------------------------
    # ? Sets and retrieves the movie opacity.
    #-------------------------------------------------------------------------
    def self.opacity; return @rmm.opacity; end
    def self.opacity=(topacity); @rmm.opacity = topacity; end

    #--------------------------------------------------------------------------
    # ? Checks if a movie is loaded.
    #-------------------------------------------------------------------------
    def self.loaded?
    return @loaded
    end

    #--------------------------------------------------------------------------
    # ? Returns the in which frame is the movie now.
    #-------------------------------------------------------------------------
    def self.frame?
    if @loaded then
    return @frame_counter
    end
    end

    #--------------------------------------------------------------------------
    # ? Easy Definition to play movies (aka Newbie Definition).
    #-------------------------------------------------------------------------
    def self.play(movie, loops=1, wait=2, trans=0, x=nil, y=nil, z=4000, opacity=255)
    MoviePlayer.load(movie)
    if x != nil then MoviePlayer.x = x; else MoviePlayer.x = 320 - @rmm_width/2; end
    if y != nil then MoviePlayer.y = y; else MoviePlayer.y = 240 - @rmm_height/2; end
    MoviePlayer.z = z
    MoviePlayer.start(trans)
    for i in 1..loops
    begin
    for i in 0..wait
    Graphics.update
    end
    end while MoviePlayer.update == false
    end
    MoviePlayer.stop(trans)
    end

    #--------------------------------------------------------------------------
    # ? Stops and unloads the movie.
    #-------------------------------------------------------------------------
    def self.stop(trans=40)
    if not @loaded then
    if $DEBUG then print "Debug: Can't stop, movie not loaded." end
    return 1 #Error 1: Not loaded.
    end

    Graphics.freeze

    @rmm.bitmap.dispose

    @loaded = false

    #Makes the transition.
    Graphics.transition(trans)
    end
    end
    Последний раз редактировалось KARAKURT; 28.12.2008 в 14:18.

  5. #25

    По умолчанию

    1. Данный скрипт не умеет работать с .avi файлами. Не понятно зачем они там вообще упомянуты.
    2. Он умеет работать с последовательностью .png файлов. Их надо поместить в [папка проекта]\Movies\[название мувки]\
    С именами [название мувки]_i.png Где i - номер кадра, начиная с 0.

    Вот только работает он с ними криво - скорость воспроизведения ниже из-за притормаживание при смене кадров.

  6. #26
    Создатель Аватар для Рольф
    Информация о пользователе
    Регистрация
    14.04.2008
    Адрес
    Южно- Сахалинск/Пенза
    Сообщений
    10,081
    Записей в дневнике
    2
    Репутация: 108 Добавить или отнять репутацию

    По умолчанию

    Ты не прав, он умеет работать с avi, только надо соблюдать условия. Первое это качество, точно не знаю как это у видео файлов называться и размер. Точны условия не помню.

  7. #27

    По умолчанию

    Рольф
    Эм... ты пробовал?
    1. В каком месте скрипта он обращается к avi'шке? Я видел только одно - он проверил существует ли такой файл. Все. Далее он работал исключительно с png-файлами.
    2. Что касается условий, ну да - он треубует картинку с тем же названием, что бы снять с нее размеры видео, но, повторюсь, я не вижу - где он пытается хоть что-то сделать с avi'шкой.
    Возможно, он действительно не понял кодека, но я по прежнему не понимаю - как оно может работать.

  8. #28
    Создатель Аватар для Рольф
    Информация о пользователе
    Регистрация
    14.04.2008
    Адрес
    Южно- Сахалинск/Пенза
    Сообщений
    10,081
    Записей в дневнике
    2
    Репутация: 108 Добавить или отнять репутацию

    По умолчанию

    Если я говорю работает, значить я пробывал.

  9. #29
    Создатель Аватар для Рольф
    Информация о пользователе
    Регистрация
    14.04.2008
    Адрес
    Южно- Сахалинск/Пенза
    Сообщений
    10,081
    Записей в дневнике
    2
    Репутация: 108 Добавить или отнять репутацию

    По умолчанию

    Если я говорю работает, значить я пробывал.

  10. #30
    Познающий Аватар для KARAKURT
    Информация о пользователе
    Регистрация
    11.05.2008
    Сообщений
    290
    Записей в дневнике
    5
    Репутация: 8 Добавить или отнять репутацию

    По умолчанию

    Цитата Сообщение от Рольф Посмотреть сообщение
    Если я говорю работает, значить я пробывал.
    Я конечно понимаю тебя, но мне нужен результат.

    Люди помогите, очень надо.

Страница 3 из 190 ПерваяПервая 123451353103 ... ПоследняяПоследняя

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 12 (пользователей: 0 , гостей: 12)

Метки этой темы

Социальные закладки

Социальные закладки

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •  
Поиск скриптов