Страница 134 из 147 ПерваяПервая ... 3484124132133134135136144 ... ПоследняяПоследняя
Показано с 1,331 по 1,340 из 1470

Тема: Помощь с скриптами (RGSS)

  1. #1331

    По умолчанию

    вернуть Sprite.new ? ну или как вариант - записать в глобальную переменную и присваивать уже ее, как в регулярных выражениях $1

  2. #1332
    Маститый Аватар для HopeBree
    Информация о пользователе
    Регистрация
    27.03.2013
    Сообщений
    1,204
    Записей в дневнике
    6
    Репутация: 38 Добавить или отнять репутацию

    По умолчанию

    Спойлер VE - Core:
    PHP код:
    #==============================================================================
    # ** Victor Engine - Basic Module
    #------------------------------------------------------------------------------
    # Author : Victor Sant
    #
    # Version History:
    #  v 1.00 - 2011.12.19 > First release
    #  v 1.01 - 2011.12.21 > Added Event Troop notes
    #  v 1.02 - 2011.12.22 > Added character frames value
    #  v 1.03 - 2011.12.30 > Added Actor and Enemy notes
    #  v 1.04 - 2012.01.01 > Added party average level and map actors
    #  v 1.05 - 2012.01.04 > Compatibility with Characters Scripts
    #  v 1.06 - 2012.01.07 > Compatibility with Fog and Light Effect
    #                      > Added new Sprite Character functions
    #  v 1.07 - 2012.01.11 > Compatibility with Control Text and Codes
    #  v 1.08 - 2012.01.13 > Compatibility with Trait Control
    #  v 1.09 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
    #  v 1.10 - 2012.01.18 > Compatibility with Automatic Battlers
    #  v 1.11 - 2012.01.26 > Compatibility with Followers Options
    #                        Compatibility with Animated Battle beta
    #  v 1.12 - 2012.02.08 > Compatibility with Animated Battle
    #  v 1.13 - 2012.02.18 > Fix for non RTP dependant encrypted projects
    #  v 1.14 - 2012.03.11 > Better version handling and required messages
    #  v 1.15 - 2012.03.11 > Added level variable for enemies (to avoid crashes)
    #  v 1.16 - 2012.03.21 > Compatibility with Follower Control
    #  v 1.17 - 2012.03.22 > Compatibility with Follower Control new method
    #  v 1.18 - 2012.03.22 > Added Battler Types tag support 
    #  v 1.19 - 2012.05.20 > Compatibility with Map Turn Battle
    #  v 1.20 - 2012.05.21 > Fix for older RMVXa versions
    #  v 1.21 - 2012.05.29 > Compatibility with Pixel Movement
    #  v 1.22 - 2012.07.02 > Compatibility with Terrain States
    #  v 1.23 - 2012.07.03 > Fix for Pixel Movement
    #  v 1.24 - 2012.07.17 > Compatibility with Critical Hit Effects
    #  v 1.25 - 2012.07.24 > Compatibility with Moving Plaforms
    #  v 1.26 - 2012.07.30 > Compatibility with Automatic Battlers
    #  v 1.27 - 2012.08.01 > Compatibility with Custom Slip Effect
    #  v 1.28 - 2012.08.01 > Compatibility with Custom Slip Effect v 1.01
    #  v 1.29 - 2012.11.03 > Fixed returning value division by 0 error.
    #  v 1.30 - 2012.12.13 > Compatibility with State Graphics
    #  v 1.31 - 2012.12.16 > Compatibility with Active Time Battle
    #  v 1.32 - 2012.12.24 > Compatibility with Active Time Battle v 1.01
    #  v 1.33 - 2012.12.30 > Compatibility with Leap Attack
    #  v 1.34 - 2013.01.07 > Compatibility with Critical Hit Effects v 1.01
    #  v 1.35 - 2013.02.13 > Compatibility with Cooperation Skills
    #------------------------------------------------------------------------------
    #   This is the basic script for the system from Victory Engine and is
    # required to use the scripts from the engine. This script offer some new
    # functions to be used within many scripts of the engine.
    #------------------------------------------------------------------------------
    # Compatibility
    #   Required for the Victor Engine

    # * Overwrite methods
    #   class << Cache
    #     def self.character(filename)
    #
    #   class Sprite_Character < Sprite_Base
    #     def set_character_bitmap
    #
    #   class Game_Battler < Game_BattlerBase
    #     def item_effect_recover_hp(user, item, effect)
    #     def item_effect_recover_mp(user, item, effect)
    #     def item_effect_gain_tp
    #
    # * Alias methods
    #   class Game_Interpreter
    #     def command_108
    #
    #   class Window_Base < Window
    #     def convert_escape_characters(text)
    #
    #------------------------------------------------------------------------------
    # Instructions:
    #  To instal the script, open you script editor and paste this script on
    #  a new section bellow the Materials section.
    #
    #------------------------------------------------------------------------------
    # New functions
    #
    # * Random number between two vales
    #   rand_between(min, max)
    #    min : min value
    #    max : max value
    #   Can be called from any class, this method return an random value between
    #   two specific numbers
    #
    # * Random array value
    #   <Array>.random
    #   <Array>.random!
    #   Returns a random object from the array, the method .random! is destructive,
    #   removing the value returned from the array.
    #
    # * Sum of the numeric values of a array
    #   <Array>.sum
    #   Returns the sum of all numeric values
    #
    # * Average of all numeric values from the array
    #   <Array>.average(float = false)
    #    float : float flag
    #   Returns the average of all numeric values, if floa is true, the value
    #   returned is a float, otherwise it's a integer.
    #
    # * Note for events
    #   <Event>.note
    #   By default, events doesn't have note boxes. This command allows to use
    #   comments as note boxes, following the same format as the ones on the
    #   database. Returns all comments on the active page of the event.
    #
    # * Comment calls
    #   <Event>.comment_call
    #   Another function for comment boxes, by default, they have absolutely no
    #   effect in game when called. But this method allows to make the comment
    #   box to behave like an script call, but with the versatility of the
    #   note boxes. Remember that the commands will only take effect if there
    #   is scripts to respond to the comment code.
    #
    #==============================================================================

    #==============================================================================
    # ** Victor Engine
    #------------------------------------------------------------------------------
    #   Setting module for the Victor Engine
    #==============================================================================

    module Victor_Engine
      
    #--------------------------------------------------------------------------
      # * New method: required_script
      #--------------------------------------------------------------------------
      
    def self.required_script(namereqversiontype 0)
        if 
    type != :bellow && (!$imported[req] || $imported[req] < version)
          
    msg "The script '%s' requires the script\n"
          
    case type
          when 
    :above
            msg 
    += "'%s' v%s or higher above it to work properly\n"
          
    else
            
    msg += "'%s' v%s or higher to work properly\n"
          
    end
          msg 
    += "Go to [url]http://victorscripts.wordpress.com/[/url] to download this script."
          
    self.exit_message(msgnamereqversion)
        
    elsif type == :bellow && $imported[req]
          
    msg =  "The script '%s' requires the script\n"
          
    msg += "'%s' to be put bellow it\n"
          
    msg += "move the scripts to the proper position"
          
    self.exit_message(msgnamereqversion)
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * New method: exit_message
      #--------------------------------------------------------------------------
      
    def self.exit_message(messagenamereqversion)
        
    name self.script_name(name)
        
    req  self.script_name(req)
        
    msgbox(sprintf(messagenamereqversion))
        exit
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: script_name
      #--------------------------------------------------------------------------
      
    def self.script_name(nameext "VE")
        
    name name.to_s.gsub("_"" ").upcase.split
        name
    .collect! {|charchar == ext "#{char} -" char.capitalize }
        
    name.join(" ")
      
    end
    end

    $imported 
    ||= {}
    $imported[:ve_basic_module] = 1.35

    #==============================================================================
    # ** Object
    #------------------------------------------------------------------------------
    #  This class is the superclass of all other classes.
    #==============================================================================

    class Object
      
    #--------------------------------------------------------------------------
      # * Include setting module
      #--------------------------------------------------------------------------
      
    include Victor_Engine
      
    #-------------------------------------------------------------------------
      # * New method: rand_between
      #-------------------------------------------------------------------------
      
    def rand_between(minmax)
        
    min rand(max min 1)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: numeric?
      #--------------------------------------------------------------------------
      
    def numeric?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: string?
      #--------------------------------------------------------------------------
      
    def string?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: array?
      #--------------------------------------------------------------------------
      
    def array?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: float?
      #--------------------------------------------------------------------------
      
    def float?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: symbol?
      #--------------------------------------------------------------------------
      
    def symbol?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: item?
      #--------------------------------------------------------------------------
      
    def item?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: skill?
      #--------------------------------------------------------------------------
      
    def skill?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: file_exist?
      #--------------------------------------------------------------------------
      
    def file_exist?(pathfilename)
        
    $file_list ||= {}
        
    $file_list[path filename] ||= file_test(pathfilename)
        
    $file_list[path filename]
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: get_file_list
      #--------------------------------------------------------------------------
      
    def file_test(pathfilename)
        
    bitmap Cache.load_bitmap(pathfilenamerescue nil
        bitmap 
    true false
      end
      
    #--------------------------------------------------------------------------
      # * New method: character_exist?
      #--------------------------------------------------------------------------
      
    def character_exist?(filename)
        
    file_exist?("Graphics/Characters/"filename)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: battler_exist?
      #--------------------------------------------------------------------------
      
    def battler_exist?(filename)
        
    file_exist?("Graphics/Battlers/"filename)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: face_exist?
      #--------------------------------------------------------------------------
      
    def face_exist?(filename)
        
    file_exist?("Graphics/Faces/"filename)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: get_filename
      #--------------------------------------------------------------------------
      
    def get_filename
        
    "["'“‘]([^"'”‘”’]+)["'”’]"
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: get_all_values
      #--------------------------------------------------------------------------
      
    def get_all_values(value1value2 nil)
        
    value2 value1 unless value2
        
    /<#{value1}>((?:[^<]|<[^\/])*)<\/#{value2}>/im
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: make_symbol
      #--------------------------------------------------------------------------
      
    def make_symbol(string)
        
    string.downcase.gsub(" ""_").to_sym
      end
      
    #--------------------------------------------------------------------------
      # * New method: make_string
      #--------------------------------------------------------------------------
      
    def make_string(symbol)
        
    symbol.to_s.gsub("_"" ").upcase
      end
      
    #--------------------------------------------------------------------------
      # * New method: returning_value
      #--------------------------------------------------------------------------
      
    def returning_value(ix)
        
    = [21].max
        i 
    y  >= ? (2) - 
      end
      
    #--------------------------------------------------------------------------
      # New method: in_rect?
      #--------------------------------------------------------------------------
      
    def in_rect?(whx1y1x2y2fx 0)
        
    awahaxaybxby setup_area(whx1y1x2y2fx)
        
    bx ax aw && bx ax aw && by ay ah && by ay ah
      end
      
    #--------------------------------------------------------------------------
      # New method: in_radius?
      #--------------------------------------------------------------------------
      
    def in_radius?(whx1y1x2y2fx 0)
        
    awahaxaybxby setup_area(whx1y1x2y2fx)
        ((
    bx ax) ** aw ** 2) + ((by ay) ** ah ** 2) <= 1
      end
      
    #--------------------------------------------------------------------------
      # New method: setup_area
      #--------------------------------------------------------------------------
      
    def setup_area(whx1y1x2y2fx)
        
    aw w
        ah 
    aw
        ax 
    x1
        ay 
    y1
        bx 
    x2
        by 
    y2
        bx 
    += fx if ax bx
        bx 
    -= fx if ax bx
        
    [awahaxaybxby]
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: get_param_id
      #--------------------------------------------------------------------------
      
    def get_param_id(text)
        case 
    text.upcase
        when 
    "MAXHP""HP" then 0
        when 
    "MAXMP""MP" then 1
        when 
    "ATK" then 2
        when 
    "DEF" then 3
        when 
    "MAT" then 4
        when 
    "MDF" then 5
        when 
    "AGI" then 6
        when 
    "LUK" then 7
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_param_text
      #--------------------------------------------------------------------------
      
    def get_param_text(id)
        case 
    id
        when 0 then 
    "HP" 
        
    when 1 then "MP"
        
    when 2 then "ATK"
        
    when 3 then "DEF"
        
    when 4 then "MAT"
        
    when 5 then "MDF"
        
    when 6 then "AGI"
        
    when 7 then "LUK"
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_xparam_id
      #--------------------------------------------------------------------------
      
    def get_xparam_id(text)
        case 
    text.upcase
        when 
    "HIT" then 0
        when 
    "EVA" then 1
        when 
    "CRI" then 2
        when 
    "CEV" then 3
        when 
    "MEV" then 4
        when 
    "MRF" then 5
        when 
    "CNT" then 6
        when 
    "HRG" then 7
        when 
    "MRG" then 8
        when 
    "TRG" then 9
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_xparam_text
      #--------------------------------------------------------------------------
      
    def get_xparam_text(id)
        case 
    id
        when 0 then 
    "HIT" 
        
    when 1 then "EVA"
        
    when 2 then "CRI"
        
    when 3 then "CEV"
        
    when 4 then "MEV"
        
    when 5 then "MRF"
        
    when 6 then "CNT"
        
    when 7 then "HRG"
        
    when 8 then "MRG"
        
    when 9 then "TRG"
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_sparam_id
      #--------------------------------------------------------------------------
      
    def get_sparam_id(text)
        case 
    text.upcase
        when 
    "TGR" then 0
        when 
    "GRD" then 1
        when 
    "REC" then 2
        when 
    "PHA" then 3
        when 
    "MCR" then 4
        when 
    "TCR" then 5
        when 
    "PDR" then 6
        when 
    "MDR" then 7
        when 
    "FDR" then 8
        when 
    "EXR" then 9
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_sparam_text
      #--------------------------------------------------------------------------
      
    def get_sparam_text(id)
        case 
    id
        when 0 then 
    "TGR" 
        
    when 1 then "GRD"
        
    when 2 then "REC"
        
    when 3 then "PHA"
        
    when 4 then "MCR"
        
    when 5 then "TCR"
        
    when 6 then "PDR"
        
    when 7 then "MDR"
        
    when 8 then "FDR"
        
    when 9 then "EXR"
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_cond
      #--------------------------------------------------------------------------
      
    def get_cond(text)
        case 
    text.upcase
        when 
    "HIGHER"    then ">"
        
    when "LOWER"     then "<"
        
    when "EQUAL"     then "=="
        
    when "DIFFERENT" then "!="
        
    else "!="
        
    end
      end
    end

    #==============================================================================
    # ** String
    #------------------------------------------------------------------------------
    #  The string class. Can handle character sequences of arbitrary lengths. 
    #==============================================================================

    class String
      
    #--------------------------------------------------------------------------
      # * New method: string?
      #--------------------------------------------------------------------------
      
    def string?
        return 
    true
      end
    end

    #==============================================================================
    # ** String
    #------------------------------------------------------------------------------
    #  The class that represents symbols.
    #==============================================================================

    class Symbol
      
    #--------------------------------------------------------------------------
      # * New method: symbol?
      #--------------------------------------------------------------------------
      
    def symbol?
        return 
    true
      end
    end

    #==============================================================================
    # ** Numeric
    #------------------------------------------------------------------------------
    #  This is the abstract class for numbers.
    #==============================================================================

    class Numeric
      
    #--------------------------------------------------------------------------
      # * New method: numeric?
      #--------------------------------------------------------------------------
      
    def numeric?
        return 
    true
      end
      
    #--------------------------------------------------------------------------
      # * New method: ceil?
      #--------------------------------------------------------------------------
      
    def ceil?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: to_ceil
      #--------------------------------------------------------------------------
      
    def to_ceil
        self 
    self.abs.ceil : -self.abs.ceil
      end
    end

    #==============================================================================
    # ** Float
    #------------------------------------------------------------------------------
    #  This is the abstract class for the floating point values.
    #==============================================================================

    class Float
      
    #--------------------------------------------------------------------------
      # * New method: float?
      #--------------------------------------------------------------------------
      
    def float?
        return 
    true
      end
      
    #--------------------------------------------------------------------------
      # * New method: ceil?
      #--------------------------------------------------------------------------
      
    def ceil?
        
    self != self.ceil
      end
    end

    #============================================================================== 
    # ** Array     
    #------------------------------------------------------------------------------
    #  This class store arbitrary Ruby objects.
    #==============================================================================

    class Array
      
    #--------------------------------------------------------------------------
      # * New method: array?
      #--------------------------------------------------------------------------
      
    def array?
        return 
    true
      end
      
    #-------------------------------------------------------------------------
      # * New method: random
      #-------------------------------------------------------------------------
      
    def random
        self
    [rand(size)]
      
    end
      
    #-------------------------------------------------------------------------
      # * New method: random!
      #-------------------------------------------------------------------------
      
    def random!
        
    self.delete_at(rand(size))
      
    end
      
    #---------------------------------------------------------------------------
      # * New method: sum
      #---------------------------------------------------------------------------
      
    def sum
        self
    .inject(0) {|rn+= (n.numeric? ? 0)} 
      
    end
      
    #---------------------------------------------------------------------------
      # * New method: average
      #---------------------------------------------------------------------------
      
    def average(float false)
        
    self.sum / [(float size.to_f size.to_i), 1].max
      end
      
    #---------------------------------------------------------------------------
      # * New method: next_item
      #---------------------------------------------------------------------------
      
    def next_item
        item 
    self.shift
        self
    .push(item)
        
    item
      end
      
    #---------------------------------------------------------------------------
      # * New method: previous_item
      #---------------------------------------------------------------------------
      
    def previous_item
        item 
    self.pop
        self
    .unshift(item)
        
    item
      end
    end

    #==============================================================================
    # ** RPG::Troop::Page
    #------------------------------------------------------------------------------
    #  This is the data class for battle events (pages).
    #==============================================================================

    class RPG::Troop::Page
      
    #--------------------------------------------------------------------------
      # * New method: note
      #--------------------------------------------------------------------------
      
    def note
        
    return "" if !@list || @list.size <= 0
        comment_list 
    = []
        @list.
    each do |item|
          
    next unless item && (item.code == 108 || item.code == 408)
          
    comment_list.push(item.parameters[0])
        
    end
        comment_list
    .join("\r\n")
      
    end
    end

    #==============================================================================
    # ** RPG::UsableItem
    #------------------------------------------------------------------------------
    #  This is the superclass for skills and items.
    #==============================================================================

    class RPG::UsableItem RPG::BaseItem
      
    #--------------------------------------------------------------------------
      # * New method: for_all_targets?
      #--------------------------------------------------------------------------
      
    def for_all_targets?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: element_set
      #--------------------------------------------------------------------------
      
    def element_set
        
    [damage.element_id]
      
    end
    end

    #==============================================================================
    # ** RPG::Skill
    #------------------------------------------------------------------------------
    #  This is the data class for skills.
    #==============================================================================

    class RPG::Skill RPG::UsableItem
      
    #--------------------------------------------------------------------------
      # * New method: item?
      #--------------------------------------------------------------------------
      
    def item?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: skill?
      #--------------------------------------------------------------------------
      
    def skill?
        return 
    true
      end
      
    #--------------------------------------------------------------------------
      # * New method: type_set
      #--------------------------------------------------------------------------
      
    def type_set
        
    [stype_id]
      
    end  
    end

    #==============================================================================
    # ** RPG::Item
    #------------------------------------------------------------------------------
    #  This is the data class for items.
    #==============================================================================

    class RPG::Item RPG::UsableItem
      
    #--------------------------------------------------------------------------
      # * New method: item?
      #--------------------------------------------------------------------------
      
    def item?
        return 
    true
      end 
      
    #--------------------------------------------------------------------------
      # * New method: skill?
      #--------------------------------------------------------------------------
      
    def skill?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: type_set
      #--------------------------------------------------------------------------
      
    def type_set
        
    [itype_id]
      
    end
    end

    #==============================================================================
    # ** Cache
    #------------------------------------------------------------------------------
    #  This module loads each of graphics, creates a Bitmap object, and retains it.
    # To speed up load times and conserve memory, this module holds the created
    # Bitmap object in the internal hash, allowing the program to return
    # preexisting objects when the same bitmap is requested again.
    #==============================================================================

    class << Cache
      
    #--------------------------------------------------------------------------
      # * Overwrite method: character
      #--------------------------------------------------------------------------
      
    def character(filenamehue 0)
        
    load_bitmap("Graphics/Characters/"filenamehue)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: cache
      #--------------------------------------------------------------------------
      
    def cache
        
    @cache
      end
    end

    #==============================================================================
    # ** BattleManager
    #------------------------------------------------------------------------------
    #  This module handles the battle processing
    #==============================================================================

    class << BattleManager
      
    #--------------------------------------------------------------------------
      # * New method: all_battle_members
      #--------------------------------------------------------------------------
      
    def all_battle_members
        $game_party
    .members $game_troop.members
      end
      
    #--------------------------------------------------------------------------
      # * New method: all_dead_members
      #--------------------------------------------------------------------------
      
    def all_dead_members
        $game_party
    .dead_members $game_troop.dead_members
      end
      
    #--------------------------------------------------------------------------
      # * New method: all_movable_members
      #--------------------------------------------------------------------------
      
    def all_movable_members
        $game_party
    .movable_members $game_troop.movable_members
      end
    end

    #==============================================================================
    # ** Game_BattlerBase
    #------------------------------------------------------------------------------
    #  This class handles battlers. It's used as a superclass of the Game_Battler
    # classes.
    #==============================================================================

    class Game_BattlerBase
      
    #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      
    attr_reader   :buffs
      
    #--------------------------------------------------------------------------
      # * New method: get_param
      #--------------------------------------------------------------------------
      
    def get_param(text)
        case 
    text.upcase
        when 
    "MAXHP" then self.mhp
        when 
    "MAXMP" then self.mmp
        when 
    "MAXTP" then self.max_tp
        
    else eval("self.#{text.downcase}")
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * New method: type
      #--------------------------------------------------------------------------
      
    def type
        
    list = []
        
    get_all_notes.scan(/<BATTLER TYPE: ((?:\w+ *,? *)+)>/i) do
          $
    1.scan(/(\d+)/i) { list.push(make_symbol($1)) }
        
    end
        
    list.uniq
      end
      
    #--------------------------------------------------------------------------
      # * New method: danger?
      #--------------------------------------------------------------------------
      
    def danger?
        
    hp mhp 25 100
      end
      
    #--------------------------------------------------------------------------
      # * New method: sprite
      #--------------------------------------------------------------------------
      
    def sprite
        valid 
    SceneManager.scene_is?(Scene_Battle) && SceneManager.scene.spriteset
        valid 
    SceneManager.scene.spriteset.sprite(self) : nil
      end
      
    #--------------------------------------------------------------------------
      # * New method: element_set
      #--------------------------------------------------------------------------
      
    def element_set(item)
        
    element_set  item.element_set
        element_set 
    += atk_elements if item.damage.element_id 0
        element_set
    .delete(0)
        
    element_set.compact
      end
      
    #--------------------------------------------------------------------------
      # * New method: add_state_normal
      #--------------------------------------------------------------------------
      
    def add_state_normal(state_idrate 1user self)
        
    chance  rate
        chance 
    *= state_rate(state_id)
        
    chance *= luk_effect_rate(user)
        
    add_state(state_id) if rand chance
      end
      
    #--------------------------------------------------------------------------
      # * New method: damaged?
      #--------------------------------------------------------------------------
      
    def damaged?
        @
    result.hp_damage != || @result.mp_damage != || @result.tp_damage != 0
      end
      
    #--------------------------------------------------------------------------
      # * New method: mtp
      #--------------------------------------------------------------------------
      
    def mtp
        
    return 100
      end
    end

    #==============================================================================
    # ** Game_Battler
    #------------------------------------------------------------------------------
    #  This class deals with battlers. It's used as a superclass of the Game_Actor
    # and Game_Enemy classes.
    #==============================================================================

    class Game_Battler Game_BattlerBase
      
    #--------------------------------------------------------------------------
      # * Overwrite method: item_effect_recover_hp
      #--------------------------------------------------------------------------
      
    def item_effect_recover_hp(useritemeffect)
        
    value item_value_recover_hp(useritemeffect).to_i
        
    @result.hp_damage -= value
        
    @result.success    true
        self
    .hp += value
      end
      
    #--------------------------------------------------------------------------
      # * Overwrite method: item_effect_recover_mp
      #--------------------------------------------------------------------------
      
    def item_effect_recover_mp(useritemeffect)
        
    value item_value_recover_mp(useritemeffect).to_i
        
    @result.mp_damage -= value
        
    @result.success    true if value != 0
        self
    .mp += value
      end
      
    #--------------------------------------------------------------------------
      # * Overwrite method: item_effect_gain_tp
      #--------------------------------------------------------------------------
      
    def item_effect_gain_tp(useritemeffect)
        
    value    item_value_recover_tp(useritemeffect)
        
    self.tp += value
      end
      
    #--------------------------------------------------------------------------
      # * New method: item_value_recover_hp
      #--------------------------------------------------------------------------
      
    def item_value_recover_hp(useritemeffect)
        
    value  = (mhp effect.value1 effect.value2) * rec
        value 
    *= user.pha if item.is_a?(RPG::Item)
        
    value
      end
      
    #--------------------------------------------------------------------------
      # * New method: item_value_recover_mp
      #--------------------------------------------------------------------------
      
    def item_value_recover_mp(useritemeffect)
        
    value  = (mmp effect.value1 effect.value2) * rec
        value 
    *= user.pha if item.is_a?(RPG::Item)
        
    value
      end
      
    #--------------------------------------------------------------------------
      # * New method: item_value_recover_tp
      #--------------------------------------------------------------------------
      
    def item_value_recover_tp(useritemeffect)
        
    effect.value1.to_i
      end
      
    #--------------------------------------------------------------------------
      # * New method: cri_rate
      #--------------------------------------------------------------------------
      
    def cri_rate(useritem)
        
    user.cri
      end
      
    #--------------------------------------------------------------------------
      # * New method: cri_eva
      #--------------------------------------------------------------------------
      
    def cri_eva(useritem)
        
    cev
      end
      
    #--------------------------------------------------------------------------
      # * New method: setup_critical
      #--------------------------------------------------------------------------
      
    def setup_critical(useritem)
        
    cri_rate(useritem) * (cri_eva(useritem))
      
    end
    end

    #==============================================================================
    # ** Game_Enemy
    #------------------------------------------------------------------------------
    #  This class handles enemy characters. It's used within the Game_Troop class
    # ($game_troop).
    #==============================================================================

    class Game_Enemy Game_Battler
      
    #--------------------------------------------------------------------------
      # * New method: id
      #--------------------------------------------------------------------------
      
    def id
        
    @enemy_id
      end
      
    #--------------------------------------------------------------------------
      # * New method: note
      #--------------------------------------------------------------------------
      
    def note
        enemy 
    enemy.note ""
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: get_all_notes
      #--------------------------------------------------------------------------
      
    def get_all_notes(*args)
        
    notes  ""
        
    notes += note if !args.include?(:self)
        
    states.compact.each {|statenotes += state.note } if !args.include?(:state)
        
    notes
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_all_objects
      #--------------------------------------------------------------------------
      
    def get_all_objects(*args)
        
    result = []
        
    result += [self] if !args.include?(:self)
        
    result += states.compact if !args.include?(:state)
        
    result
      end
      
    #--------------------------------------------------------------------------
      # * New method: level
      #--------------------------------------------------------------------------
      
    def level
        
    return 1
      end
      
    #--------------------------------------------------------------------------
      # * New method: skill_learn?
      #--------------------------------------------------------------------------
      
    def skill_learn?(skill)
        
    skill.skill? && skills.include?(skill)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: skills
      #--------------------------------------------------------------------------
      
    def skills
        
    (enemy_actions added_skills).sort.collect {|id$data_skills[id] }
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: enemy_actions
      #--------------------------------------------------------------------------
      
    def enemy_actions
        enemy
    .actions.collect {|actionaction.skill_id }
      
    end
    end

    #==============================================================================
    # ** Game_Actor
    #------------------------------------------------------------------------------
    #  This class handles actors. It's used within the Game_Actors class
    # ($game_actors) and referenced by the Game_Party class ($game_party).
    #==============================================================================

    class Game_Actor Game_Battler
      
    #--------------------------------------------------------------------------
      # * New method: note
      #--------------------------------------------------------------------------
      
    def note
        actor 
    actor.note ""
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: hue
      #--------------------------------------------------------------------------
      
    def hue
        
    @hue ? @hue 0
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_all_notes
      #--------------------------------------------------------------------------
      
    def get_all_notes(*args)
        
    notes ""
        
    notes += note if !args.include?(:self)
        
    notes += self.class.note if !args.include?(:class)
        
    equips.compact.each {|equipnotes += equip.note } if !args.include?(:equip)
        
    states.compact.each {|statenotes += state.note } if !args.include?(:state)
        
    notes
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_all_objects
      #--------------------------------------------------------------------------
      
    def get_all_objects(*args)
        
    result = []
        
    result += [self] if !args.include?(:self)
        
    result += [self.class]   if !args.include?(:class)
        
    result += equips.compact if !args.include?(:equip)
        
    result += states.compact if !args.include?(:state)
        
    result
      end
      
    #--------------------------------------------------------------------------
      # * New method: in_active_party?
      #--------------------------------------------------------------------------
      
    def in_active_party?
        
    $game_party.battle_members.include?(self)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: in_reserve_party?
      #--------------------------------------------------------------------------
      
    def in_reserve_party?
        
    $game_party.reserve_members.include?(self)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: in_party?
      #--------------------------------------------------------------------------
      
    def in_party?
        
    $game_party.all_members.include?(self)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: map_animation
      #--------------------------------------------------------------------------
      
    def map_animation(id)
        
    $game_map.actors.each do |member|
          
    member.animation_id id if member.actor == self
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: on_damage_floor
      #--------------------------------------------------------------------------
      
    def on_damage_floor?
        
    $game_player.on_damage_floor?
      
    end
    end

    #==============================================================================
    # ** Game_Unit
    #------------------------------------------------------------------------------
    #  This class handles units. It's used as a superclass of the Game_Party and
    # Game_Troop classes.
    #==============================================================================

    class Game_Unit
      
    #--------------------------------------------------------------------------
      # * New method: refresh
      #--------------------------------------------------------------------------
      
    def refresh
        members
    .each {|membermember.refresh }
      
    end
    end

    #==============================================================================
    # ** Game_Party
    #------------------------------------------------------------------------------
    #  This class handles the party. It includes information on amount of gold 
    # and items. The instance of this class is referenced by $game_party.
    #==============================================================================

    class Game_Party Game_Unit
      
    #--------------------------------------------------------------------------
      # * New method: average_level
      #--------------------------------------------------------------------------
      
    def average_level
        battle_members
    .collect {|actoractor.level }.average
      end
      
    #--------------------------------------------------------------------------
      # * New method: reserve_members
      #--------------------------------------------------------------------------
      
    def reserve_members
        all_members 
    battle_members
      end
    end

    #==============================================================================
    # ** Game_Map
    #------------------------------------------------------------------------------
    #  This class handles maps. It includes scrolling and passage determination
    # functions. The instance of this class is referenced by $game_map.
    #==============================================================================

    class Game_Map
      
    #--------------------------------------------------------------------------
      # * New method: event_list
      #--------------------------------------------------------------------------
      
    def event_list
        events
    .values
      end
      
    #--------------------------------------------------------------------------
      # * New method: note
      #--------------------------------------------------------------------------
      
    def note
        
    @map ? @map.note ""
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: vehicles
      #--------------------------------------------------------------------------
      
    def vehicles
        
    @vehicles
      end
      
    #--------------------------------------------------------------------------
      # * New method: map_events
      #--------------------------------------------------------------------------
      
    def map_events
        
    @map.events
      end
      
    #--------------------------------------------------------------------------
      # * New method: actors
      #--------------------------------------------------------------------------
      
    def actors
        
    [$game_player] + $game_player.followers.visible_followers
      end
    end

    #==============================================================================
    # ** Game_CharacterBase
    #------------------------------------------------------------------------------
    #  This class deals with characters. Common to all characters, stores basic
    # data, such as coordinates and graphics. It's used as a superclass of the
    # Game_Character class.
    #==============================================================================

    class Game_CharacterBase
      
    #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      
    attr_accessor :move_speed
      attr_accessor 
    :move_frequency
      
    #--------------------------------------------------------------------------
      # * New method: player?
      #--------------------------------------------------------------------------
      
    def player?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: event?
      #--------------------------------------------------------------------------
      
    def event?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: follower?
      #--------------------------------------------------------------------------
      
    def follower?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: vehicle?
      #--------------------------------------------------------------------------
      
    def vehicle?
        return 
    false
      end
      
    #--------------------------------------------------------------------------
      # * New method: frames
      #--------------------------------------------------------------------------
      
    def frames
        
    return 3
      end
      
    #--------------------------------------------------------------------------
      # * New method: hue
      #--------------------------------------------------------------------------
      
    def hue
        
    @hue ? @hue 0
      end
    end

    #==============================================================================
    # ** Game_Character
    #------------------------------------------------------------------------------
    #  This class deals with characters. It's used as a superclass of the
    # Game_Player and Game_Event classes.
    #==============================================================================

    class Game_Character Game_CharacterBase
      
    #--------------------------------------------------------------------------
      # * New method: move_toward_position
      #--------------------------------------------------------------------------
      
    def move_toward_position(xy)
        
    sx distance_x_from(x)
        
    sy distance_y_from(y)
        if 
    sx.abs sy.abs
          move_straight
    (sx 6)
          
    move_straight(sy 2) if !@move_succeed && sy != 0
        elsif sy 
    != 0
          move_straight
    (sy 2)
          
    move_straight(sx 6) if !@move_succeed && sx != 0
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: move_toward_position
      #--------------------------------------------------------------------------
      
    def turn_toward_position(xy)
        
    sx distance_x_from(x)
        
    sy distance_y_from(y)
        if 
    sx.abs sy.abs
          set_direction
    (sx 6)
        
    elsif sy != 0
          set_direction
    (sy 2)
        
    end
      end
    end

    #==============================================================================
    # ** Game_Player
    #------------------------------------------------------------------------------
    #  This class handles the player.
    # The instance of this class is referenced by $game_map.
    #==============================================================================

    class Game_Player Game_Character
      
    #--------------------------------------------------------------------------
      # * New method: player?
      #--------------------------------------------------------------------------
      
    def player?
        return 
    true
      end
      
    #--------------------------------------------------------------------------
      # * New method: perform_transfer
      #--------------------------------------------------------------------------
      
    def new_map_id
        
    @new_map_id
      end
      
    #--------------------------------------------------------------------------
      # * New method: hue
      #--------------------------------------------------------------------------
      
    def hue
        actor 
    actor.hue 0
      end
    end

    #==============================================================================
    # ** Game_Follower
    #------------------------------------------------------------------------------
    #  This class handles the followers. Followers are the actors of the party
    # that follows the leader in a line. It's used within the Game_Followers class.
    #==============================================================================

    class Game_Follower Game_Character
      
    #--------------------------------------------------------------------------
      # * New method: follower?
      #--------------------------------------------------------------------------
      
    def follower?
        return 
    true
      end
      
    #--------------------------------------------------------------------------
      # * New method: index
      #--------------------------------------------------------------------------
      
    def index
        
    @member_index
      end
      
    #--------------------------------------------------------------------------
      # * New method: gathering?
      #--------------------------------------------------------------------------
      
    def gathering?
        
    $game_player.followers.gathering? && !gather?
      
    end
    end

    #==============================================================================
    # ** Game_Followers
    #------------------------------------------------------------------------------
    #  This class handles the followers. It's a wrapper for the built-in class
    # "Array." It's used within the Game_Player class.
    #==============================================================================

    class Game_Followers
      
    #--------------------------------------------------------------------------
      # * New method: get_actor
      #--------------------------------------------------------------------------
      
    def get_actor(id)
        list = [
    $game_player] + visible_followers
        
    list.select {|followerfollower.actor && follower.actor.id == id }.first
      end
      
    #--------------------------------------------------------------------------
      # * Method fix: visble_folloers
      #--------------------------------------------------------------------------
      
    unless method_defined?(:visible_followers)
        
    def visible_followersvisible_folloersend
      end
    end

    #==============================================================================
    # ** Game_Vehicle
    #------------------------------------------------------------------------------
    #  This class handles vehicles. It's used within the Game_Map class. If there
    # are no vehicles on the current map, the coordinates is set to (-1,-1).
    #==============================================================================

    class Game_Vehicle Game_Character
      
    #--------------------------------------------------------------------------
      # * New method: vehicle?
      #--------------------------------------------------------------------------
      
    def vehicle?
        return 
    true
      end
      
    #--------------------------------------------------------------------------
      # * New method: map_id
      #--------------------------------------------------------------------------
      
    def map_id
        
    @map_id 
      end
      
    #--------------------------------------------------------------------------
      # * New method: type
      #--------------------------------------------------------------------------
      
    def type
        
    @type
      end
      
    #--------------------------------------------------------------------------
      # * New method: aerial?
      #--------------------------------------------------------------------------
      
    def aerial?
        
    type == :airship
      end 
      
    #--------------------------------------------------------------------------
      # * New method: above?
      #--------------------------------------------------------------------------
      
    def above?
        
    aerial?
      
    end
    end

    #==============================================================================
    # ** Game_Event
    #------------------------------------------------------------------------------
    #  This class deals with events. It handles functions including event page 
    # switching via condition determinants, and running parallel process events.
    # It's used within the Game_Map class.
    #==============================================================================

    class Game_Event Game_Character
      
    #--------------------------------------------------------------------------
      # * New method: name
      #--------------------------------------------------------------------------
      
    def name
        
    @event.name
      end
      
    #--------------------------------------------------------------------------
      # * New method: event?
      #--------------------------------------------------------------------------
      
    def event?
        return 
    true
      end
      
    #--------------------------------------------------------------------------
      # * New method: erased?
      #--------------------------------------------------------------------------
      
    def erased?
        @
    erased
      end
      
    #--------------------------------------------------------------------------
      # * New method: note
      #--------------------------------------------------------------------------
      
    def note
        
    return ""     if !@page || !@page.list || @page.list.size <= 0
        
    return @notes if @notes && @page.list == @note_page
        
    @note_page = @page.list.dup
        comment_list 
    = []
        @
    page.list.each do |item|
          
    next unless item && (item.code == 108 || item.code == 408)
          
    comment_list.push(item.parameters[0])
        
    end
        
    @notes comment_list.join("\r\n")
        @
    notes
      end  
    end

    #==============================================================================
    # ** Game_Interpreter
    #------------------------------------------------------------------------------
    #  An interpreter for executing event commands. This class is used within the
    # Game_Map, Game_Troop, and Game_Event classes.
    #==============================================================================

    class Game_Interpreter
      
    #--------------------------------------------------------------------------
      # * Alias method: command_108
      #--------------------------------------------------------------------------
      
    alias :command_108_ve_basic_module :command_108
      def command_108
        command_108_ve_basic_module
        comment_call
      end
      
    #--------------------------------------------------------------------------
      # * New method: comment_call
      #--------------------------------------------------------------------------
      
    def comment_call
      end
      
    #--------------------------------------------------------------------------
      # * New method: note
      #--------------------------------------------------------------------------
      
    def note
        
    @comments ? @comments.join("\r\n") : ""
      
    end
    end

    #==============================================================================
    # ** Game_Animation
    #------------------------------------------------------------------------------
    #  Classe that handles Animation data
    #==============================================================================

    class Game_Animation
      
    #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      
    attr_accessor :ox
      attr_accessor 
    :oy
      attr_accessor 
    :rate
      attr_accessor 
    :zoom
      attr_accessor 
    :loop
      attr_accessor 
    :type
      attr_accessor 
    :map_x
      attr_accessor 
    :map_y
      attr_accessor 
    :mirror
      attr_accessor 
    :follow
      attr_accessor 
    :height
      attr_accessor 
    :bitmap1
      attr_accessor 
    :bitmap2
      attr_accessor 
    :sprites
      attr_accessor 
    :duration
      attr_accessor 
    :direction
      attr_accessor 
    :duplicated
      
    #--------------------------------------------------------------------------
      # * New method: initialize
      #--------------------------------------------------------------------------
      
    def initialize(animationmirroruser nil)
        @
    animation animation
        
    @rate      animation.name =~ /<RATE: ([+-]?\d+)>/? [$1.to_i1].max 4
        
    @zoom      animation.name =~ /<ZOOM: (\d+)%?>/i ? $1.to_i / 100.0 : 1.0
        @follow    = animation.name =~ /<FOLLOW>/i ? true : false
        @mirror    = mirror
        @duration  = frame_max * @rate
        @direction = user.anim_direction if user
        @sprites   = []
        bellow     = animation.name =~ /<BELLOW>/i
        above      = animation.name =~ /<ABOVE>/i
        @height    = bellow ? -1 : above ? 300 : 1
      end
      #--------------------------------------------------------------------------
      # * New method: data
      #--------------------------------------------------------------------------  
      def data
        @animation
      end
      #--------------------------------------------------------------------------
      # * New method: id
      #--------------------------------------------------------------------------  
      def id
        @animation.id
      end
      #--------------------------------------------------------------------------
      # * New method: name
      #--------------------------------------------------------------------------  
      def name
        @animation.name
      end
      #--------------------------------------------------------------------------
      # * New method: frame_max
      #--------------------------------------------------------------------------
      def frame_max
        @animation.frame_max
      end
      #--------------------------------------------------------------------------
      # * New method: position
      #--------------------------------------------------------------------------
      def position
        @animation.position
      end
      #--------------------------------------------------------------------------
      # * New method: animation1_name
      #--------------------------------------------------------------------------
      def animation1_name
        @animation.animation1_name
      end
      #--------------------------------------------------------------------------
      # * New method: animation2_name
      #--------------------------------------------------------------------------
      def animation2_name
        @animation.animation2_name
      end
      #--------------------------------------------------------------------------
      # * New method: animation1_hue
      #--------------------------------------------------------------------------
      def animation1_hue
        @animation.animation1_hue
      end
      #--------------------------------------------------------------------------
      # * New method: animation2_hue 
      #--------------------------------------------------------------------------
      def animation2_hue
        @animation.animation2_hue
      end
      #--------------------------------------------------------------------------
      # * New method: frames
      #--------------------------------------------------------------------------
      def frames
        @animation.frames
      end
      #--------------------------------------------------------------------------
      # * New method: timings
      #--------------------------------------------------------------------------
      def timings
        @animation.timings
      end
    end

    #==============================================================================
    # ** Sprite_Character
    #------------------------------------------------------------------------------
    #  This sprite is used to display characters. It observes a instance of the
    # Game_Character class and automatically changes sprite conditions.
    #==============================================================================

    class Sprite_Character < Sprite_Base
      #--------------------------------------------------------------------------
      # * Overwrite method: set_character_bitmap
      #--------------------------------------------------------------------------
      def set_character_bitmap
        update_character_info
        set_bitmap
        set_bitmap_position
      end
      #--------------------------------------------------------------------------
      # * New method: center_y
      #--------------------------------------------------------------------------
      def actor?
        @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
      end
      #--------------------------------------------------------------------------
      # * New method: center_y
      #--------------------------------------------------------------------------
      def actor
        actor? ? @character.actor : nil
      end
      #--------------------------------------------------------------------------
      # * New method: update_character_info
      #--------------------------------------------------------------------------
      def update_character_info
      end
      #--------------------------------------------------------------------------
      # * New method: hue
      #--------------------------------------------------------------------------
      def hue
        @character.hue
      end
      #--------------------------------------------------------------------------
      # * New method: set_bitmap
      #--------------------------------------------------------------------------
      def set_bitmap
        self.bitmap = Cache.character(set_bitmap_name, hue)
      end
      #--------------------------------------------------------------------------
      # * New method: set_bitmap_name
      #--------------------------------------------------------------------------
      def set_bitmap_name
        @character_name
      end
      #--------------------------------------------------------------------------
      # * New method: set_bitmap_position
      #--------------------------------------------------------------------------
      def set_bitmap_position
        sign = get_sign
        if sign && sign.include?('$')
          @cw = bitmap.width / @character.frames
          @ch = bitmap.height / 4
        else
          @cw = bitmap.width / (@character.frames * 4)
          @ch = bitmap.height / 8
        end
        self.ox = @cw / 2
        self.oy = @ch
      end
      #--------------------------------------------------------------------------
      # * New method: get_sign
      #--------------------------------------------------------------------------
      def get_sign
        @character_name[/^[\!\$]./]
      end
    end

    #==============================================================================
    # ** Sprite_Battler
    #------------------------------------------------------------------------------
    #  This sprite is used to display battlers. It observes a instance of the
    # Game_Battler class and automatically changes sprite conditions.
    #==============================================================================

    class Sprite_Battler < Sprite_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :dmg_mirror
      #--------------------------------------------------------------------------
      # * New method: center_x
      #--------------------------------------------------------------------------
      def center_x
        self.ox
      end
      #--------------------------------------------------------------------------
      # * New method: center_y
      #--------------------------------------------------------------------------
      def center_y
        self.oy / 2
      end
    end

    #==============================================================================
    # ** Spriteset_Battle
    #------------------------------------------------------------------------------
    #  This class brings together battle screen sprites. It's used within the
    # Scene_Battle class.
    #==============================================================================

    class Spriteset_Battle
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :viewport1
      #--------------------------------------------------------------------------
      # * New method: sprite
      #--------------------------------------------------------------------------
      def sprite(subject)
        battler_sprites.compact.select {|sprite| sprite.battler == subject }.first
      end
    end

    #==============================================================================
    # ** Window_Base
    #------------------------------------------------------------------------------
    #  This is a superclass of all windows in the game.
    #==============================================================================

    class Window_Base < Window
      #--------------------------------------------------------------------------
      # * Alias method: convert_escape_characters
      #--------------------------------------------------------------------------
      alias :convert_escape_ve_basic_module :convert_escape_characters
      def convert_escape_characters(text)
        result = text.to_s.clone
        result = text_replace(result)
        result = convert_escape_ve_basic_module(text)
        result
      end
      #--------------------------------------------------------------------------
      # * New method: text_replace
      #--------------------------------------------------------------------------
      def text_replace(result)
        result.gsub!(/\r/) { "" }
        result.gsub!(/\\/) { "\e" }
        result
      end
    end

    #==============================================================================
    # ** Scene_Battle
    #------------------------------------------------------------------------------
    #  This class performs battle screen processing.
    #==============================================================================

    class Scene_Battle < Scene_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :subject
      attr_reader   :spriteset
    end

    #==============================================================================
    # ** Scene_Battle
    #------------------------------------------------------------------------------
    #  This class performs map screen processing.
    #==============================================================================

    class Scene_Map < Scene_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :spriteset
    end 

    Спойлер VE - Light Effects:
    PHP код:
    #==============================================================================
    # ** Victor Engine - Light Effects
    #------------------------------------------------------------------------------
    # Author : Victor Sant
    #
    # Version History:
    #  v 1.00 - 2011.12.21 > First release
    #  v 1.01 - 2011.12.23 > Compatibility with Diagonal Movement
    #  v 1.02 - 2011.12.24 > Better checks for images bigger than screen
    #  v 1.03 - 2011.12.27 > Fixed bug when teleporting to same map
    #  v 1.04 - 2011.12.30 > Faster Regular Expressions
    #  v 1.05 - 2012.01.04 > Fixed lantern direction bug
    #                      > Fixed load fail when lights ON
    #  v 1.06 - 2012.01.07 > Fixed light opacity change not updating
    #  v 1.07 - 2012.01.13 > Fixed update delay when exiting the menu
    #  v 1.08 - 2012.01.15 > Fixed the positive sign on some Regular Expressions
    #                      > Fixed the Regular Expressions problem with "" and “”
    #  v 1.09 - 2012.05.21 > Compatibility with Map Turn Battle
    #  v 1.10 - 2012.07.24 > Compatibility with Moving Platform
    #                      > Changed actor indexing for lantern (now start at 1)
    #  v 1.11 - 2012.08.02 > Compatibility with Basic Module 1.27
    #  v 1.12 - 2013.01.07 > Fixed issue with actor lantern and map transfer
    #------------------------------------------------------------------------------
    #  This scripts allow to add varied light effects to the maps. But it works
    # different from other scripts with this function.
    # Normally, light effect scripts add images above the events, and then the
    # screen is tone is changed, with the images staying bellow the darker layer.
    # This script add an new darkened layer, and apply the light effect images
    # on this layer.
    #------------------------------------------------------------------------------
    # Compatibility
    #   Requires the script 'Victor Engine - Basic Module' v 1.27 or higher

    # * Alias methods
    #   class Game_Map
    #     def setup(map_id)
    #
    #  class Game_CharacterBase
    #     def init_public_members
    #     def update
    #
    #   class Game_Event < Game_Character
    #     def clear_starting_flag
    #
    #   class Spriteset_Map
    #     def initialize
    #     def update
    #     def dispose
    #
    #   class Scene_Map
    #     def pre_transfer
    #
    #   class Game_Interpreter
    #     def comment_call
    #
    #------------------------------------------------------------------------------
    # Instructions:
    #  To instal the script, open you script editor and paste this script on
    #  a new section bellow the Materials section. This script must also
    #  be bellow the script 'Victor Engine - Basic'
    #  The lights must be placed on the folder "Graphics/Lights". Create a folder
    #  named "Lights" on the Graphics folder.
    #
    #------------------------------------------------------------------------------
    # Comment calls note tags:
    #  Tags to be used in events comment box, works like a script call.
    #
    #  <create shade>
    #  setting
    #  </create shade>
    #   Create a shade effect on the map, add the following values to the setting.
    #     opacity: x : opacity (0-255)
    #     red: x     : red tone   (0-255, can be negative)
    #     green: x   : green tone (0-255, can be negative)
    #     blue: x    : blue tone  (0-255, can be negative)
    #     blend: x   : fog blend type (0: normal, 1: add, 2: subtract)
    #
    #  <actor light>      <event light>      <vehicle light>
    #  setting            setting            setting
    #  </actor light>     </event light>     </vehicle ligth>
    #   Create a light effect on actor, event or vehicle, add the following 
    #   values to the info. The ID, index and name must be added, other values
    #   are optional.
    #     id: x      : ligh effect ID
    #     name: "x"  : ligh effect graphic filename ("filename")
    #     index: x   : actor index, event id or (0: boat, 1: ship, 2: airship)
    #     opacity: x : light opacity (0-255)
    #     pos x: x   : coordinate X adjust
    #     pos y: x   : coordinate Y adjust
    #     var: x     : light opacity variation
    #     speed: x   : light variation speed
    #     zoom: x    : ligh effect zoom (100 = default size)
    #
    #  <map light>
    #  setting
    #  </map light>
    #   Create a light effect on a specific map postion, add the following 
    #   values to the info. The ID, map_x, map_y and name must be added, other
    #   values are optional.
    #     id: x      : ligh effect ID
    #     name: "x"  : ligh effect graphic filename ("filename")
    #     map x: x   : map X coordinate
    #     map y: x   : map Y coordinate
    #     opacity: x : light opacity (0-255)
    #     pos x: x   : coordinate X adjust
    #     pos y: x   : coordinate Y adjust
    #     var: x     : light opacity variation
    #     speed: x   : light variation speed
    #     zoom: x    : ligh effect zoom (100 = default size)
    #   
    #  <actor lantern i: o>
    #  <event lantern i: o>
    #  <vehicle lantern i: o>
    #   Call a lantern on the target character, lanterns are effets that
    #   lights the front of the character
    #     i : actor index, event id or (0: boat, 1: ship, 2: airship)
    #     o : light opacity (0-255)
    #
    #  <light opacity id: o, d>
    #   This tag allows to change the light opacity gradually
    #     i : light effect ID
    #     o : new opacity (0-255)
    #     d : wait until complete change (60 frames = 1 second)
    #
    #  <shade opacity: o, d>
    #   This tag allows to change the shade opacity gradually
    #     o : new opacity (0-255)
    #     d : wait until complete change (60 frames = 1 second)
    #
    #  <shade tone: r, g, b, d>
    #   This tag allows to change the shade opacity gradually
    #     r : red tone   (0-255, can be negative)
    #     g : green tone (0-255, can be negative)
    #     b : blue tone  (0-255, can be negative)
    #     d : wait until complete change (60 frames = 1 second)
    #
    #  <remove light: id>
    #   This tag allows remove a light effect
    #     id: ligh effect ID
    #
    #------------------------------------------------------------------------------
    # Maps note tags:
    #   Tags to be used on the Maps note box in the database
    #
    #  <create shade>
    #  setting
    #  </create shade>
    #   Create a shade effect on the map, add the following values to the setting.
    #    opacity: x : opacity (0-255)
    #    red: x     : red tone   (0-255, can be negative)
    #    green: x   : green tone (0-255, can be negative)
    #    blue: x    : blue tone  (0-255, can be negative)
    #    blend: x   : fog blend type (0: normal, 1: add, 2: subtract)
    #
    #  <actor light>      <event light>      <vehicle light>
    #  setting            setting            setting
    #  </actor light>     </event light>     </vehicle ligth>
    #   Create a light effect on actor, event or vehicle, add the following 
    #   values to the info. The ID, index and name must be added, other values
    #   are optional.
    #     id: x      : ligh effect ID
    #     name: "x"  : ligh effect graphic filename ("filename")
    #     index: x   : actor index, event id or (0: boat, 1: ship, 2: airship)
    #     opacity: x : light opacity (0-255)
    #     pos x: x   : coordinate X adjust
    #     pos y: x   : coordinate Y adjust
    #     var: x     : light opacity variation
    #     speed: x   : light variation speed
    #     zoom: x    : ligh effect zoom (100 = default size)
    #
    #  <map light>
    #  setting
    #  </map light>
    #   Create a light effect on a specific map postion, add the following 
    #   values to the info. The ID, map_x, map_y and name must be added, other
    #   values are optional.
    #     id: x      : ligh effect ID
    #     name: "x"  : ligh effect graphic filename ("filename")
    #     map x: x   : map X coordinate
    #     map y: x   : map Y coordinate
    #     opacity: x : light opacity (0-255)
    #     pos x: x   : coordinate X adjust
    #     pos y: x   : coordinate Y adjust
    #     var: x     : light opacity variation
    #     speed: x   : light variation speed
    #     zoom: x    : ligh effect zoom (100 = default size)
    #
    #  <actor lantern i: o>
    #  <event lantern i: o>
    #  <vehicle lantern i: o>
    #   Call a lantern on the target character, lanterns are effets that
    #   lights the front of the character
    #     i : actor index, event id or (0: boat, 1: ship, 2: airship)
    #     o : light opacity (0-255)
    #
    #------------------------------------------------------------------------------
    # Comment boxes note tags:
    #   Tags to be used on events Comment boxes. They're different from the
    #   comment call, they're called always the even refresh.
    #
    #  <custom light>
    #  settings
    #  </custom light>
    #   Create a custom light effect on actor, event or vehicle, add the following 
    #   values to the settings. The name must be added, other values
    #   are optional.
    #     name: "x"  : ligh effect graphic filename ("filename")
    #     opacity: x : light opacity (0-255)
    #     pos x: x   : coordinate X adjust
    #     pos y: x   : coordinate Y adjust
    #     var: x     : light opacity variation
    #     speed: x   : light variation speed
    #     zoom: x    : ligh effect zoom (100 = default size)
    #
    #  <simple light: o>
    #  <simple lamp: o>
    #  <simple torch: o>
    #  <simple window 1: o>
    #  <simple window 2: o>
    #   Simple light shortcuts
    #     o : new opacity (0-255)
    #
    #  <flash light: o>
    #  <flash lamp: o>
    #  <flash torch: o>
    #  <flash window 1: o>
    #  <flash window 2: o>
    #   Flashing light shortcuts
    #     o : new opacity (0-255)
    #
    #  <lantern: o>
    #   Lanterns shortcut
    #     o : new opacity (0-255)
    #
    #------------------------------------------------------------------------------
    # Additional instructions:
    #
    #  The lights are placed on the shade, so you *must* create a shade in order
    #  to display the lights. No shade, no lights.
    #
    #  The IDs of the light effects are used as identifiers. Don't use the
    #  same value for different light spots, if you do so, one light will
    #  replace the other. Also the IDs are used as referece to when
    #  removing lights and changing light opacity.
    #
    #  The actor lanter use the actor position in the party, NOT the actor ID.
    #  So the if you want a lantern for the first character, use 
    #  <actor lantern 1: o> (o = opacity)
    #
    #  About the error on line 1062: this is a USER error made by BAD setup.
    #  this happen when you assign a light effect to a event id that don't exist
    #  at the map. So please: DON'T REPORT IT ANYMORE.
    #
    #==============================================================================

    #==============================================================================
    # ** Victor Engine
    #------------------------------------------------------------------------------
    #   Setting module for the Victor Engine
    #==============================================================================

    module Victor_Engine
      
    #--------------------------------------------------------------------------
      # * required
      #   This method checks for the existance of the basic module and other
      #   VE scripts required for this script to work, don't edit this
      #--------------------------------------------------------------------------
      
    def self.required(namereqversiontype nil)
        if !
    $imported[:ve_basic_module]
          
    msg "The script '%s' requires the script\n"
          
    msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
          
    msg += "Go to http://victorscripts.wordpress.com/ to download this script."
          
    msgbox(sprintf(msgself.script_name(name), version))
          exit
        else
          
    self.required_script(namereqversiontype)
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * script_name
      #   Get the script name base on the imported value, don't edit this
      #--------------------------------------------------------------------------
      
    def self.script_name(nameext "VE")
        
    name name.to_s.gsub("_"" ").upcase.split
        name
    .collect! {|charchar == ext "#{char} -" char.capitalize }
        
    name.join(" ")
      
    end
    end

    $imported 
    ||= {}
    $imported[:ve_light_effects] = 1.11
    Victor_Engine
    .required(:ve_light_effects, :ve_basic_module1.27, :above)
    Victor_Engine.required(:ve_light_effects, :ve_map_battle1.00, :bellow)

    #==============================================================================
    # ** Cache
    #------------------------------------------------------------------------------
    #  This module loads each of graphics, creates a Bitmap object, and retains it.
    # To speed up load times and conserve memory, this module holds the created
    # Bitmap object in the internal hash, allowing the program to return
    # preexisting objects when the same bitmap is requested again.
    #==============================================================================

    module Cache
      
    #--------------------------------------------------------------------------
      # * New method: lights
      #--------------------------------------------------------------------------
      
    def self.lights(filename)
        
    self.load_bitmap('Graphics/Lights/'filename)
      
    end
    end

    #==============================================================================
    # ** Game_Screen
    #------------------------------------------------------------------------------
    #  This class handles screen maintenance data, such as change in color tone,
    # flashes, etc. It's used within the Game_Map and Game_Troop classes.
    #==============================================================================

    class Game_Screen
      
    #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      
    attr_reader   :lights
      attr_reader   
    :shade
      attr_accessor 
    :remove_light
      
    #--------------------------------------------------------------------------
      # * Alias method: clear
      #--------------------------------------------------------------------------
      
    alias :clear_ve_light_effects :clear
      def clear
        clear_ve_light_effects
        clear_lights
      end
      
    #--------------------------------------------------------------------------
      # * New method: clear_lights
      #--------------------------------------------------------------------------
      
    def clear_lights
        
    @lights = {}
        @
    remove_light = []
        @
    shade Game_ShadeEffect.new
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: lights
      #--------------------------------------------------------------------------
      
    def lights
        
    @lights ||= {}
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: remove_light
      #--------------------------------------------------------------------------
      
    def remove_light
        
    @remove_light ||= []
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: shade
      #--------------------------------------------------------------------------
      
    def shade
        
    @shade ||= Game_ShadeEffect.new
      
    end
    end

    #==============================================================================
    # ** Game_Map
    #------------------------------------------------------------------------------
    #  This class handles maps. It includes scrolling and passage determination
    # functions. The instance of this class is referenced by $game_map.
    #==============================================================================

    class Game_Map
      
    #--------------------------------------------------------------------------
      # * Alias method: setup
      #--------------------------------------------------------------------------
      
    alias :setup_ve_light_effects :setup
      def setup
    (map_id)
        
    setup_ve_light_effects(map_id)
        
    setup_lights_effect
      end
      
    #--------------------------------------------------------------------------
      # * New method: setup_lights_effect
      #--------------------------------------------------------------------------
      
    def setup_lights_effect
        setup_map_shade
    (note)
        
    setup_map_lights(:actornote)
        
    setup_map_lights(:eventnote)
        
    setup_map_lights(:vehiclenote)
        
    setup_map_lights(:mapnote)
        
    setup_map_lantern(:actornote)
        
    setup_map_lantern(:eventnote)
        
    setup_map_lantern(:vehiclenote)
      
    end
      
    #--------------------------------------------------------------------------
      # * New method: setup_map_shade
      #--------------------------------------------------------------------------
      
    def setup_map_shade(text)
        if 
    text =~ get_all_values("CREATE SHADE")
          
    info  = $1.dup
          shade 
    = @screen.shade
          shade
    .show
          shade
    .opacity info =~ /OPACITY: (\d+)/? $1.to_i 192
          shade
    .blend   info =~ /BLEND: (\d+)/i   ? $1.to_i 2
          red   
    info =~ /RED: (\d+)/i   ? $1.to_i 0
          green 
    info =~ /GREEN: (\d+)/? $1.to_i 0
          blue  
    info =~ /BLUE: (\d+)/i  ? $1.to_i 0
          shade
    .set_color(redgreenblue)
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * New method: setup_map_lights
      #--------------------------------------------------------------------------
      
    def setup_map_lights(typetext)
        
    value  get_regexp_value(type)
        
    text.scan(get_all_values("#{value} LIGHT")) do 
          
    light setup_light($1.duptype)
          @
    screen.lights[light.id] = light if light.id
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: setup_map_lantern
      #--------------------------------------------------------------------------
      
    def setup_map_lantern(typetext)
        
    value  get_regexp_value(type)
        
    regexp = /<#{value} LANTERN (\d+): (\d+)>/i  
        
    text.scan(regexp) do |indexopacity|
          
    target get_font(typeindex.to_i)
          
    next unless target 
          target
    .lantern opacity.to_i
          target
    .update_lantern
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_regexp_value
      #--------------------------------------------------------------------------
      
    def get_regexp_value(type)
        case 
    type
        when 
    :actor   then "ACTOR"
        
    when :event   then "EVENT"
        
    when :vehicle then "VEHICLE"
        
    when :map     then "MAP"
        
    end
      end
      
    #--------------------------------------------------------------------------
      # * New method: setup_light
      #--------------------------------------------------------------------------
      
    def setup_light(infotype)
        
    light Game_LightEffect.new
        
    light.name     info =~ /NAME#{get_filename}/i ? $1.dup : ""
        
    light.id       info =~ /ID: (\w+)/i         ? $1.to_s 0
        light
    .id       info =~ /ID: (\d+)/i         ? $1.to_i light.id
        light
    .x        info =~ /POS X: ([+-]?\d+)/? $1.to_i 0
        light
    .y        info =~ /POS Y: ([+-]?\d+)/? $1.to_i 0
        light
    .speed    info =~ /SPEED: (\d+)/i      ? $1.to_i 0
        light
    .zoom     info =~ /ZOOM: (\d+)/i       ? $1.to_f 100.0
        light
    .opacity  info =~ /OPACITY: (\d+)/i    ? $1.to_i 192
        light
    .variance info =~ /VAR: (\d+)/i        ? $1.to_i 0
        
    if type == :map
          map_x 
    info =~ /MAP X: (\d+)/? $1.to_i 0
          map_y 
    info =~ /MAP Y: (\d+)/? $1.to_i 0
          light
    .info = {xmap_xymap_y}
        else
          
    index info =~ /INDEX: (\d+)/? $1.to_i 0
          light
    .info = {type => index}
        
    end
        light
      end
      
    #--------------------------------------------------------------------------
      # * New method: set_light
      #--------------------------------------------------------------------------
      
    def set_light(idnameinfoop 00000100)
        
    light Game_LightEffect.new
        
    light.id       id
        light
    .name     name
        light
    .info     info
        light
    .opacity  op.to_i
        light
    .x        x.to_i
        light
    .y        y.to_i
        light
    .variance v.to_i
        light
    .speed    s.to_i
        light
    .zoom     z.to_f
        light
      end
      
    #--------------------------------------------------------------------------
      # * New method: get_font
      #--------------------------------------------------------------------------
      
    def get_font(typei)
        case 
    type
        when 
    :actor   then actors[1]
        
    when :event   then events[i]
        
    when :vehicle then vehicles[i]  
        
    end
      end
    end

    #==============================================================================
    # ** Game_CharacterBase
    #------------------------------------------------------------------------------
    #  This class deals with characters. Common to all characters, stores basic
    # data, such as coordinates and graphics. It's used as a superclass of the
    # Game_Character class.
    #==============================================================================

    class Game_CharacterBase
      
    #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      
    attr_accessor :lantern
      
    #--------------------------------------------------------------------------
      # * Alias method: init_public_members
      #--------------------------------------------------------------------------
      
    alias :init_public_members_ve_light_effects :init_public_members
      def init_public_members
        init_public_members_ve_light_effects
        
    @lantern 0
      end
      
    #--------------------------------------------------------------------------
      # * Alias method: update
      #--------------------------------------------------------------------------
      
    alias :update_ve_light_effects :update
      def update
        update_ve_light_effects
        update_lantern
      end
      
    #--------------------------------------------------------------------------
      # * New method: update_lantern
      #--------------------------------------------------------------------------
      
    def update_lantern(forced false)
        
    diag $imported[:ve_diagonal_move] && diagonal?
        if @
    lantern != && ((!diag && @lantern_direction != @direction) ||
           (
    diag && @lantern_direction != @diagonal) || forced)
          @
    lantern_direction = (diag ? @diagonal : @direction)
          
    light setup_lantern
          $game_map
    .screen.lights[light.id] = light
        elsif 
    @lantern == && @lantern_direction
          id 
    event? ? "EL#{@id}" "AL#{@id}"
          
    $game_map.screen.remove_light.push(id) if $game_map.screen.remove_light
          
    @lantern_direction nil
        end
      end
      
    #--------------------------------------------------------------------------
      # * New method: setup_lantern
      #--------------------------------------------------------------------------
      
    def setup_lantern
        id   
    event? ? "EL#{@id}" "AL#{@id}"
        
    type event? ? :event : :actor
        
    case @lantern_direction
        when 1
          name  
    'lantern_downleft'
          
    value = [idname, {type => @id}, @lantern, -4848]
        
    when 3
          name  
    'lantern_downright'
          
    value = [idname, {type => @id}, @lantern4848]
        
    when 2
          name  
    'lantern_down'
          
    value = [idname, {type => @id}, @lantern00]
        
    when 4
          name  
    'lantern_left'
          
    value = [idname, {type => @id}, @lantern00]
        
    when 6
          name  
    'lantern_right'
          
    value = [idname, {type => @id}, @lantern00]
        
    when 7
          name  
    'lantern_upleft'
          
    value = [idname, {type => @id}, @lantern, -48, -48]
        
    when 8
          name  
    'lantern_up'
          
    value = [idname, {type => @id}, @lantern00,]
        
    when 9
          name  
    'lantern_upright'
          
    value = [idname, {type => @id}, @lantern48, -48]
        
    end
        $game_map
    .set_light(*value)
      
    end  
    end

    #==============================================================================
    # ** Game_Event
    #------------------------------------------------------------------------------
    #  This class deals with events. It handles functions including event page 
    # switching via condition determinants, and running parallel process events.
    # It's used within the Game_Map class.
    #==============================================================================

    class Game_Event Game_Character
      
    #--------------------------------------------------------------------------
      # * Alias method: clear_starting_flag
      #--------------------------------------------------------------------------
      
    alias :clear_starting_flag_ve_light_effects :clear_starting_flag
      def clear_starting_flag
        clear_starting_flag_ve_light_effects
        
    @lantern 0
        $game_map
    .screen.remove_light.push("EV#{@id}")
        
    refresh_lights if @page
      end
      
    #--------------------------------------------------------------------------
      # * New method: refresh_lights
      #--------------------------------------------------------------------------
      
    def refresh_lights
        
    case note
        when 
    /<SIMPLE LIGHT: (\d+)?>/i
          set_light("EV#{@id}", "light", $1 ? $1 : 255)
        when /<SIMPLE LAMP: (\d+)?>/i
          set_light("EV#{@id}", "lamp", $1 ? $1 : 255)
        when /<SIMPLE TORCH: (\d+)?>/i
          set_light("EV#{@id}", "torch", $1)
        when /<SIMPLE WINDOW (\d+): (\d+)?>/i
          adj = $1 == "1" ? 0 : 14
          set_light("EV#{@id}", "window", $2 ? $2 : 255, 0, 0, 0, adj)
        when /<FLASH LIGHT: (\d+)?>/i
          set_light("EV#{@id}", "light", $1 ? $1 : 255, 30, 1)
        when /<FLASH LAMP: (\d+)?>/i
          set_light("EV#{@id}", "lamp", $1 ? $1 : 255, 30, 1)
        when /<FLASH TORCH: (\d+)?>/i
          set_light("EV#{@id}", "torch", $1 ? $1 : 255, 30, 1)
        when /<FLASH WINDOW (\d+): (\d+)?>/i
          adj = $1 == "1" ? 0 : 14
          set_light("EV#{@id}", "window", $2 ? $2 : 255, 30, 1, 0, adj)        
        when get_all_values("CUSTOM LIGHT")
          info = $1.dup
          n = info =~ /NAME: #{get_filename}/i ? $1.dup : ""
          x = info =~ /POS X: ([+-]?\d+)/i  ? $1.to_i : 0
          y = info =~ /POS Y: ([+-]?\d+)/i  ? $1.to_i : 0
          s = info =~ /SPEED: (\d+)/i       ? $1.to_i : 0
          z = info =~ /ZOOM: (\d+)/i        ? $1.to_f : 100.0
          o = info =~ /OPACITY: (\d+)/i     ? $1.to_i : 192
          v = info =~ /VAR: (\d+)/i         ? $1.to_i : 0
          set_light("EV#{@id}", n, o, v, s, x, y, z)       
        when /<LANTERN(?:: (\d+))?>/i
          @lantern = ($1 ? $1.to_i : 255)
        end
      end
      #--------------------------------------------------------------------------
      # * New method: set_light
      #--------------------------------------------------------------------------
      def set_light(id, name, op = 255, v = 0, s = 0, x = 0, y = 0, z = 100)
        value = [id, name, {:event => @id}, op, x, y, v, s, z].compact
        $game_map.screen.lights[id] = $game_map.set_light(*value)
        $game_map.screen.remove_light.delete(id)
      end  
    end

    #==============================================================================
    # ** Game_Interpreter
    #------------------------------------------------------------------------------
    #  An interpreter for executing event commands. This class is used within the
    # Game_Map, Game_Troop, and Game_Event classes.
    #==============================================================================

    class Game_Interpreter
      #--------------------------------------------------------------------------
      # * Alias method: comment_call
      #--------------------------------------------------------------------------
      alias :comment_call_ve_light_effects :comment_call
      def comment_call
        call_create_lights
        call_change_shade_opacity
        call_change_shade_tone
        call_change_light_opacity
        call_remove_light
        comment_call_ve_light_effects
      end
      #--------------------------------------------------------------------------
      # * New method: create_lights
      #--------------------------------------------------------------------------
      def call_create_lights
        $game_map.setup_map_shade(note)
        $game_map.setup_map_lights(:actor, note)
        $game_map.setup_map_lights(:event, note)
        $game_map.setup_map_lights(:vehicle, note)
        $game_map.setup_map_lights(:map, note)
        $game_map.setup_map_lantern(:actor, note)
        $game_map.setup_map_lantern(:event, note)
        $game_map.setup_map_lantern(:vehicle, note)
      end
      #--------------------------------------------------------------------------
      # * New method: call_change_shade_opacity
      #--------------------------------------------------------------------------
      def call_change_shade_opacity
        return if !$game_map.screen.shade.visible
        note.scan(/<SHADE OPACITY: ((?:\d+,? *){2})>/i) do
          if $1 =~ /(\d+) *,? *(\d+)?/i
            duration = $2 ? $2.to_i : 0
            $game_map.screen.shade.change_opacity($1.to_i, duration)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * New method: call_change_shade_tone
      #--------------------------------------------------------------------------
      def call_change_shade_tone
        return if !$game_map.screen.shade.visible
        note.scan(/<SHADE TONE: ((?:\d+,? *){4})>/i) do
          if $1 =~ /(\d+) *, *(\d+) *, *(\d+) *, *(\d+)/i
            $game_map.screen.shade.change_color($1.to_i, $2.to_i, $3.to_i, $4.to_i)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * New method: call_change_light_opacity
      #--------------------------------------------------------------------------
      def call_change_light_opacity
        return if !$game_map.screen.shade.visible
        note.scan(/<LIGHT OPACITY (\d+): ((?:\d+,? *){2})>/i) do
          light = $game_map.screen.lights[$1.to_i]
          if light && $2 =~ /(\d+) *,? *(\d+)?/i
            duration = $2 ? $2.to_i : 0
            light.change_opacity($1.to_i, duration)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * New method: call_remove_light
      #--------------------------------------------------------------------------
      def call_remove_light
        note.scan(/<REMOVE LIGHT: (\d+)>/i) do 
          $game_map.screen.remove_light.push($1.to_i)
        end
      end
    end

    #==============================================================================
    # ** Spriteset_Map
    #------------------------------------------------------------------------------
    #  This class brings together map screen sprites, tilemaps, etc. It's used
    # within the Scene_Map class.
    #==============================================================================

    class Spriteset_Map
      #--------------------------------------------------------------------------
      # * Alias method: initialize
      #--------------------------------------------------------------------------
      alias :initialize_ve_light_effects :initialize
      def initialize
        initialize_ve_light_effects
        2.times { update_light(true) }
      end
      #--------------------------------------------------------------------------
      # * Alias method: update
      #--------------------------------------------------------------------------
      alias :update_ve_light_effects :update
      def update
        update_ve_light_effects
        update_light
      end
      #--------------------------------------------------------------------------
      # * Alias method: dispose
      #--------------------------------------------------------------------------
      alias :dispose_ve_light_effects :dispose
      def dispose
        dispose_ve_light_effects
        dispose_light unless SceneManager.scene_is?(Scene_Map)
      end
      #--------------------------------------------------------------------------
      # * New method: update_light
      #--------------------------------------------------------------------------
      def update_light(forced = false)
        return unless Graphics.frame_count % 2 == 0 || forced
        update_shade
        update_effects
      end
      #--------------------------------------------------------------------------
      # * New method: dispose_light
      #--------------------------------------------------------------------------
      def dispose_light
        if @light_effect
          @light_effect.dispose
          @light_effect = nil
          @screen_shade = nil
        end
      end
      #--------------------------------------------------------------------------
      # * New method: update_shade
      #--------------------------------------------------------------------------
      def update_shade
        if !@light_effect && $game_map.screen.shade.visible
          refresh_lights
        elsif $game_map.screen.shade.visible && @light_effect
          @light_effect.update
        elsif @light_effect && !$game_map.screen.shade.visible
          dispose_light
        end
      end
      #--------------------------------------------------------------------------
      # * New method: refresh_lights
      #--------------------------------------------------------------------------
      def refresh_lights
        @light_effect.dispose if @light_effect
        @screen_shade = $game_map.screen.shade
        @light_effect = Sprite_Light.new(@screen_shade, @viewport2)
        $game_map.event_list.each {|event| event.refresh_lights }
        @light_effect.update
      end  
      #--------------------------------------------------------------------------
      # * New method: update_effects
      #--------------------------------------------------------------------------
      def update_effects
        return if !@light_effect || $game_map.screen.lights.empty?
        $game_map.screen.lights.keys.each {|key| create_light(key) }
        $game_map.screen.remove_light.clear
      end
      #--------------------------------------------------------------------------
      # * New method: create_light
      #--------------------------------------------------------------------------
      def create_light(key)
        effect = @light_effect.lights[key]
        return if remove_light(key)
        return if effect && effect.light == $game_map.screen.lights[key]
        @light_effect.create_light($game_map.screen.lights[key])
      end
      #--------------------------------------------------------------------------
      # * New method: remove_light
      #--------------------------------------------------------------------------
      def remove_light(key)
        return false if !$game_map.screen.remove_light.include?(key) 
        @light_effect.remove_light(key)
        $game_map.screen.lights.delete(key)
        return true
      end
    end

    #==============================================================================
    # ** Scene_Map
    #------------------------------------------------------------------------------
    #  This class performs the map screen processing.
    #==============================================================================

    class Scene_Map
      #--------------------------------------------------------------------------
      # * Alias method: pre_transfer
      #--------------------------------------------------------------------------
      alias :pre_transfer_ve_light_effects :pre_transfer
      def pre_transfer
        pre_transfer_ve_light_effects
        if $game_player.new_map_id !=  $game_map.map_id
          @spriteset.dispose_light
          $game_map.screen.clear_lights
        end
      end
      #--------------------------------------------------------------------------
      # * Alias method: post_transfer
      #--------------------------------------------------------------------------
      alias :post_transfer_ve_light_effects :post_transfer
      def post_transfer
        $game_map.actors.each {|actor| actor.update_lantern(true) }
        post_transfer_ve_light_effects
      end
    end

    #==============================================================================
    # ** Game_ShadeEffect
    #------------------------------------------------------------------------------
    #  This class handles the shade layer data
    #==============================================================================

    class Game_ShadeEffect
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :visible
      attr_reader   :color
      attr_accessor :blend
      attr_accessor :opacity
      #--------------------------------------------------------------------------
      # * initialize
      #--------------------------------------------------------------------------
      def initialize
        init_opacity
        init_color
      end
      #--------------------------------------------------------------------------
      # * init_opacity
      #--------------------------------------------------------------------------
      def init_opacity
        @visible = false
        @opacity = 0
        @opacity_target   = 0
        @opacity_duration = 0
      end
      #--------------------------------------------------------------------------
      # * init_color
      #--------------------------------------------------------------------------
      def init_color
        @blend = 0
        @color = Color.new(0, 0, 0, 0)
        @color_duration = 0
        @color_target   = Color.new(0, 0, 0, 0)
      end
      #--------------------------------------------------------------------------
      # * show
      #--------------------------------------------------------------------------
      def show
        @visible = true
      end
      #--------------------------------------------------------------------------
      # * hide
      #--------------------------------------------------------------------------
      def hide
        @visible = false
      end
      #--------------------------------------------------------------------------
      # * set_color
      #--------------------------------------------------------------------------
      def set_color(r = 0, g = 0, b = 0)
        @color        = get_colors(r, g, b)
        @color_target = @color.clone
      end
      #--------------------------------------------------------------------------
      # * change_opacity
      #--------------------------------------------------------------------------
      def change_opacity(op, d)
        @opacity_target   = op
        @opacity_duration = [d, 0].max
        @opacity = @opacity_target if @opacity_duration == 0
      end
      #--------------------------------------------------------------------------
      # * change_color
      #--------------------------------------------------------------------------
      def change_color(r, g, b, d)
        @color_target   = get_colors(r, g, b)
        @color_duration = [d, 0].max
        @color = @color_target.clone if @color_duration == 0
      end
      #--------------------------------------------------------------------------
      # * get_colors
      #--------------------------------------------------------------------------
      def get_colors(r, g, b)
        color = Color.new(255 - r, 255 - g, 255 - b, 255) if @blend == 2
        color = Color.new(r, g, b, 255) if @blend != 2
        color
      end
      #--------------------------------------------------------------------------
      # * update
      #--------------------------------------------------------------------------
      def update
        update_opacity
        update_color
      end
      #--------------------------------------------------------------------------
      # * update_opacity
      #--------------------------------------------------------------------------
      def update_opacity
        return if @opacity_duration == 0
        d = @opacity_duration
        @opacity = (@opacity * (d - 1) + @opacity_target) / d
        @opacity_duration -= 1
      end
      #--------------------------------------------------------------------------
      # * update_color
      #--------------------------------------------------------------------------
      def update_color
        return if @color_duration == 0
        d = @color_duration
        @color.red   = (@color.red   * (d - 1) + @color_target.red)   / d
        @color.green = (@color.green * (d - 1) + @color_target.green) / d
        @color.blue  = (@color.blue  * (d - 1) + @color_target.blue)  / d
        @color_duration -= 1
      end
    end

    #==============================================================================
    # ** Game_LightEffect
    #------------------------------------------------------------------------------
    #  This class handles the light sprite data
    #==============================================================================

    class Game_LightEffect
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :id
      attr_accessor :name
      attr_accessor :info
      attr_accessor :opacity
      attr_accessor :x
      attr_accessor :y
      attr_accessor :variance
      attr_accessor :speed
      attr_accessor :zoom
      attr_accessor :opacity_target
      attr_accessor :opacity_duration
      #--------------------------------------------------------------------------
      # * change_opacity
      #--------------------------------------------------------------------------
      def change_opacity(op, d)
        @opacity_target   = op
        @opacity_duration = [d, 0].max
        @opacity = @opacity_target if @opacity_duration == 0
      end
    end

    #==============================================================================
    # ** Game_LightBitmap
    #------------------------------------------------------------------------------
    #  This class handles the bitmpas of each light spot
    #==============================================================================

    class Game_LightBitmap
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :light
      attr_reader   :bitmap
      attr_reader   :opacity
      attr_reader   :x
      attr_reader   :y
      #--------------------------------------------------------------------------
      # * initialize
      #--------------------------------------------------------------------------
      def initialize(light)
        @light = light
        init_basic
        update
      end
      #--------------------------------------------------------------------------
      # * init_basic
      #--------------------------------------------------------------------------
      def init_basic
        @bitmap   = Cache.lights(@light.name)
        @target   = set_target
        @opacity  = @light.opacity
        @speed    = @light.speed
        @variance = 0.0
        @light.opacity_duration = 0
        @light.opacity_target   = 0
      end
      #--------------------------------------------------------------------------
      # * width
      #--------------------------------------------------------------------------
      def width
        @bitmap.width * @light.zoom / 100.0
      end
      #--------------------------------------------------------------------------
      # * height
      #--------------------------------------------------------------------------
      def height
        @bitmap.height * @light.zoom / 100.0
      end
      #--------------------------------------------------------------------------
      # * update
      #--------------------------------------------------------------------------
      def update
        update_position
        update_opacity
        update_variance
      end
      #--------------------------------------------------------------------------
      # * update_position
      #--------------------------------------------------------------------------
      def update_position
        @target.is_a?(Game_Character) ? character_position : map_position
      end
      #--------------------------------------------------------------------------
      # * character_position
      #--------------------------------------------------------------------------
      def character_position
        @x = $game_map.adjust_x(@target.real_x) * 32  - width / 2  + @light.x + 16
        @y = $game_map.adjust_y(@target.real_y) * 32  - height / 2 + @light.y + 16
      end
      #--------------------------------------------------------------------------
      # * map_position
      #--------------------------------------------------------------------------
      def map_position
        @x = $game_map.adjust_x(@target[:x]) * 32 - width / 2  + @light.x + 16
        @y = $game_map.adjust_y(@target[:y]) * 32 - height / 2 + @light.y + 16
      end
      #--------------------------------------------------------------------------
      # * change_opacity
      #--------------------------------------------------------------------------
      def change_opacity(op, d)
        @light.opacity_target   = op
        @light.opacity_duration = [d, 0].max
        @light.opacity = @light.opacity_target if @light.opacity_duration == 0
      end
      #--------------------------------------------------------------------------
      # * update_opacity
      #--------------------------------------------------------------------------
      def update_opacity
        return if @light.opacity_duration == 0
        d = @light.opacity_duration
        @light.opacity = (@light.opacity * (d - 1) + @light.opacity_target) / d
        @light.opacity_duration -= 1
      end
      #--------------------------------------------------------------------------
      # * update_variance
      #--------------------------------------------------------------------------
      def update_variance
        @variance += @speed 
        @speed *= -1 if @variance.abs > @light.variance.abs
        @opacity = [[@light.opacity + @variance, 0].max, 255].min
      end
      #--------------------------------------------------------------------------
      # * dispose
      #--------------------------------------------------------------------------
      def dispose
        @bitmap.dispose
      end
      #--------------------------------------------------------------------------
      # * set_target
      #--------------------------------------------------------------------------
      def set_target
        if @light.info.keys.include?(:actor)
          target = $game_map.actors[@light.info[:actor] - 1]
        elsif @light.info.keys.include?(:event)
          target = $game_map.events[@light.info[:event]]
        elsif @light.info.keys.include?(:vehicle)
          target = $game_map.vehicles[@light.info[:vehicle]]
        else
          target = @light.info
        end
        target
      end
    end

    #==============================================================================
    # ** Sprite_Light
    #------------------------------------------------------------------------------
    #  This sprite is used to display the light effects
    #==============================================================================

    class Sprite_Light < Sprite_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader :lights
      #--------------------------------------------------------------------------
      # * initialize
      #--------------------------------------------------------------------------
      def initialize(shade, viewport)
        super(viewport)
        @shade = shade
        self.bitmap     = Bitmap.new(Graphics.width, Graphics.height)
        self.blend_type = @shade.blend
        self.opacity    = @shade.opacity
        self.z = 100
        @lights = {}
      end
      #--------------------------------------------------------------------------
      # * map_x
      #--------------------------------------------------------------------------
      def map_x
        $game_map.adjust_x($game_map.display_x)
      end
      #--------------------------------------------------------------------------
      # * map_y
      #--------------------------------------------------------------------------
      def map_y
        $game_map.adjust_y($game_map.display_y) 
      end
      #--------------------------------------------------------------------------
      # * update
      #--------------------------------------------------------------------------
      def update
        super
        self.ox = map_x
        self.oy = map_y
        update_opacity
        update_lights
      end
      #--------------------------------------------------------------------------
      # * update lights
      #--------------------------------------------------------------------------
      def update_lights
        rect = Rect.new(map_x, map_y, Graphics.width, Graphics.height)
        self.bitmap.fill_rect(rect, color)
        draw_light_effects
      end
      #--------------------------------------------------------------------------
      # * color
      #--------------------------------------------------------------------------
      def color
        @shade.color
      end
      #--------------------------------------------------------------------------
      # * draw_light_effects
      #--------------------------------------------------------------------------
      def draw_light_effects
        @lights.values.each do |light|
          light.update
          next if !on_screen?(light)
          draw_light(light)
        end
      end
      #--------------------------------------------------------------------------
      # * on_sceen?
      #--------------------------------------------------------------------------
      def on_screen?(light)
        ax1 = light.x
        ay1 = light.y
        ax2 = light.x + light.width
        ay2 = light.y + light.height
        bx1 = map_x
        by1 = map_y
        bx2 = map_x + Graphics.width
        by2 = map_y + Graphics.height
        check1 = ax1.between?(bx1, bx2) || ax2.between?(bx1, bx2) ||
                 ax1 < bx1 && ax2 > bx2
        check2 = ay1.between?(by1, by2) || ay2.between?(by1, by2) ||
                 ay1 < by1 && ay2 > by2
        check1 && check2
      end
      #--------------------------------------------------------------------------
      # * draw_light
      #--------------------------------------------------------------------------
      def draw_light(light)
        img  = light.bitmap
        rect = Rect.new(light.x, light.y, light.width, light.height)
        self.bitmap.stretch_blt(rect, img, img.rect, light.opacity)
      end
      #--------------------------------------------------------------------------
      # * update_opacity
      #--------------------------------------------------------------------------
      def update_opacity
        @shade.update
        self.opacity    = @shade.opacity
        self.blend_type = @shade.blend
      end
      #--------------------------------------------------------------------------
      # * create_light
      #--------------------------------------------------------------------------
      def create_light(light)
        remove_light(light.id)
        @lights[light.id] = Game_LightBitmap.new(light)
      end
      #--------------------------------------------------------------------------
      # * remove_light
      #--------------------------------------------------------------------------
      def remove_light(id)
        @lights.delete(id) if @lights[id]
      end
      #--------------------------------------------------------------------------
      # * dispose
      #--------------------------------------------------------------------------
      def dispose
        super
        @lights.values.each {|light| light.dispose unless light.bitmap.disposed? }
      end
    end 

    собсна сам вопрос
    нужно создать лайт через скрипт, именно через скрипт, а именно вызов <actor lantern i: o>.
    даже если не через вызов в ивенте, то хотя бы отрывок кода, чтобы запихать его в свой скрипт

  3. #1333
    Местный Аватар для Riko
    Информация о пользователе
    Регистрация
    03.09.2015
    Адрес
    В самом днище....
    Сообщений
    218
    Репутация: 24 Добавить или отнять репутацию

    По умолчанию

    Всем здрасть
    Можно ли подправить скрипт?
    Собсно нужно чтобы вывод золота показывался не целым числом,а через запятую,как у Yanfly.
    Например не 12345678 а 12,345,678.Просто скрипт янфлая меняет показ золота только в стандартном меню,а на этот увы данная фишка не распространяется.Или может я чего не смог понять.
    Вложения Вложения
    Сталинская формула:
    Не согласен - критикуй, критикуешь - предлагай, предлагаешь - делай, делаешь - отвечай!

    Лицензионный RPG Maker MV. СПАСИБО ГНОМ!!!

  4. #1334
    Познающий Аватар для DeadElf79
    Информация о пользователе
    Регистрация
    09.08.2013
    Сообщений
    276
    Записей в дневнике
    12
    Репутация: 22 Добавить или отнять репутацию

    По умолчанию

    Лови готовый код, Рико!
    Код:
    #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    # ** One Hero Menu  **
    # 
    # Author:   eugene222
    # Version:  1.1
    # Date:     20.04.2014
    #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    #
    # * Changelog:
    #   
    #     20.04.2014:     Script Created
    #     06.05.2014:     Added option to scroll between actors
    #     
    #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    #
    # * Terms of Use:
    #
    #	You are free to use this script commercially or non-commercially as long as
    #   you credit me.
    #
    #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    # * Description:
    #
    #     Changes the look of the main menu to only show one actor
    #     You can configure the menu below.
    #
    #     The actors will scroll if you press the L and R Buttons.
    #     The L and R Buttons should be the Q and R Buttons on your Keyboard
    #     This function is similar to the scrolling in Scene_Status
    #
    #=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    module MenuConfig
      #-----------------------------------------------------------------------------
      # The positions of the command window:
      #   - possibilities: :left, :right, :top, :bot
      #-----------------------------------------------------------------------------
      CMD_POS = :top
     
      #-----------------------------------------------------------------------------
      # Enable or Disable the L and R Scroll Feature
      #-----------------------------------------------------------------------------
      LR_ACTOR_SCROLL = true  	
      
      #-----------------------------------------------------------------------------
      # Should the command window be a bit wider? (good if you use icons on text)
      # - this only works for left or right position command window
      #-----------------------------------------------------------------------------
      WIDER_COMMAND_MENU = false
          
      #-----------------------------------------------------------------------------
      # Show the Actor Name and Class over the face? => true
      # Show the Text and Face seperated => false
      #-----------------------------------------------------------------------------
      TEXT_OVER_FACE = false
          
      #-----------------------------------------------------------------------------
      # Which Lines should be shown?
      #-----------------------------------------------------------------------------
      LINES = [false, true, true, true]
          
      #-----------------------------------------------------------------------------
      # Below you can configure which parts will be shown and which not
      #-----------------------------------------------------------------------------
      SHOW = { # Diese Zeile nicht verдnder!
      #-----------------------------------------------------------------------------
            
        location:   true,     # Map-Name
        class_name: true,     # Class-Name
            
        icons:      true,     # State-Icons
            
        mp_gauge:   true,     # MP Gauge
        tp_gauge:   true,     # TP Gauge
        exp_gauge:  true,     # EXP Gauge
            
      #-----------------------------------------------------------------------------
      } # Diese Zeile nicht verдndern
      #-----------------------------------------------------------------------------
      # Put class-name one line lower if one gauge is deactivated and
      # TEXT_OVER_FACE is false?
      #-----------------------------------------------------------------------------
      CLASS_NAME_AUTO_POS = false
          
      #-----------------------------------------------------------------------------
      # Icon IDs:
      #-----------------------------------------------------------------------------
      LOCATION_ICON = 231
      GOLD_ICON = 361
          
      #-----------------------------------------------------------------------------
      # Colors for Text and Gauges:
      # The window-skin colors are used
      #-----------------------------------------------------------------------------
      COLOR_IDS = { # Diese Zeile nicht verдndern !
      #-----------------------------------------------------------------------------
          
        class_text:       2,
        name_text:        3,
        location_text:    6,
        gold_text:        0,
            
        exp_gauge_start:  14,
        exp_gauge_end:    6,
            
      #-----------------------------------------------------------------------------  
      } # Diese Zeile nicht verдndern !
      #-----------------------------------------------------------------------------
      # What will be shown at the bottom part of the menu?
      #     A one line text?                  => :objective
      #     - You can set the text with the Scriptcall: "set_menu_objective("Text")"
      #
      #     Your own variable and the gold?   => :variables
      #-----------------------------------------------------------------------------
          
      BOTTOM_AREA = :variables
          
      #-----------------------------------------------------------------------------
      # If BOTTOM_AREA = :variables
      #          [Variable-ID, Icon-Index, Text-Color (Window-Skin Index)]
      #-----------------------------------------------------------------------------
      VARIABLE = [1, 172, 0]  
         
      #-----------------------------------------------------------------------------
      # CONFIG END
      #-----------------------------------------------------------------------------
    end
    #===============================================================================
    # ** Game Party and Game Interpreter
    #===============================================================================
    if MenuConfig::BOTTOM_AREA == :objective
    #-------------------------------------------------------------------------------
    class Game_Party < Game_Unit
      attr_accessor   :objective_description
    end
    #-------------------------------------------------------------------------------
    class Game_Interpreter
      def set_menu_objective(obj)
        return unless obj.is_a? String
        $game_party.objective_description = obj
      end
    end
    #-------------------------------------------------------------------------------
    end
    #===============================================================================
    # ** Window Base
    #===============================================================================
    class Window_Base
      #-----------------------------------------------------------------------------
      # * Draw Horizontal Line
      #-----------------------------------------------------------------------------
      def draw_horz_line_e222(x, y, width = contents_width)
        line_y = y + line_height / 2 - 1
        contents.fill_rect(x, line_y, width, 2, line_color)
      end
      #-----------------------------------------------------------------------------
      # * Line Color
      #-----------------------------------------------------------------------------  
      def line_color
        color = normal_color
        color.alpha = 48
        color
      end
      #-----------------------------------------------------------------------------
      # * Draw Face With Rect
      #-----------------------------------------------------------------------------  
      def draw_face_with_rect(face_name, face_index, x, y)
        contents.fill_rect(x, y, 100, 100, Color.new(0, 0, 0, 128))
        contents.clear_rect(x + 2, y + 2, 96, 96)
        draw_face(face_name, face_index, x + 2, y + 2)
      end
      #-----------------------------------------------------------------------------
      # * Draw Paramaters In Two Rows
      #-----------------------------------------------------------------------------
      def draw_parameters_e222(actor, x, y, l_x = 160)
        6.times do |i|
          n_x = i > 2 ? l_x : x
          n_i = i % 3
          draw_actor_param(actor, n_x, y + line_height * n_i, i + 2) 
        end
      end
      #-----------------------------------------------------------------------------
      # * Draw Actor EXP Gauge
      #-----------------------------------------------------------------------------
      def draw_actor_exp_g(actor, x, y, width = 124)
        exp_now = actor.exp - actor.current_level_exp
        exp_need  = actor.next_level_exp.to_f - actor.current_level_exp
        exp_rate = actor.max_level? ? 1 : exp_now / exp_need
        draw_gauge(x, y, width, exp_rate, exp_color1, exp_color2)
        draw_actor_level(actor, x, y)
        exp_text = sprintf(sprintf '%d%%', 100 * exp_rate)
        draw_text(x + width - 42, y, 42, line_height, exp_text, 2)
      end
      #-----------------------------------------------------------------------------
      # * EXP Color 1
      #-----------------------------------------------------------------------------
      def exp_color1
        text_color(MenuConfig::COLOR_IDS[:exp_gauge_start])
      end
      #-----------------------------------------------------------------------------
      # * EXP Color 2
      #-----------------------------------------------------------------------------
      def exp_color2
        text_color(MenuConfig::COLOR_IDS[:exp_gauge_end])
      end
      #-----------------------------------------------------------------------------
    end
    #===============================================================================
    # ** Window One Actor Menu Status
    #===============================================================================
    class Window_OneMenuStatus < Window_Selectable
      #-----------------------------------------------------------------------------
      include MenuConfig
      #-----------------------------------------------------------------------------
      # * Initialize
      #-----------------------------------------------------------------------------
      def initialize(x)
        super(window_x(x), window_y, window_width, window_height)
        refresh
      end
      #-----------------------------------------------------------------------------
      # * Return Actor
      #-----------------------------------------------------------------------------
      def actor
        return $game_party.menu_actor if MenuConfig::LR_ACTOR_SCROLL
        $game_party.all_members.first
      end
      #-----------------------------------------------------------------------------
      # * Window X
      #-----------------------------------------------------------------------------
      def window_x(x)
        case CMD_POS
        when  :top, :bot
          (Graphics.width - window_width) / 2
        when :right
          WIDER_COMMAND_MENU ? 6 : 12
        else
          x + (WIDER_COMMAND_MENU ? 6 : 24)
        end 
      end
      #-----------------------------------------------------------------------------
      # * Window Y
      #-----------------------------------------------------------------------------
      def window_y
        case MenuConfig::CMD_POS
        when :left, :right
          (Graphics.height - window_height) / 2
        when :bot
          12
        else
          fitting_height(2) + 24
        end
      end
      #-----------------------------------------------------------------------------
      # * Window Width
      #-----------------------------------------------------------------------------
      def window_width
        Graphics.width - 164
      end
      #-----------------------------------------------------------------------------
      # * Window Height
      #-----------------------------------------------------------------------------
      def window_height
        Graphics.height - fitting_height(2) - 36
      end
      #-----------------------------------------------------------------------------
      # * Right Side X
      #-----------------------------------------------------------------------------
      def right_side_x
        contents.width - 140
      end
      #-----------------------------------------------------------------------------
      # * Name and Class alignment
      #-----------------------------------------------------------------------------
      def name_class_alignment
        MenuConfig::TEXT_OVER_FACE ? 1 : 0
      end
      #-----------------------------------------------------------------------------
      # * Refresh
      #-----------------------------------------------------------------------------
      def refresh
        contents.clear
        draw_lines
        draw_player_info
        draw_location(right_side_x, 0)
        draw_player_gauges
        draw_gold
        draw_bottom_area
      end
      #-----------------------------------------------------------------------------
      # * Draw Lines
      #-----------------------------------------------------------------------------
      def draw_lines
        if LINES[0]
          width = TEXT_OVER_FACE ? contents.width - 112 : contents.width
          x     = TEXT_OVER_FACE ? 112 : 0
          draw_horz_line_e222(x, 2, width)
        end
        draw_horz_line_e222(0, line_height * 5)   if LINES[1] 
        draw_horz_line_e222(0, line_height * 9)   if LINES[2]
        draw_horz_line_e222(0, line_height * 11)  if LINES[3]
      end
      #-----------------------------------------------------------------------------
      # * Draw Player Info
      #-----------------------------------------------------------------------------
      def draw_player_info
        draw_player_face
        draw_player_name
        draw_player_class
        draw_actor_icons(actor, 250, line_height * 1.5)
        draw_parameters_e222(actor, 0,  line_height * 6, contents.width - 156)
      end
      #-----------------------------------------------------------------------------
      # * Draw Player Face
      #-----------------------------------------------------------------------------
      def draw_player_face
        x = TEXT_OVER_FACE ? 6 : 0
        y = TEXT_OVER_FACE ? 12 : 24
        draw_face_with_rect(actor.face_name, actor.face_index, x, y)
      end
      #-----------------------------------------------------------------------------
      # * Draw Player Name
      #-----------------------------------------------------------------------------
      def draw_player_name
        change_color(text_color(COLOR_IDS[:name_text]))
        draw_text(0, 0, 112, line_height, actor.name, name_class_alignment)
      end
      #-----------------------------------------------------------------------------
      # * Draw Player Class
      #-----------------------------------------------------------------------------
      def draw_player_class
        return unless SHOW[:class_name]
        change_color(text_color(COLOR_IDS[:class_text]))
        x = TEXT_OVER_FACE ? 0 : 112 
        y_modifier = hide_any_gauge? ? 1 : 0 
        y = TEXT_OVER_FACE ? line_height * 4 : line_height * y_modifier 
        draw_text(x, y, 108, line_height, actor.class.name, name_class_alignment)
      end
      #-----------------------------------------------------------------------------
      # * Draw Location
      #-----------------------------------------------------------------------------
      def draw_location(x, y)
        return unless SHOW[:location]
        change_color(text_color(COLOR_IDS[:location_text]))
        draw_text(x, y, 112, line_height, $game_map.display_name, 2)
        draw_icon(LOCATION_ICON, x + 114, y)
      end
      #-----------------------------------------------------------------------------
      # * Draw PLayer Gauges
      #-----------------------------------------------------------------------------
      def draw_player_gauges
        if SHOW[:exp_gauge]
          draw_actor_exp_g(actor, 112, line_height * 4, contents.width - 112)
        end
        draw_actor_hp
        draw_actor_mp
        draw_actor_tp 
      end
      #-----------------------------------------------------------------------------
      # * Draw Actor HP
      #-----------------------------------------------------------------------------
      def draw_actor_hp
        y_modifier  = SHOW[:tp_gauge] ? 1 : 2
        y_modifier += (SHOW[:mp_gauge] ? 0 : 1)
        y_modifier += (SHOW[:exp_gauge] ? 0 : 1)
        super(actor, 112, line_height * y_modifier)
      end
      #-----------------------------------------------------------------------------
      # * Draw Actor MP
      #-----------------------------------------------------------------------------
      def draw_actor_mp
        return unless SHOW[:mp_gauge]
        y_modifier = SHOW[:tp_gauge] ? 2 : 3
        y_modifier += (SHOW[:exp_gauge] ? 0 : 1)
        super(actor, 112, line_height * y_modifier)
      end
      #-----------------------------------------------------------------------------
      # * Draw Actor TP
      #-----------------------------------------------------------------------------
      def draw_actor_tp
        return unless SHOW[:tp_gauge]
        y_modifier = SHOW[:exp_gauge] ? 3 : 4
        super(actor, 112, line_height * y_modifier)
      end
      #-----------------------------------------------------------------------------
      # * Draw State and Buff/Debuff Icons
      #-----------------------------------------------------------------------------
      def draw_actor_icons(actor, x, y)
        return unless SHOW[:icons]
        icons = (actor.state_icons + actor.buff_icons)[0, 8]
        icons.each_with_index do |n, i|
          n_y = i > 3 ? y + line_height : y
          n_i = i % 4
          draw_icon(n, x + 24 * n_i, n_y) 
        end
      end
      #-----------------------------------------------------------------------------
      # * Draw Buttom Area
      #-----------------------------------------------------------------------------
      def draw_bottom_area
       if BOTTOM_AREA == :objective
         draw_objective(0, line_height * 10)
        else
        end
      end
      #-----------------------------------------------------------------------------
      # * Draw Objective
      #-----------------------------------------------------------------------------
      def draw_objective(x, y)
        return unless $game_party.objective_description
        desc = $game_party.objective_description.gsub("\n", "")
        draw_text(x, y, contents.width, line_height, desc)
      end
      #-----------------------------------------------------------------------------
      # * Draw Gold
      #-----------------------------------------------------------------------------
      def draw_gold
        change_color(text_color(COLOR_IDS[:gold_text]))
        x = contents.width - 156
        y = line_height * (BOTTOM_AREA != :objective ? 10 : 11)
    
        str = $game_party.gold.to_s
        str.insert -10, "," if str.size > 9
        str.insert -7, ","  if str.size > 6
        str.insert -4, ","  if str.size > 3
    
        draw_text(x, y, 130, line_height, str, 2)
        draw_icon(MenuConfig::GOLD_ICON, x + 132, y)
      end
      #-----------------------------------------------------------------------------
      # * Is any Gauge deactivated?
      #-----------------------------------------------------------------------------
      def hide_any_gauge?
        !(SHOW[:mp_gauge] && SHOW[:tp_gauge] && SHOW[:exp_gauge]) &&
        CLASS_NAME_AUTO_POS
      end
      #-----------------------------------------------------------------------------
    end
    #===============================================================================
    # ** Window Menu Command
    #===============================================================================
    class Window_MenuCommand < Window_Command
      #-----------------------------------------------------------------------------
      # * Initialize
      #-----------------------------------------------------------------------------
      def initialize
        super(window_x, window_y)
        select_last
      end
      #-----------------------------------------------------------------------------
      # * Spacing
      #-----------------------------------------------------------------------------
      def spacing
        return 4
      end
      #-----------------------------------------------------------------------------
      # * Col Max
      #-----------------------------------------------------------------------------
      def col_max
        case MenuConfig::CMD_POS
        when :left, :right
          return 1
        else
          return 3
        end
      end
      #-----------------------------------------------------------------------------
      # * Window Width
      #-----------------------------------------------------------------------------
      def window_width
        case MenuConfig::CMD_POS
        when :left, :right
          return (MenuConfig::WIDER_COMMAND_MENU ? 152 : 128)
        else
          Graphics.width - 128 - 36
        end
      end
      #-----------------------------------------------------------------------------
      # * Window Height
      #-----------------------------------------------------------------------------
      def window_height
        case MenuConfig::CMD_POS
        when :left, :right
          fitting_height(visible_line_number)
        else
          fitting_height(2)
        end
      end
      #-----------------------------------------------------------------------------
      # * Window X
      #-----------------------------------------------------------------------------
      def window_x
        case MenuConfig::CMD_POS
        when :top, :bot
          (Graphics.width - window_width) / 2
        when :left
          MenuConfig::WIDER_COMMAND_MENU ? 6 : 12
        else
          Graphics.width - (MenuConfig::WIDER_COMMAND_MENU ? 158 : 140)
        end
      end
      #-----------------------------------------------------------------------------
      # * Window Y
      #-----------------------------------------------------------------------------
      def window_y
        case MenuConfig::CMD_POS
        when :left, :right
          (Graphics.height - (Graphics.height - fitting_height(2) - 36)) / 2
        when :top
          12
        else
          Graphics.height - fitting_height(2) - 36 + 24
        end
      end
      #-----------------------------------------------------------------------------
      # * Remove Formation Command
      #-----------------------------------------------------------------------------
      def add_formation_command
        return
      end
      #-----------------------------------------------------------------------------
    end
    #===============================================================================
    # ** Scene_Menu
    #===============================================================================
    class Scene_Menu < Scene_MenuBase
      #-----------------------------------------------------------------------------
      # * Start Processing
      #-----------------------------------------------------------------------------
      def start
        super
        create_command_window
        create_status_window
        override_handlers
      end
      #-----------------------------------------------------------------------------
      # * Override Handlers
      #-----------------------------------------------------------------------------
      def override_handlers
        @command_window.set_handler(:skill,     method(:command_skill))
        @command_window.set_handler(:equip,     method(:command_equip))
        @command_window.set_handler(:status,    method(:command_status))
    	@command_window.set_handler(:cancel,    method(:return_scene))
    	return unless MenuConfig::LR_ACTOR_SCROLL
    	@command_window.set_handler(:pagedown,  method(:next_actor))
        @command_window.set_handler(:pageup,    method(:prev_actor))
      end
      #-----------------------------------------------------------------------------
      # * Command Skill
      #-----------------------------------------------------------------------------
      def command_skill
        SceneManager.call(Scene_Skill)
      end
      #-----------------------------------------------------------------------------
      # * Command Equip
      #-----------------------------------------------------------------------------
      def command_equip
        SceneManager.call(Scene_Equip)
      end
      #-----------------------------------------------------------------------------
      # * Command Status
      #-----------------------------------------------------------------------------
      def command_status
        SceneManager.call(Scene_Status)
      end
      #-----------------------------------------------------------------------------
      # * Create Status Window
      #-----------------------------------------------------------------------------
      def create_status_window
        @status_window = Window_OneMenuStatus.new(@command_window.width)
      end
      #-----------------------------------------------------------------------------
      # On Actor Change
      #-----------------------------------------------------------------------------
      def on_actor_change
        @command_window.activate
        @status_window.refresh
      end
      #-----------------------------------------------------------------------------
      # Return Scene
      #-----------------------------------------------------------------------------
      def return_scene
        $game_party.menu_actor = $game_party.all_members.first
        super
      end
      #-----------------------------------------------------------------------------
    end
    #===============================================================================
    # ** SCRIPT END
    #===============================================================================
    Я решил эту задачу самым простым из возможных способов, но у тебя же не будет больше 999 миллионов золотом в игре, я надеюсь? ^_^

    Я не тестировал, я только читал код. Не сработает - скажи об этом.
    Последний раз редактировалось DeadElf79; 18.12.2015 в 09:13.

  5. #1335
    Познающий Аватар для DeadElf79
    Информация о пользователе
    Регистрация
    09.08.2013
    Сообщений
    276
    Записей в дневнике
    12
    Репутация: 22 Добавить или отнять репутацию

    По умолчанию

    HopeBree, по-моему, можно не писать отдельный код, а просто взять и использовать существующий.

    Хочешь решение? Вызови из ивента или скрипта примерно такой код:
    Код:
    $game_map.setup_map_lantern(:actor,"<actor lantern 1: 255>")
    Я не тестировал, я только читал код. Не сработает - скажи об этом.

  6. #1336
    Маститый Аватар для HopeBree
    Информация о пользователе
    Регистрация
    27.03.2013
    Сообщений
    1,204
    Записей в дневнике
    6
    Репутация: 38 Добавить или отнять репутацию

    По умолчанию

    Цитата Сообщение от DeadElf79 Посмотреть сообщение
    HopeBree, по-моему, можно не писать отдельный код, а просто взять и использовать существующий.

    Хочешь решение? Вызови из ивента или скрипта примерно такой код:
    Код:
    $game_map.setup_map_lantern(:actor,"<actor lantern 1: 255>")
    Я не тестировал, я только читал код. Не сработает - скажи об этом.
    мне был нужен именно код, для своего скрипта
    но я сделал по своему уже

  7. #1337
    Познающий Аватар для DeadElf79
    Информация о пользователе
    Регистрация
    09.08.2013
    Сообщений
    276
    Записей в дневнике
    12
    Репутация: 22 Добавить или отнять репутацию

    По умолчанию

    Так и из скрипта оно также вызывается. Ну ладно, решил и решил уже)

  8. #1338
    Местный Аватар для Riko
    Информация о пользователе
    Регистрация
    03.09.2015
    Адрес
    В самом днище....
    Сообщений
    218
    Репутация: 24 Добавить или отнять репутацию

    По умолчанию

    Цитата Сообщение от DeadElf79 Посмотреть сообщение
    Лови готовый код, Рико
    Спасибо,работает
    Да 999 лямов хватит для лимита
    Сталинская формула:
    Не согласен - критикуй, критикуешь - предлагай, предлагаешь - делай, делаешь - отвечай!

    Лицензионный RPG Maker MV. СПАСИБО ГНОМ!!!

  9. #1339
    Местный Аватар для Riko
    Информация о пользователе
    Регистрация
    03.09.2015
    Адрес
    В самом днище....
    Сообщений
    218
    Репутация: 24 Добавить или отнять репутацию

    По умолчанию

    Больше 999 лямов уже сам сделал,просто не от чего было оттолкнуться
    Сталинская формула:
    Не согласен - критикуй, критикуешь - предлагай, предлагаешь - делай, делаешь - отвечай!

    Лицензионный RPG Maker MV. СПАСИБО ГНОМ!!!

  10. #1340
    Маститый Аватар для HopeBree
    Информация о пользователе
    Регистрация
    27.03.2013
    Сообщений
    1,204
    Записей в дневнике
    6
    Репутация: 38 Добавить или отнять репутацию

    По умолчанию

    Цитата Сообщение от DeadElf79 Посмотреть сообщение
    Так и из скрипта оно также вызывается. Ну ладно, решил и решил уже)
    и кстати да, работает, правда мой способ громоздкий был

Страница 134 из 147 ПерваяПервая ... 3484124132133134135136144 ... ПоследняяПоследняя

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

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

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

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

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

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

Ваши права

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