Jump to content
Rpg²S Forum

Bartowski

Utenti
  • Posts

    27
  • Joined

  • Last visited

Posts posted by Bartowski

  1. Non so se è la sezione giusta comunque.....

    Ho fatto un chara molto simile(molto molto simile) al protagonista di "Chrono Trigger".

    Volevo un consiglio su come fare il secondo frame, per una corsa.

    La corsa,per "Chrono Trigger" ,sarebbero solo 2 frame,quando lo testo nel gioco non ottengo l'effetto desiderato.

    Quindi la mia domanda è:come devo posizionare il chara nel secondo frame? http://i60.tinypic.com/2rf9dgl.png

  2. Salve,

    per il mio progetto vorrei aggiungere una sorta di sistema di capriola,cioè,alla pressione del tasto "shift" il protagonista dovrebbe "slittare" a seconda della direzione di 1 o 2 caselle.

    Per l'effetto grafico ci penso io.

     

    P.s=Credo che si possa fare anche con un evento in comune,ma dopo 3 anni di uso di rpgmaker, non ho ancora capito come funzionino :( .

  3. D:Come posso far cambiare grafica quando l'eroe salta?? ( per non farli fare un salto statico, ma come:sonic,rayman e gentaglia)

     

    Per farlo saltare uso lo script ARC ENGINE

     

    #-------------------------------------------------------------------------------
    # * Arc Engine - Platform
    #-------------------------------------------------------------------------------
    # * By Khas Arcthunder
    # * Version: 1.0
    # * Released on: 10/09/2012
    #
    # * Blog: http://arcthunder.com/
    # * Forum: http://rgssx.com/
    # * Twitter: http://twitter.com/arcthunder
    # * Youtube: http://youtube.com/user/darkkhas
    #
    #-------------------------------------------------------------------------------
    # Terms of Use | Termos de Uso
    #-------------------------------------------------------------------------------
    # * ENGLISH
    # Read updated terms of use at http://arcthunder.com/terms
    #
    # * PORTUGUES
    # Leia os termos atualizados em http://arcthunder.com/termos
    #
    #-------------------------------------------------------------------------------
    # * Configuration | Configuração
    #-------------------------------------------------------------------------------
    module Arc_Sound

    # Jump SE volume
    # Volume do som de pulo
    Jump_Volume = 80

    # Groundpound SE volume
    # Volume do som de groundpound
    Groundpound_Volume = 80

    # List of jump sounds, by actor. Use:
    # actor_id => ["sound 1", "sound 2", ...],

    # Lista de sons de pulo, por ator. Use:
    # id_do_ator => ["som 1", "som 2", ...],
    Jump = {
    1 => ["Jump1"],

    }

    # List of groundpound sounds, by actor. Use:
    # actor_id => ["sound 1", "sound 2", ...],

    # Lista de sons de groundpound, por ator. Use:
    # id_do_ator => ["som 1", "som 2", ...],
    Groundpound = {
    1 => ["Damage2"],

    }

    # Don't touch here | Não mexa aqui
    def self.jump
    ary = Jump[$game_party.members[0].id]
    RPG::SE.new(ary[rand(ary.size)],Jump_Volume).play
    end

    # Don't touch here | Não mexa aqui
    def self.groundpound
    ary = Groundpound[$game_party.members[0].id]
    RPG::SE.new(ary[rand(ary.size)],Groundpound_Volume).play
    end
    end



    module Arc_Core

    # Gravity constant
    # Constante de gravidade
    Gravity = 0.6

    # Insignificant constant
    # Constante insignificante
    Insignificant = 0.9

    # Air resistance coefficient
    # Coeficiente de resistência do ar
    Air_Resistance = 4.0

    # Body resistance coefficient
    # Coeficiente de resistência do corpo
    Body_Resistance = 35.0

    # Body resistance coefficient (running)
    # Coeficiente de resistência do corpo (correndo)
    Running_Resistance = 20.0

    # Body resistance coefficient (stopping)
    # Coeficiente de resistência do corpo (parando)
    Stop_Resistance = 90.0

    # Jump impulse
    # Impulso do Pulo
    Jump_Impulse = -700.0

    # Jump impulse bonus
    # Bonus do impulso do pulo
    Jump_RBonus = -20.0

    # Key force
    # Força das teclas
    Key_Force = 50.0

    # Surface Tolerance (pixels)
    # Tolerância de superfície (pixels)
    Surface_T = 4

    # Wall kick impact center
    # Centro de impacto de chute
    WKick_OY = 4

    # Wall kick Tolerance (pixels)
    # Tolerância de Wall kick (pixels)
    WKick_T = 6

    # Wall kick impulse - X axis
    # Impulso do Wall kick - eixo X
    WKick_XImpulse = 800.0

    # Wall kick impulse - Y axis
    # Impulso do Wall kick - eixo Y
    WKick_YImpulse = -600.0

    # Wall kick deny radius - X
    # Negar Wall kick - raio X
    WKick_XRadius = 8

    # Wall kick deny radius - Y
    # Negar Wall kick - raio Y
    WKick_YRadius = 64

    # Meter (pixels)
    # Metro (pixels)
    Meter_Size = 20

    # Center constant - X
    # Contante de centro - X
    Map_CX = (Graphics.width / 32) / 2.0

    # Center constant - Y
    # Contante de centro - Y
    Map_CY = (Graphics.height / 32 + 1) / 2.0

    # Screen center constant - X
    # Contante de centro de tela - X
    Screen_CX = 272

    # Screen center constant - Y
    # Contante de centro de tela - Y
    Screen_CY = 208

    # Screen Tiles - X
    # Tiles na tela - X
    Screen_TX = Graphics.width / 32

    # Screen Tiles - Y
    # Tiles na tela - Y
    Screen_TY = Graphics.height / 32

    # Camera focus - X
    # Foco da camera - X
    Max_SX = 3

    # Camera focus - Y
    # Foco da camera - Y
    Max_SY = 3

    # Screen constant X
    # Constante de tela X
    On_ScreenX = 384

    # Screen constant Y
    # Constante de tela Y
    On_ScreenY = 336

    # Maximum AI approach
    # Aproximação de IA máxima
    AI_Approach = 16

    # Trigger distance - X
    # Distancia ativa - X
    Trigger_X = 16

    # Trigger distance - Y
    # Distancia ativa - Y
    Trigger_Y = 2

    # Stair constant
    # Constante de escada
    Stair_OY = 10

    # Stair speed
    # Velocidade de escada
    Stair_Speed = 2

    # Death switch
    # Switch da morte
    Death_Zone_Switch = 1

    # Death zone height
    # Altura da zona de morte
    Death_Zone_Height = 64


    # Default character height
    # Altura padrão
    Default_Height = 30

    # Default character width
    # Largura padrão
    Default_Width = 16

    # Default character weight
    # Massa padrão
    Default_Weight = 70

    # Axis plus
    # Adicional de eixo
    X_Axis = 16
    Y_Axis = 31

    # Collision Height
    # Altura de colisão
    Height_CL = 32

    # Zoom Window
    # Janela de zoom
    Enable_Zoom = true

    # Disable physics editor?
    # Desabilitar editor físico?
    Disable_Editor = false

    #-------------------------------------------------------------------------------
    # * Configuration end | Fim da configuração
    #-------------------------------------------------------------------------------

    AWC = Color.new(240,240,240)
    AWT = Color.new(255,255,255)
    AWB = Color.new(0,0,0,150)
    AWLB = Color.new(50,50,50,150)
    AWA = Color.new(150,255,255)
    AWF = Color.new(200,200,200)
    AWE = Color.new(255,0,0)
    AWH = Color.new(150,255,150)
    AWW = Color.new(50,50,255,150)
    COLORS = {
    0b0 => Color.new(0,0,0,0),
    0b1 => Color.new(255,0,0,200),
    0b100 => Color.new(0,255,0,200)}
    AWST = Color.new(255,255,0,150)
    def self.set_font(bitmap)
    bitmap.font.name = "Arial"
    bitmap.font.size = 14
    end
    TILE_RDG = 0x0
    CUSTOM_RDG = 0x1
    Max_Elevation = 1
    end

    #-------------------------------------------------------------------------------
    # * Input Core (by Khas Arcthunder)
    #-------------------------------------------------------------------------------

    module Input_Core
    State = Win32API.new('user32','GetKeyState','i','i')
    AsyncState = Win32API.new('user32','GetAsyncKeyState','i','i')
    SystemMetrics = Win32API.new('user32','GetSystemMetrics','i','i')
    GetCursorPos = Win32API.new('user32','GetCursorPos','p','v')
    GetWindowRect = Win32API.new('user32','GetWindowRect','lp','v')
    GameWindow = Win32API.new('user32','FindWindowEx','llpp','i').call(0,0,'RGSS Player',0)
    SM_CYCAPTION = SystemMetrics.call(0x4)
    SM_CXBORDER = SystemMetrics.call(0x5)
    SM_CYBORDER = SystemMetrics.call(0x6)
    SM_CXEDGE = SystemMetrics.call(0x2d)
    SM_CYEDGE = SystemMetrics.call(0x2e)
    Swap = SystemMetrics.call(0x17) != 0x0
    XPLUS = SM_CXBORDER + SM_CXEDGE
    YPLUS = SM_CYBORDER + SM_CYEDGE + SM_CYCAPTION
    Codes = {
    :ML => (Swap ? 2 : 1),
    :MR => (Swap ? 1 : 2),
    :MM => 4,
    :Backspace=> 8,
    :Enter => 13,
    :Shift => 16,
    :Ctrl => 17,
    :CapsLock => 20}
    Letters = {
    :A => 65,
    :B => 66,
    :C => 67,
    :D => 68,
    :E => 69,
    :F => 70,
    :G => 71,
    :H => 72,
    :I => 73,
    :J => 74,
    :K => 75,
    :L => 76,
    :M => 77,
    :N => 78,
    :O => 79,
    :P => 80,
    :Q => 81,
    :R => 82,
    :S => 83,
    :T => 84,
    :U => 85,
    :V => 86,
    :W => 87,
    :X => 88,
    :Y => 89,
    :Z => 90,
    :Underscore => 189}
    LettersTable = {
    :A => ["a","A"],
    :B => ["b","B"],
    :C => ["c","C"],
    :D => ["d","D"],
    :E => ["e","E"],
    :F => ["f","F"],
    :G => ["g","G"],
    :H => ["h","H"],
    :I => ["i","I"],
    :J => ["j","J"],
    :K => ["k","K"],
    :L => ["l","L"],
    :M => ["m","M"],
    :N => ["n","N"],
    :O => ["o","O"],
    :P => ["p","P"],
    :Q => ["q","Q"],
    :R => ["r","R"],
    :S => ["s","S"],
    :T => ["t","T"],
    :U => ["u","U"],
    :V => ["v","V"],
    :W => ["w","W"],
    :X => ["x","X"],
    :Y => ["y","Y"],
    :Z => ["z","Z"],
    :Underscore => ["-","_"]}
    Numbers = {0=>[48,96],1=>[49,97],2=>[50,98],3=>[51,99],4=>[52,100],
    5=>[53,101],6=>[54,102],7=>[55,103],8=>[56,104],9=>[57,105]}
    def self.trigger?(id)
    return AsyncState.call(Codes[id]) & 0b1 == 0b1
    end
    def self.toggled?(id)
    return State.call(Codes[id]) & 0b1 == 0b1
    end
    def self.press?(id)
    return State.call(Codes[id]) & 0x80 == 0x80
    end
    def self.check_number(id)
    return true if AsyncState.call(Numbers[id][0]) & 0b1 == 0b1
    return true if AsyncState.call(Numbers[id][1]) & 0b1 == 0b1
    return false
    end
    def self.any_number?
    for id in 0..9
    return id if AsyncState.call(Numbers[id][0]) & 0b1 == 0b1
    return id if AsyncState.call(Numbers[id][1]) & 0b1 == 0b1
    end
    return nil
    end
    def self.any_letter?
    for key in Letters.keys
    return key if AsyncState.call(Letters[key]) & 0b1 == 0b1
    end
    return nil
    end
    def self.letter_number?
    letter = Input_Core.any_letter?
    return letter if letter != nil
    return Input_Core.any_number?
    end
    def self.mpos
    packed_cp = '00000000'
    packed_wp = '0000000000000000'
    GetWindowRect.call(GameWindow,packed_wp)
    GetCursorPos.call(packed_cp)
    wx, wy = packed_wp.unpack('llll')[0..1]
    mx, my = packed_cp.unpack('ll')
    wx += XPLUS; wy += YPLUS
    return [mx-wx,my-wy]
    end
    def self.refresh_state
    for id in 0..9
    AsyncState.call(Numbers[id][0]) & 0b1 == 0b1
    AsyncState.call(Numbers[id][1]) & 0b1 == 0b1
    end
    for item in Letters.values
    AsyncState.call(item) & 0b1 == 0b1
    end
    for code in Codes.values
    AsyncState.call(code) & 0b1 == 0b1
    end
    end
    end

    #-------------------------------------------------------------------------------
    # * Sprite
    #-------------------------------------------------------------------------------

    class Sprite
    def ssx(tx,time)
    @ax = self.x
    @dx = (tx.to_f - @ax)/2
    @phase_x = Math::PI
    @speed_x = @phase_x/time
    @sliding_x = true
    end
    def ssy(ty,time)
    @ay = self.y
    @dy = (ty.to_f - @ay)/2
    @phase_y = Math::PI
    @speed_y = @phase_y/time
    @sliding_y = true
    end
    def update_slide
    unless @phase_x.nil?
    @phase_x -= @speed_x
    if @phase_x > 0
    self.x = @ax + @dx*(Math.cos(@phase_x)+1)
    else
    self.x = @ax + @dx*2
    @phase_x = nil
    @sliding_x = false
    end
    end
    unless @phase_y.nil?
    @phase_y -= @speed_y
    if @phase_y > 0
    self.y = @ay + @dy*(Math.cos(@phase_y)+1)
    else
    self.y = @ay + @dy*2
    @phase_y = nil
    @sliding_y = false
    end
    end
    end
    def sliding?
    @sliding_x || @sliding_y
    end
    end

    #-------------------------------------------------------------------------------
    # * Cache
    #-------------------------------------------------------------------------------

    class << Cache
    def custom_map(filename)
    load_bitmap("Graphics/Custom Maps/", filename)
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc MapCore
    #-------------------------------------------------------------------------------

    class Arc_MapCore
    include Arc_Core
    attr_reader :height
    attr_accessor :id
    attr_accessor :name
    attr_accessor :mode
    attr_accessor :background
    attr_accessor :main
    attr_accessor :top
    attr_accessor :table
    attr_accessor :water
    attr_accessor :ice
    attr_accessor :stairs
    attr_accessor :surface
    def initialize(i,n,m)
    @name = n
    @mode = m
    @id = i
    @background = ""
    @main = ""
    @top = ""
    @width = 0
    @height = 0
    @bsprite = nil
    @msprite = nil
    @tsprite = nil
    @tbitmap = nil
    end
    def load_sprites(viewport,bz,mz,tz)
    if @background != ""
    @bsprite = Sprite.new(viewport)
    @bsprite.bitmap = Cache.custom_map(@background)
    @bsprite.z = bz
    end
    if @main != ""
    @msprite = Sprite.new(viewport)
    @msprite.bitmap = Cache.custom_map(@main)
    @msprite.z = mz
    end
    if @top != ""
    @tsprite = Sprite.new(viewport)
    @tsprite.bitmap = Cache.custom_map(@top)
    @tsprite.z = tz
    end
    end
    def load_sprites_fe(viewport,bz,mz)
    if @background != ""
    @bsprite = Sprite.new(viewport)
    @bsprite.bitmap = Cache.custom_map(@background)
    @bsprite.z = bz
    end
    if @main != ""
    @msprite = Sprite.new(viewport)
    @msprite.bitmap = Cache.custom_map(@main)
    @msprite.z = mz
    end
    end
    def unload_sprites
    if @bsprite != nil
    @bsprite.dispose
    @bsprite = nil
    end
    if @msprite != nil
    @msprite.dispose
    @msprite = nil
    end
    if @tsprite != nil
    @tsprite.dispose
    @tsprite = nil
    end
    end
    def try_loadbackground
    return true if @background == ""
    test = Cache.custom_map(@background) rescue (return false)
    test.dispose
    test = nil
    return true
    end
    def try_loadmain
    return true if @main == ""
    test = Cache.custom_map(@main) rescue (return false)
    test.dispose
    test = nil
    return true
    end
    def try_loadtop
    return true if @top == ""
    test = Cache.custom_map(@top) rescue (return false)
    test.dispose
    test = nil
    return true
    end
    def compress
    loading = Arc_LWindow.new(0,240)
    loading.change_text("Compressing...")
    loading.enter
    fr = {}
    cl = []
    wr = []
    wl = []
    sr = {}
    psr = []
    pwater = []
    pice = []
    content = []
    rate = (@table.xsize+@table.ysize).to_f/100.0
    for x in 0...@table.xsize
    loading.progress(x/rate)
    fr[x] = []
    for y in 0...@table.ysize
    next if @table[x,y] == 0b0
    if @table[x,y] == 0b100
    if @table[x,y-1] == 0
    psr << [x,y]
    end
    next
    else
    if @table[x,y-1] == 0
    fr[x] << y
    end
    if @table[x,y+1] == 0
    cl << [x,y]
    end
    end
    end
    end
    for y in 0...@table.ysize
    loading.progress((@table.xsize+y)/rate)
    for x in 0...@table.xsize
    next if @table[x,y] != 0b1
    if @table[x-1,y] != 0b1
    wl << [x,y]
    end
    if @table[x+1,y] != 0b1
    wr << [x,y]
    end
    end
    end
    si = 9
    unless fr[0].empty?
    for y in fr[0]
    sr[si] = {}
    sr[si][0] = y
    @table[0,y] = si
    si += 1
    end
    end
    loading.change_text("Optimizing...")
    loading.clear_progress
    rate = fr.size.to_f/100.0
    for x in 1...fr.size
    loading.progress(x/rate)
    next if fr[x].empty?
    for y in fr[x]
    for i in (-Max_Elevation)..Max_Elevation
    if @table[x-1,y+i] > 6
    @table[x,y] = @table[x-1,y+i]
    sr[@table[x,y]][x] = y
    end
    end
    next if @table[x,y] > 6
    @table[x,y] = si
    sr[si] = {}
    sr[si][x] = y
    si += 1
    end
    end
    loading.progress(100)
    loading.change_text("Saving...",AWA)
    10.times do; Graphics.update; end
    content << "{"
    sr.keys.each { |key| content << "#{key.to_s}=>#{sr[key].to_s},"}
    content << "}\n"
    content << cl.to_s
    content << "\n"
    content << wr.to_s
    content << "\n"
    content << wl.to_s
    content << "\n"
    @water.each { |rect| pwater << [rect.x-1,rect.y-1,rect.x+rect.width,rect.y+rect.height]}
    content << pwater.to_s
    content << "\n"
    @ice.each { |rect| pice << [rect.x-1,rect.y-1,rect.x+rect.width,rect.y+rect.height]}
    content << pice.to_s
    content << "\n"
    content << @stairs.to_s
    content << "\n"
    content << psr.to_s
    content << "\n"
    File.open("Data/Arc#{@id}.rgss3a", 'w') {|file| file.write("") }
    content.each { |c| File.open("Data/Arc#{@id}.rgss3a", 'a') {|file| file.write© }}
    loading.leave
    loading = nil
    end
    def unload
    @surface = nil
    @table = nil
    @water = nil
    @ice = nil
    @stairs = nil
    unless @tbitmap == nil
    @tbitmapdispose
    @tbitmap = nil
    end
    end
    def load
    time = Time.now
    cl = 0; wr = 0; wl = 0; psr = 0
    cline = 1
    File.open("Data/Arc#{@id}.rgss3a",'r') do |file|
    file.each_line do |line|
    case cline
    when 1
    @surface = eval(line)
    when 2
    cl = eval(line)
    when 3
    wr = eval(line)
    when 4
    wl = eval(line)
    when 5
    @water = eval(line)
    when 6
    @ice = eval(line)
    when 7
    @stairs = eval(line)
    when 8
    psr = eval(line)
    end
    cline += 1
    end
    end
    @table = Table.new(@width,@height+Death_Zone_Height)
    wr.each {|c| @table[c[0],c[1]] = 8}
    wl.each {|c| @table[c[0],c[1]] = 8}
    cl.each {|c| @table[c[0],c[1]] = 8}
    psr.each {|c| @table[c[0],c[1]] = 7}
    @surface.keys.each{|key| @surface[key].keys.each {|c| @table[c,@surface[key][c]] = key}}
    for c in @stairs
    for addx in 0...16
    for addy in 0...16
    @table[c[0]+addx,c[1]+addy] = 1
    end
    end
    end
    print "Map #{@id} loaded in #{Time.now - time} secs\n"
    end
    def scan(map,tileset)
    @water = []
    @ice = []
    @stairs = []
    @mode == 0x1 && @msprite != nil ? scan_pixels : scan_tiles(map,tileset)
    end
    def scan_pixels
    @width = @msprite.width
    @height = @msprite.height
    loading = Arc_LWindow.new(0,240)
    loading.enter
    rate = @msprite.width.to_f/100.0
    @table = Table.new(@msprite.width,@msprite.height) #Collision Table
    @tbitmap = Bitmap.new(@table.xsize,@table.ysize)
    for x in 0...@table.xsize
    loading.progress(x/rate)
    for y in 0...@table.ysize
    next if @msprite.bitmap.get_pixel(x,y).alpha == 0
    @table[x,y] = 0b1
    @tbitmap.set_pixel(x,y,COLORS[0b1])
    end
    end
    loading.leave
    loading = nil
    end
    def scan_tiles(map,tileset)
    @width = map.width*32
    @height = map.height*32
    loading = Arc_LWindow.new(0,240)
    loading.enter
    rate = map.width.to_f/100.0
    @table = Table.new(map.width*32,map.height*32)
    @tbitmap = Bitmap.new(@table.xsize,@table.ysize)
    for x in 0...map.width
    loading.progress(x/rate)
    for y in 0...map.height
    if !check_passage(x,y,map,tileset)
    @tbitmap.fill_rect(x*32,y*32,32,32,COLORS[0b1])
    for ax in 0..31
    for ay in 0..31
    @table[x*32+ax,y*32+ay] = 0b1
    end
    end
    end
    end
    end
    loading.leave
    loading = nil
    end
    def check_passage(x,y,map,tileset)
    ([2,1,0].collect {|z| map.data[x,y,z] || 0 }).each do |tile_id|
    flag = tileset.flags[tile_id]
    next if flag & 0x10 != 0x0
    return true if flag & 0xf == 0x0
    return false if flag & 0xf == 0xf
    end
    return false
    end
    def get_table_bitmap
    return @tbitmap
    end
    def scroll_x(ax)
    @bsprite.x += ax if @bsprite != nil
    @msprite.x += ax if @msprite != nil
    @tsprite.x += ax if @tsprite != nil
    end
    def scroll_y(ay)
    @bsprite.y += ay if @bsprite != nil
    @msprite.y += ay if @msprite != nil
    @tsprite.y += ay if @tsprite != nil
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc WString
    #-------------------------------------------------------------------------------

    class Arc_WString
    def initialize(x,y,w,h,text,align,color)
    @x = x
    @y = y
    @w = w
    @h = h
    @text = text
    @align = align
    @color = color
    end
    def draw_at(bitmap)
    bitmap.font.color = @color
    bitmap.draw_text(@x,@y,@w,@h,@text,@align)
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc WItem
    #-------------------------------------------------------------------------------

    class Arc_WItem
    attr_accessor :active
    def initialize(x,y,w,h,text,align,active)
    @x = x
    @y = y
    @w = w
    @h = h
    @text = text
    @align = align
    @active = active
    end
    def draw_at(bitmap)
    bitmap.font.color = (@active ? Arc_Core::AWA : Arc_Core::AWF)
    bitmap.draw_text(@x,@y,@w,@h,@text,@align)
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc Whr
    #-------------------------------------------------------------------------------

    class Arc_Whr
    def initialize(y,w)
    @y = y
    @w = w
    end
    def draw_at(bitmap)
    bitmap.fill_rect(3,@y,@w-6,1,Arc_Core::AWC)
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc Window
    #-------------------------------------------------------------------------------

    class Arc_Window < Sprite
    attr_accessor :input_sensitive
    attr_accessor :is_vertical
    attr_accessor :active_index
    def initialize(x,y,width,height,opacity=0)
    super(nil)
    @input_sensitive = false
    @is_vertical = true
    @active_index = 0
    @contents = []
    @items = []
    self.x = x
    self.y = y
    @w = width
    @h = height
    self.bitmap = Bitmap.new(@w,@h)
    self.opacity = opacity
    Arc_Core.set_font(self.bitmap)
    draw_bg
    end
    def toggle
    @input_sensitive = !@input_sensitive
    end
    def hr(y)
    lh = Arc_Whr.new(y,@w)
    lh.draw_at(self.bitmap)
    @contents << lh
    end
    def draw_bg
    self.bitmap.fill_rect(0,1,@w,@h-2,Arc_Core::AWB)
    self.bitmap.fill_rect(1,0,@w-2,@h,Arc_Core::AWB)
    self.bitmap.fill_rect(2,1,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(2,@h-2,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(1,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.fill_rect(@w-2,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.set_pixel(2,2,Arc_Core::AWC)
    self.bitmap.set_pixel(2,@h-3,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,2,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,@h-3,Arc_Core::AWC)
    @bg = self.bitmap.clone
    end
    def redraw
    self.bitmap.clear
    self.bitmap = @bg.clone
    @contents.each { |ac| ac.draw_at(self.bitmap) }
    @items.each { |ai| ai.draw_at(self.bitmap) }
    end
    def erase_contents
    @contents.clear
    redraw
    end
    def erase_items
    @items.clear
    redraw
    end
    def draw_text(x,y,w,h,text,align=1,color=Arc_Core::AWC)
    w = @w if w == :w
    h = @h if h == :h
    string = Arc_WString.new(x,y,w,h,text,align,color)
    string.draw_at(self.bitmap)
    @contents << string
    end
    def add_item(x,y,w,h,text,align=1,active)
    w = @w if w == :w
    h = @h if h == :h
    item = Arc_WItem.new(x,y,w,h,text,align,active)
    item.draw_at(self.bitmap)
    @items << item
    end
    def update
    update_slide
    if @input_sensitive && @items.size > 0
    if @is_vertical
    if Input.trigger?(:UP)
    next_item(-1)
    elsif Input.trigger?(:DOWN)
    next_item(1)
    end
    else
    if Input.trigger?(:LEFT)
    next_item(-1)
    elsif Input.trigger?(:RIGHT)
    next_item(1)
    end
    end
    end
    end
    def next_item(dir)
    RPG::SE.new("Decision1",70,150).play
    @items.each { |i| i.active = false }
    @active_index += dir
    @active_index %= @items.size
    @items[@active_index].active = true
    redraw
    end
    def dispose
    @bg.dispose
    self.bitmap.dispose
    super
    end
    def draw_32rect(x,y,active)
    self.bitmap.fill_rect(x,y,32,1,active ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.fill_rect(x,y+31,32,1,active ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.fill_rect(x,y+1,1,30,active ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.fill_rect(x+31,y+1,1,30,active ? Arc_Core::AWA : Arc_Core::AWF)
    end
    def draw_icon(x,y,index,active)
    self.bitmap.blt(x,y,Cache.system("Iconset"),Rect.new(index%16*24,index/16*24,24,24),active ? 255 : 160)
    end
    def draw_brush(x,y,id)
    self.bitmap.fill_rect(x,y,32,32,Arc_Core::AWB)
    self.bitmap.blt(x,y,Cache.system("brushes"),Rect.new(id*32,0,32,32))
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc LWindow
    #-------------------------------------------------------------------------------

    class Arc_LWindow < Sprite
    def initialize(x,y,opacity=0)
    super(nil)
    self.x = x
    self.y = y
    self.z = 1000
    @w = 211
    @h = 56
    @last = 0
    self.ox = 106
    self.oy = 28
    self.bitmap = Bitmap.new(@w,@h)
    self.opacity = opacity
    Arc_Core.set_font(self.bitmap)
    draw_bg
    draw_text(0,4,@w,16," Arc Engine ",1,Arc_Core::AWC)
    draw_text(0,26,@w,16," Loading... ",1,Arc_Core::AWC)
    hr(22)
    loading_bg
    end
    def hr(y)
    Arc_Whr.new(y,@w).draw_at(self.bitmap)
    end
    def change_text(new_text,color=Arc_Core::AWC)
    self.bitmap.fill_rect(4,26,@w-8,16,Arc_Core::AWB)
    draw_text(0,26,@w,16," #{new_text} ",1,color)
    end
    def draw_bg
    self.bitmap.fill_rect(0,1,@w,@h-2,Arc_Core::AWB)
    self.bitmap.fill_rect(1,0,@w-2,@h,Arc_Core::AWB)
    self.bitmap.fill_rect(2,1,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(2,@h-2,@w-4,1,Arc_Core::AWC)
    self.bitmap.fill_rect(1,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.fill_rect(@w-2,2,1,@h-4,Arc_Core::AWC)
    self.bitmap.set_pixel(2,2,Arc_Core::AWC)
    self.bitmap.set_pixel(2,@h-3,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,2,Arc_Core::AWC)
    self.bitmap.set_pixel(@w-3,@h-3,Arc_Core::AWC)
    end
    def draw_text(x,y,w,h,text,align=1,color=Arc_Core::AWC)
    w = @w if w == :w
    h = @h if h == :h
    Arc_WString.new(x,y,w,h,text,align,color).draw_at(self.bitmap)
    end
    def loading_bg
    self.bitmap.fill_rect(5,44,201,1,Arc_Core::AWF)
    self.bitmap.fill_rect(5,49,201,1,Arc_Core::AWF)
    self.bitmap.fill_rect(5,45,1,4,Arc_Core::AWF)
    self.bitmap.fill_rect(205,45,1,4,Arc_Core::AWF)
    end
    def progress(rate)
    return if @last == rate.to_i
    @last = rate.to_i
    for i in 1..@last
    self.bitmap.fill_rect(4+i*2,45,1,4,Arc_Core::AWA)
    end
    Graphics.update
    end
    def clear_progress
    self.bitmap.fill_rect(6,45,199,4,Arc_Core::AWB)
    end
    def dispose
    self.bitmap.dispose
    super
    end
    def enter
    ssx(320,20)
    21.times do
    update_slide
    self.opacity += 13
    Graphics.update
    end
    end
    def leave
    progress(100)
    ssx(640,20)
    21.times do
    update_slide
    self.opacity -= 13
    Graphics.update
    end
    dispose
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc Button
    #-------------------------------------------------------------------------------

    class Arc_Button < Sprite
    attr_reader :label
    attr_reader :status
    attr_accessor :active
    def initialize(x,y,w,h,label,align,active)
    super(nil)
    self.x = x
    self.y = y
    self.bitmap = Bitmap.new(w,h)
    Arc_Core.set_font(self.bitmap)
    @w = w
    @h = h
    @label = label
    @align = align
    @active = active
    @status = false
    end
    def refresh(mx,my)
    return false unless @active
    @status = (mx >= self.x && mx < (self.x+@w)) && (my >= self.y && my < (self.y+@h))
    redraw
    end
    def redraw
    self.bitmap.clear
    self.bitmap.font.color = (@status ? Arc_Core::AWA : Arc_Core::AWF)
    self.bitmap.draw_text(0,0,@w,@h," #{@label} ",@align)
    end
    def dispose
    self.bitmap.dispose
    super
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc ZR
    #-------------------------------------------------------------------------------

    class Arc_ZR < Sprite
    attr_reader :rt
    def initialize(viewport)
    super(viewport)
    self.bitmap = Bitmap.new(34,34)
    self.bitmap.fill_rect(0,0,34,1,Color.new(255,255,255))
    self.bitmap.fill_rect(0,33,34,1,Color.new(255,255,255))
    self.bitmap.fill_rect(0,1,1,32,Color.new(255,255,255))
    self.bitmap.fill_rect(33,1,1,32,Color.new(255,255,255))
    self.z = 200
    set_pos(0,0)
    end
    def set_pos(rx,ry)
    self.x = rx - 1
    self.y = ry - 1
    self.x = -1 if self.x < -1
    self.x = 475 if self.x > 475
    self.y = -1 if self.y < -1
    self.y = 339 if self.y > 339
    end
    def dispose
    self.bitmap.dispose
    super
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc Interface
    #-------------------------------------------------------------------------------

    class Arc_Interface
    include Arc_Core
    def load
    unless try_load
    $map_data = {}
    save
    cmap_dir = Dir::pwd + "/Graphics/Custom Maps"
    unless FileTest::directory?(cmap_dir)
    Dir::mkdir(cmap_dir)
    end
    end
    end
    private
    def save
    File.open("Data/ArcData.rgss3a",'wb') {|file| Marshal.dump($map_data,file)}
    end
    def try_load
    File.open("Data/ArcData.rgss3a",'rb') {|data| $map_data = Marshal.load(data)} rescue (return false)
    return true
    end
    public
    def call_menu
    create_background
    main_menu
    dispose_background
    end
    def main_menu(fi=0)
    open_menu(fi)
    menu_loop
    end
    def menu_loop
    @action = nil
    loop do
    Graphics.update
    Input.update
    @menu_window.update
    @help_window.update
    if @index != @menu_window.active_index
    @index = @menu_window.active_index
    @help_window.erase_contents
    @help_window.draw_text(0,4,:w,16," Description ",1,AWT)
    @help_window.hr(22)
    case @index
    when 0
    @help_window.draw_text(4,26,248,16," Launch your game Scene_Title with Arc Engine",0,AWC)
    @help_window.draw_text(4,44,248,16," fully loaded.",0,AWC)
    when 1
    @help_window.draw_text(4,26,248,16," Start the Physics Editor.",0,AWC)
    @help_window.draw_text(4,44,248,16," You must load your maps at this editor to ",0,AWC)
    @help_window.draw_text(4,62,248,16," configure them. It will activate the",0,AWC)
    @help_window.draw_text(4,80,248,16," Pixel Perfect collision system.",0,AWC)
    @help_window.draw_text(4,116,248,16," Use your Keyboard and your Mouse to edit.",0,AWC)
    when 2
    @help_window.draw_text(4,26,248,16," Arc Engine - Platform v1.0",0,AWT)
    @help_window.draw_text(4,44,248,16," Created by Khas Arcthunder",0,AWC)
    @help_window.draw_text(4,80,248,16," Visit Arcthunder Blog for more!",0,AWC)
    @help_window.draw_text(4,98,248,16," http://arcthunder.com",0,AWA)
    @help_window.draw_text(4,116,248,16," http://rgssx.com",0,AWA)
    when 3
    @help_window.draw_text(4,26,248,16," Exit to RPG Maker VX Ace.",0,AWC)
    end
    end
    if Input.trigger?(:C)
    case @menu_window.active_index
    when 0
    RPG::SE.new("Decision2",80,100).play
    close_menu
    @action = :launch
    break
    when 1
    RPG::SE.new("Decision2",80,100).play
    close_menu
    @action = :editor
    break
    when 2
    RPG::SE.new("Decision2",80,100).play
    confirm_browser
    when 3
    RPG::SE.new("Decision2",80,100).play
    close_menu
    dispose_background
    exit
    end
    end
    end
    start_physics_editor if @action == :editor
    end
    def open_menu(force_index=0)
    mw = 128; mh = 208; hw = 256; hh = 208
    @menu_window = Arc_Window.new(544,208-mh/2,mw,mh)
    @help_window = Arc_Window.new(-hw,208-hh/2,hw,hh)
    @menu_window.ssx(272-(mw+hw+4)/2,30)
    @help_window.ssx(276-(mw+hw+4)/2+mw,30)
    @menu_window.draw_text(0,4,:w,16," Arc Engine ",1,AWT)
    @help_window.draw_text(0,4,:w,16," Description ",1,AWT)
    @menu_window.hr(22)
    @help_window.hr(22)
    @menu_window.add_item(4,26,96,16,"- Launch Game",0,force_index == 0)
    @menu_window.add_item(4,44,96,16,"- Physics Editor",0,force_index == 1)
    @menu_window.add_item(4,62,96,16,"- About Arc Engine",0,force_index == 2)
    @menu_window.add_item(4,80,96,16,"- Exit",0,force_index == 3)
    @menu_window.input_sensitive = true
    @menu_window.z = 100
    @help_window.z = 100
    @menu_window.active_index = force_index
    @index = 10
    20.times do
    Graphics.update
    @menu_window.update
    @help_window.update
    @menu_window.opacity += 10
    @help_window.opacity += 10
    end
    end
    def close_menu
    @menu_window.ssx(544,30)
    @help_window.ssx(-256,30)
    20.times do
    Graphics.update
    @menu_window.update
    @help_window.update
    @menu_window.opacity -= 10
    @help_window.opacity -= 10
    end
    @menu_window.dispose
    @help_window.dispose
    @menu_window = nil
    @help_window = nil
    end
    def confirm_browser
    close_menu
    @confirm_window = Arc_Window.new(144,416,256,96)
    @confirm_window.draw_text(0,4,:w,16," Arc Engine ",1,AWT)
    @confirm_window.hr(22)
    @confirm_window.draw_text(4,26,248,16," Press ENTER to open Arcthunder Blog or",0,AWC)
    @confirm_window.draw_text(4,44,248,16," press X to go back.",0,AWC)
    @confirm_window.draw_text(4,62,248,16," http://arcthunder.com",0,AWA)
    @confirm_window.ssy(160,20)
    @confirm_window.z = 20
    20.times do
    Graphics.update
    @confirm_window.opacity += 13
    @confirm_window.update
    end
    loop do
    Graphics.update
    Input.update
    @confirm_window.update
    if Input.trigger?(:C)
    RPG::SE.new("Decision2",80,100).play
    system("start http://arcthunder.com")
    elsif Input.trigger?(:B)
    RPG::SE.new("Decision2",80,100).play
    break
    end
    end
    @confirm_window.ssy(416,20)
    20.times do
    Graphics.update
    @confirm_window.opacity -= 13
    @confirm_window.update
    end
    @confirm_window.dispose
    @confirm_window = nil
    open_menu(2)
    end
    def create_background
    @background = Sprite.new
    @background.bitmap = Bitmap.new(544,416)
    @background.bitmap.fill_rect(0,0,544,416,Color.new(255,255,255))
    @super_background = Sprite.new
    @super_background.bitmap = Bitmap.new(544,416)
    for i in 0...96
    @super_background.bitmap.fill_rect(0,i,544,1,Color.new(0,0,0,96-i))
    @super_background.bitmap.fill_rect(0,415-i,544,1,Color.new(0,0,0,96-i))
    end
    @logo = Sprite.new
    @logo.bitmap = Cache.system("arc")
    @logo.z = 90
    @background.opacity = 0
    @super_background.opacity = 0
    @logo.opacity = 0
    30.times do
    @background.opacity += 9
    @super_background.opacity += 9
    @logo.opacity += 9
    Graphics.update
    end
    end
    def dispose_background
    30.times do
    @background.opacity -= 9
    @super_background.opacity -= 9
    @logo.opacity -= 9
    Graphics.update
    end
    @background.bitmap.dispose
    @background.dispose
    @background = nil
    @super_background.bitmap.dispose
    @super_background.dispose
    @super_background = nil
    @logo.bitmap.dispose
    @logo.dispose
    @logo = nil
    end
    def create_editorbg
    @background = Sprite.new
    @background.bitmap = Bitmap.new(640,480)
    @background.bitmap.fill_rect(0,0,640,480,Color.new(255,255,255))
    @super_background = Sprite.new
    @super_background.bitmap = Bitmap.new(640,480)
    for i in 0...96
    @super_background.bitmap.fill_rect(0,i,640,1,Color.new(0,0,0,96-i))
    @super_background.bitmap.fill_rect(0,479-i,640,1,Color.new(0,0,0,96-i))
    end
    @logo = Sprite.new
    @logo.bitmap = Cache.system("arc")
    @logo.x = 320
    @logo.z = 90
    @logo.ox = 272
    @background.opacity = 0
    @super_background.opacity = 0
    @logo.opacity = 0
    30.times do
    @background.opacity += 9
    @super_background.opacity += 9
    @logo.opacity += 9
    Graphics.update
    end
    end
    def start_physics_editor
    change_resolution
    show_nmw
    end
    def change_resolution
    dispose_background
    Graphics.resize_screen(640,480)
    load_brushes
    create_editorbg
    end
    def restore_resolution
    dispose_background
    Graphics.resize_screen(544,416)
    create_background
    end
    def show_nmw
    @new_window = Arc_Window.new(192,416,256,64)
    @new_window.draw_text(0,4,:w,16," Physics Editor ",1,AWT)
    @new_window.hr(22)
    @new_window.draw_text(4,26,124,16," Select Map:",2,AWC)
    @new_window.draw_text(128,26,124,16," Type Map ID ",0,AWA)
    @new_window.ssy(160,20)
    @new_window.z = 20
    20.times do
    Graphics.update
    @new_window.opacity += 13
    @new_window.update
    end
    @map_id = ""
    @action = nil
    @confirm = Arc_Button.new(256,204,64,16," Ok ",1,true)
    @cancel = Arc_Button.new(320,204,64,16," Cancel ",1,true)
    @confirm.z = 30
    @cancel.z = 30
    Input_Core.refresh_state
    loop do
    Graphics.update
    mpos = Input_Core.mpos
    num = Input_Core.any_number?
    @confirm.refresh(mpos[0],mpos[1])
    @cancel.refresh(mpos[0],mpos[1])
    if num != nil
    @map_id += num.to_s unless @map_id.size > 3
    @new_window.erase_contents
    @new_window.draw_text(0,4,:w,16," Physics Editor ",1,AWT)
    @new_window.hr(22)
    @new_window.draw_text(4,26,124,16," Select Map:",2,AWC)
    @new_window.draw_text(128,26,124,16," #{@map_id} ",0,AWA)
    elsif Input_Core.trigger?(:Backspace)
    @map_id[@map_id.size-1] = "" unless @map_id.size < 1
    @new_window.erase_contents
    @new_window.draw_text(0,4,:w,16," Physics Editor ",1,AWT)
    @new_window.hr(22)
    @new_window.draw_text(4,26,124,16," Select Map:",2,AWC)
    @new_window.draw_text(128,26,124,16," #{@map_id} ",0,AWA)
    elsif Input_Core.trigger?(:ML)
    if @confirm.status
    if load_map(@map_id.to_i)
    RPG::SE.new("Decision2",80,100).play
    @action = :confirm
    break
    else
    RPG::SE.new("Buzzer1",80,100).play
    @new_window.erase_contents
    @new_window.draw_text(0,4,:w,16," Physics Editor ",1,AWT)
    @new_window.hr(22)
    @new_window.draw_text(4,26,124,16," Select Map:",2,AWC)
    @new_window.draw_text(128,26,124,16," Invalid Map ",0,AWE)
    @map_id = ""
    end
    elsif @cancel.status
    RPG::SE.new("Decision2",80,100).play
    @action = :cancel
    break
    end
    end
    end
    @confirm.dispose
    @cancel.dispose
    @confirm = nil
    @cancel = nil
    @new_window.ssy(416,20)
    20.times do
    Graphics.update
    @new_window.opacity -= 13
    @new_window.update
    end
    @new_window.dispose
    @new_window = nil
    if @action == :cancel
    restore_resolution
    @brush_data.clear
    main_menu(1)
    elsif @action == :confirm
    @map_id.to_i
    @mapcore = Arc_MapCore.new(@map_id.to_i,@map.display_name,TILE_RDG)
    create_editor_windows
    @mapcore.scan(@map,@tileset)
    @collision = Sprite.new(@map_viewport)
    @collision.bitmap = @mapcore.get_table_bitmap
    @collision.z = 150
    @areas = Sprite.new(@map_viewport)
    @areas.bitmap = @collision.bitmap.clone
    @areas.bitmap.clear
    @areas.visible = false
    @areas.z = 150
    editor_loop
    end
    end
    def load_map(id)
    @map = load_data(sprintf("Data/Map%03d.rvdata2",id.to_i)) rescue (return false)
    return true
    end
    def select_map_options
    @options_window = Arc_Window.new(192,416,256,156)
    @options_window.draw_text(0,4,:w,16," Map Options ",1,AWT)
    @options_window.hr(22)
    @options_window.draw_text(4,26,248,16," Map ID: #{@mapcore.id}",0,AWC)
    @options_window.draw_text(4,44,248,16," Display Name: #{@mapcore.name == "" ? "No Name" : @mapcore.name}",0,AWC)
    @options_window.draw_text(4,62,248,16," Scan mode: #{@mapcore.mode == 0x0 ? "Default" : "Custom"}",0,AWC)
    @options_window.draw_text(4,80,248,16," Custom Background:",0,AWC)
    @options_window.draw_text(4,98,248,16," Custom Main:",0,AWC)
    @options_window.draw_text(4,116,248,16," Custom Top:",0,AWC)
    @rect = [124,[80,98,116],128,16,316,[222,240,258]]
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3]," disabled",2,AWC)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3]," disabled",2,AWC)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3]," disabled",2,AWC)
    @options_window.ssy(142,20)
    @options_window.z = 20
    20.times do
    Graphics.update
    @options_window.opacity += 13
    @options_window.update
    end
    @help_window = Arc_Window.new(0,0,168,112)
    @help_window.z = 40
    @confirm = Arc_Button.new(256,276,64,16," Scan ",1,true)
    @cancel = Arc_Button.new(320,276,64,16," Cancel ",1,true)
    @confirm.z = 30
    @cancel.z = 30
    @active_input = nil
    Input_Core.refresh_state
    loop do
    Graphics.update
    mpos = Input_Core.mpos
    letter = Input_Core.letter_number?
    @help_window.x = mpos[0]+18
    @help_window.y = mpos[1]+6
    @confirm.refresh(mpos[0],mpos[1])
    @cancel.refresh(mpos[0],mpos[1])
    if mpos[0] > 191 && mpos[0] < 444 && mpos[1] > 203 && mpos[1] < 220
    unless @help_window.active_index == 0
    @help_window.active_index = 0
    @help_window.opacity = 255
    @help_window.erase_contents
    @help_window.draw_text(4,4,160,16," Click to change scan mode.",0,AWH)
    @help_window.draw_text(4,22,160,16," If set to DEFAULT, your map",0,AWH)
    @help_window.draw_text(4,40,160,16," will be scanned by tiles.",0,AWH)
    @help_window.draw_text(4,58,160,16," If set to CUSTOM, your map's",0,AWH)
    @help_window.draw_text(4,76,160,16," main Custom Graphic will be",0,AWH)
    @help_window.draw_text(4,94,160,16," scanned by pixels.",0,AWH)
    end
    elsif mpos[0] > 191 && mpos[0] < 444 && mpos[1] > 221 && mpos[1] < 238
    unless @help_window.active_index == 1
    @help_window.active_index = 1
    @help_window.opacity = 255
    @help_window.erase_contents
    @help_window.draw_text(4,4,160,16," Click to add a Custom Graphic.",0,AWH)
    @help_window.draw_text(4,22,160,16," This graphic will be displayed",0,AWH)
    @help_window.draw_text(4,40,160,16," as your map background layer.",0,AWH)
    @help_window.draw_text(4,58,160,16," It must be located at ",0,AWH)
    @help_window.draw_text(4,76,160,16," Graphics/Custom Maps folder.",0,AWH)
    @help_window.draw_text(4,94,160,16," Extension must be omitted.",0,AWH)
    end
    elsif mpos[0] > 191 && mpos[0] < 444 && mpos[1] > 239 && mpos[1] < 256
    unless @help_window.active_index == 2
    @help_window.active_index = 2
    @help_window.opacity = 255
    @help_window.erase_contents
    @help_window.draw_text(4,4,160,16," Click to add a Custom Graphic.",0,AWH)
    @help_window.draw_text(4,22,160,16," This graphic will be displayed",0,AWH)
    @help_window.draw_text(4,40,160,16," as your map main layer.",0,AWH)
    @help_window.draw_text(4,58,160,16," It must be located at ",0,AWH)
    @help_window.draw_text(4,76,160,16," Graphics/Custom Maps folder.",0,AWH)
    @help_window.draw_text(4,94,160,16," Extension must be omitted.",0,AWH)
    end
    elsif mpos[0] > 191 && mpos[0] < 444 && mpos[1] > 257 && mpos[1] < 274
    unless @help_window.active_index == 3
    @help_window.active_index = 3
    @help_window.opacity = 255
    @help_window.erase_contents
    @help_window.draw_text(4,4,160,16," Click to add a Custom Graphic.",0,AWH)
    @help_window.draw_text(4,22,160,16," This graphic will be displayed",0,AWH)
    @help_window.draw_text(4,40,160,16," as your map top layer.",0,AWH)
    @help_window.draw_text(4,58,160,16," It must be located at ",0,AWH)
    @help_window.draw_text(4,76,160,16," Graphics/Custom Maps folder.",0,AWH)
    @help_window.draw_text(4,94,160,16," Extension must be omitted.",0,AWH)
    end
    else
    @help_window.active_index = nil
    @help_window.erase_contents
    @help_window.opacity = 0
    end
    if letter != nil
    letter.is_a?(Symbol) ? letter = Input_Core::LettersTable[letter][input_Core.toggled?(:CapsLock) || Input_Core.press?(:Shift) ? 1 : 0] : letter = letter.to_s
    case @active_input
    when 0; @mapcore.background += letter if @mapcore.background.size < 20
    when 1; @mapcore.main += letter if @mapcore.main.size < 20
    when 2; @mapcore.top += letter if @mapcore.top.size < 20
    end
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3],@mapcore.background.size == 0 ? " disabled" : " #{@mapcore.background}",2,@active_input == 0 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3],@mapcore.main.size == 0 ? " disabled" : " #{@mapcore.main}",2,@active_input == 1 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3],@mapcore.top.size == 0 ? " disabled" : " #{@mapcore.top}",2,@active_input == 2 ? AWA : AWC)
    elsif Input_Core.trigger?(:Backspace)
    case @active_input
    when 0; @mapcore.background[@mapcore.background.size-1] = "" unless @mapcore.background.size < 1
    when 1; @mapcore.main[@mapcore.main.size-1] = "" unless @mapcore.main.size < 1
    when 2; @mapcore.top[@mapcore.top.size-1] = "" unless @mapcore.top.size < 1
    end
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3],@mapcore.background.size == 0 ? " disabled" : " #{@mapcore.background}",2,@active_input == 0 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3],@mapcore.main.size == 0 ? " disabled" : " #{@mapcore.main}",2,@active_input == 1 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3],@mapcore.top.size == 0 ? " disabled" : " #{@mapcore.top}",2,@active_input == 2 ? AWA : AWC)
    elsif Input_Core.trigger?(:ML)
    @active_input = nil
    for i in 0..2
    @active_input = i if mpos[0] >= @rect[4] && mpos[0] < (@rect[4] + @rect[2]) && mpos[1] >= @rect[5][i] && mpos[1] < (@rect[5][i] + @rect[3])
    end
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3],@mapcore.background.size == 0 ? " disabled" : " #{@mapcore.background}",2,@active_input == 0 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3],@mapcore.main.size == 0 ? " disabled" : " #{@mapcore.main}",2,@active_input == 1 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3],@mapcore.top.size == 0 ? " disabled" : " #{@mapcore.top}",2,@active_input == 2 ? AWA : AWC)
    if @active_input == nil
    if mpos[0] > 191 && mpos[0] < 444 && mpos[1] > 203 && mpos[1] < 220
    @mapcore.mode = (@mapcore.mode == 0x0 ? 0x1 : 0x0)
    @options_window.bitmap.fill_rect(4,62,248,16,AWB)
    @options_window.bitmap.font.color = AWC
    @options_window.bitmap.draw_text(4,62,248,16," Scan mode: #{@mapcore.mode == 0x0 ? "Default" : "Custom"}")
    elsif @confirm.status
    if !@mapcore.try_loadbackground
    RPG::SE.new("Buzzer1",80,100).play
    @mapcore.background = ""
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3]," Invalid Graphic!",2,AWE)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3],@mapcore.main.size == 0 ? " disabled" : " #{@mapcore.main}",2,@active_input == 1 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3],@mapcore.top.size == 0 ? " disabled" : " #{@mapcore.top}",2,@active_input == 2 ? AWA : AWC)
    elsif !@mapcore.try_loadmain
    RPG::SE.new("Buzzer1",80,100).play
    @mapcore.main = ""
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3],@mapcore.background.size == 0 ? " disabled" : " #{@mapcore.background}",2,@active_input == 0 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3]," Invalid Graphic!",2,AWE)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3],@mapcore.top.size == 0 ? " disabled" : " #{@mapcore.top}",2,@active_input == 2 ? AWA : AWC)
    elsif !@mapcore.try_loadtop
    @mapcore.top = ""
    RPG::SE.new("Buzzer1",80,100).play
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][0],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][1],@rect[2],@rect[3],AWLB)
    @options_window.bitmap.fill_rect(@rect[0],@rect[1][2],@rect[2],@rect[3],AWLB)
    @options_window.draw_text(@rect[0],@rect[1][0],@rect[2],@rect[3],@mapcore.background.size == 0 ? " disabled" : " #{@mapcore.background}",2,@active_input == 0 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][1],@rect[2],@rect[3],@mapcore.main.size == 0 ? " disabled" : " #{@mapcore.main}",2,@active_input == 1 ? AWA : AWC)
    @options_window.draw_text(@rect[0],@rect[1][2],@rect[2],@rect[3]," Invalid Graphic!",2,AWE)
    else
    RPG::SE.new("Decision2",80,100).play
    @action = :confirm
    break
    end
    elsif @cancel.status
    RPG::SE.new("Decision2",80,100).play
    @action = :cancel
    break
    end
    end
    end
    end
    @confirm.dispose
    @cancel.dispose
    @confirm = nil
    @cancel = nil
    @help_window.dispose
    @help_window = nil
    @options_window.ssy(416,20)
    20.times do
    Graphics.update
    @options_window.opacity -= 13
    @options_window.update
    end
    @options_window.dispose
    @options_window = nil
    case @action
    when :confirm
    create_editor_windows
    @mapcore.scan(@map,@tileset)
    @collision = Sprite.new(@map_viewport)
    @collision.bitmap = @mapcore.get_table_bitmap
    @collision.z = 150
    @areas = Sprite.new(@map_viewport)
    @areas.bitmap = @collision.bitmap.clone
    @areas.bitmap.clear
    @areas.visible = false
    @areas.z = 150
    editor_loop
    when :cancel
    show_nmw
    end
    end
    def editor_loop
    loop do
    Graphics.update
    Input.update
    mpos = Input_Core.mpos
    @confirm.refresh(mpos[0],mpos[1])
    @cancel.refresh(mpos[0],mpos[1])
    if @tilegrid
    if mpos[0] > 7 && mpos[0] < 516 && mpos[1] > 99 && mpos[1] < 472
    @brush.x = mpos[0] - 16 - (mpos[0]-24) % 32 + @collision.x % 32
    @brush.y = mpos[1] - 16 - (mpos[1]-20) % 32 + @collision.y % 32
    end
    else
    @brush.x = mpos[0]-16
    @brush.y = mpos[1]-16
    end
    case Input.dir4
    when 2
    if @collision.y > (372-@collision.height)
    @collision.y -= 4
    @areas.y -= 4
    @tilemap.oy += 4
    @mapcore.scroll_y(-4)
    refresh_preview
    end
    when 4
    if @collision.x < 0
    @collision.x += 4
    @areas.x += 4
    @tilemap.ox -= 4
    @mapcore.scroll_x(4)
    refresh_preview
    end
    when 6
    if @collision.x > (508-@collision.width)
    @collision.x -= 4
    @areas.x -= 4
    @tilemap.ox += 4
    @mapcore.scroll_x(-4)
    refresh_preview
    end
    when 8
    if @collision.y < 0
    @collision.y += 4
    @areas.y += 4
    @tilemap.oy -= 4
    @mapcore.scroll_y(4)
    refresh_preview
    end
    end
    if Input_Core.press?(:ML) && @active_mode == 0
    if mpos[0] > 7 && mpos[0] < 516 && mpos[1] > 99 && mpos[1] < 472
    apply_brush(0b1)
    elsif mpos[0] > 531 && mpos[0] < 628 && mpos[1] > 371 && mpos[1] < 468
    set_pixel((mpos[0]-529)/3+@zoom_rect.x-@collision.x,(mpos[1]-369)/3+@zoom_rect.y-@collision.y,0b1)
    end
    elsif Input_Core.press?(:MR) && @active_mode == 0
    if mpos[0] > 7 && mpos[0] < 516 && mpos[1] > 99 && mpos[1] < 472
    apply_brush(0b0)
    elsif mpos[0] > 531 && mpos[0] < 628 && mpos[1] > 371 && mpos[1] < 468
    set_pixel((mpos[0]-529)/3+@zoom_rect.x-@collision.x,(mpos[1]-369)/3+@zoom_rect.y-@collision.y,0b0)
    end
    elsif Input_Core.press?(:MM) && @active_mode == 0
    if mpos[0] > 7 && mpos[0] < 516 && mpos[1] > 99 && mpos[1] < 472
    apply_brush(0b100)
    elsif mpos[0] > 531 && mpos[0] < 628 && mpos[1] > 371 && mpos[1] < 468
    set_pixel((mpos[0]-529)/3+@zoom_rect.x-@collision.x,(mpos[1]-369)/3+@zoom_rect.y-@collision.y,0b100)
    end
    elsif Input.press?(:CTRL)
    @zoom_rect.set_pos(mpos[0]-23,mpos[1]-115)
    refresh_preview
    elsif Input_Core.trigger?(:ML)
    if @confirm.status
    RPG::SE.new("Decision2",80,100).play
    @action = :confirm
    break
    elsif @cancel.status
    RPG::SE.new("Decision2",80,100).play
    @action = :cancel
    break
    elsif @active_mode != 0 && mpos[0] > 7 && mpos[0] < 516 && mpos[1] > 99 && mpos[1] < 472
    if @active_mode == 3
    toggle_stair(mpos)
    else
    @area_mode == 0 ? @area_vert1 = [mpos[0]-8-@collision.x,mpos[1]-100-@collision.y] : delete_area(mpos)
    end
    elsif mpos[0] > 527 && mpos[0] < 632 && mpos[1] > 197 && mpos[1] < 214
    if @active_mode == 0
    @active_mode = 3
    refresh_areas
    @areas.visible = true
    @brush.visible = false
    @collision.visible = false
    @brush_window.bitmap.font.color = AWA
    @brush_window.bitmap.fill_rect(4,98,104,16,Arc_Core::AWB)
    @brush_window.bitmap.draw_text(4,98,104,16," Stairs ",1)
    elsif @active_mode == 3
    @active_mode = 0
    @areas.visible = false
    @brush.visible = true
    @collision.visible = true
    @brush_window.bitmap.font.color = AWC
    @brush_window.bitmap.fill_rect(4,98,104,16,Arc_Core::AWB)
    @brush_window.bitmap.draw_text(4,98,104,16," Stairs ",1)
    end
    elsif mpos[0] > 527 && mpos[0] < 632 && mpos[1] > 179 && mpos[1] < 196 && @active_mode == 0
    @tilegrid = !@tilegrid
    @brush_window.bitmap.font.color = (@tilegrid ? AWA : AWC)
    @brush_window.bitmap.fill_rect(4,80,104,16,Arc_Core::AWB)
    @brush_window.bitmap.draw_text(4,80,104,16," Tile Grid",1)
    @brush.x = 8
    @brush.y = 100
    elsif mpos[1] > 99 && mpos[1] < 132
    if mpos[0] > 527 && mpos[0] < 560
    @active_mode = 0
    @areas.visible = false
    @brush.visible = true
    @collision.visible = true
    @brush_window.erase_contents
    @brush_window.bitmap.fill_rect(4,4,104,96,Arc_Core::AWB)
    @brush_window.draw_text(40,48,68,16," Brush",0,@active_mode == 0 ? AWA : AWF)
    @brush_window.draw_brush(4,40,@active_brush)
    @brush_window.draw_32rect(4,4,@active_mode == 0)
    @brush_window.draw_32rect(40,4,@active_mode == 1)
    @brush_window.draw_32rect(76,4,@active_mode == 2)
    @brush_window.draw_icon(8,8,28,@active_mode == 0)
    @brush_window.draw_icon(44,8,107,@active_mode == 1)
    @brush_window.draw_icon(80,8,105,@active_mode == 2)
    @brush_window.bitmap.font.color = (@tilegrid ? AWA : AWC)
    @brush_window.bitmap.draw_text(4,80,104,16," Tile Grid",1)
    @brush_window.bitmap.font.color = AWC
    @brush_window.bitmap.draw_text(4,98,104,16," Stairs ",1)
    @brush_window.bitmap.draw_text(4,260,104,16," Zoom ",1)
    elsif mpos[0] > 563 && mpos[0] < 596
    RPG::SE.new("Buzzer1",80,100).play
    elsif mpos[0] > 599 && mpos[0] < 632
    RPG::SE.new("Buzzer1",80,100).play
    end
    elsif @active_mode == 0 && mpos[0] > 527 && mpos[0] < 632 && mpos[1] > 139 && mpos[1] < 172
    @active_brush = (@active_brush + 1) % 8
    @brush.bitmap.clear
    @brush.bitmap.blt(0,0,Cache.system("brushes"),Rect.new(@active_brush*32,0,32,32))
    @brush_window.draw_brush(4,40,@active_brush)
    elsif @active_mode == 1 || @active_mode == 2
    if mpos[0] > 527 && mpos[0] < 632 && mpos[1] > 139 && mpos[1] < 156
    @area_mode = 0
    @brush_window.bitmap.fill_rect(4,44,104,34,Arc_Core::AWB)
    @brush_window.draw_text(0,44,:w,16," Add Area ",1,AWA)
    @brush_window.draw_text(0,62,:w,16," Delete Area ",1,AWF)
    elsif mpos[0] > 527 && mpos[0] < 632 && mpos[1] > 147 && mpos[1] < 174
    @area_mode = 1
    @brush_window.bitmap.fill_rect(4,44,104,34,Arc_Core::AWB)
    @brush_window.draw_text(0,44,:w,16," Add Area ",1,AWF)
    @brush_window.draw_text(0,62,:w,16," Delete Area ",1,AWA)
    end
    end
    elsif Input_Core.trigger?(:MR)
    if mpos[0] > 7 && mpos[0] < 516 && mpos[1] > 99 && mpos[1] < 472 && (@active_mode == 1 || @active_mode == 2)
    @area_vert2 = [mpos[0]-8-@collision.x,mpos[1]-100-@collision.y] if @area_mode == 0
    end
    elsif Input.trigger?(:C)
    if @active_mode == 1 || @active_mode == 2
    if @area_mode == 0 && ((@area_vert1[0] - @area_vert2[0]).abs > 0) && ((@area_vert1[1] - @area_vert2[1]).abs > 0)
    x1 = (@area_vert1[0] <= @area_vert2[0] ? @area_vert1[0] : @area_vert2[0])
    x2 = (@area_vert1[0] <= @area_vert2[0] ? @area_vert2[0] : @area_vert1[0])
    y1 = (@area_vert1[1] <= @area_vert2[1] ? @area_vert1[1] : @area_vert2[1])
    y2 = (@area_vert1[1] <= @area_vert2[1] ? @area_vert2[1] : @area_vert1[1])
    x1 -= x1 % 32
    y1 -= y1 % 32
    x2 -= x2 % 32
    y2 -= y2 % 32
    x2 += 32
    y2 += 32
    add_area(Rect.new(x1,y1,x2-x1,y2-y1))
    end
    end
    end
    end
    @mapcore.unload_sprites
    case @action
    when :confirm
    dispose_editor_windows
    @mapcore.compress
    @mapcore.unload
    $map_data[@mapcore.id] = @mapcore
    save
    show_nmw
    when :cancel
    dispose_editor_windows
    @mapcore = Arc_MapCore.new(@map_id.to_i,@map.display_name,TILE_RDG)
    show_nmw
    end
    end
    def refresh_preview
    return unless Enable_Zoom
    prv = Graphics.snap_to_bitmap
    @preview_image.bitmap.blt(0,0,prv,Rect.new(@zoom_rect.x+9,@zoom_rect.y+101,32,32))
    prv.dispose
    end
    def refresh_areas
    @areas.bitmap.clear
    case @active_mode
    when 1
    for area in @mapcore.water
    @areas.bitmap.fill_rect(area.x,area.y,area.width,area.height,AWW)
    end
    when 2
    for area in @mapcore.ice
    @areas.bitmap.fill_rect(area.x,area.y,area.width,area.height,AWW)
    end
    when 3
    for stair in @mapcore.stairs
    @areas.bitmap.fill_rect(stair[0],stair[1],16,16,AWST)
    end
    end
    end
    def add_area(area)
    @active_mode == 1 ? @mapcore.water << area : @mapcore.ice << area
    @areas.bitmap.fill_rect(area.x,area.y,area.width,area.height,AWW)
    end
    def toggle_stair(mpos)
    x = mpos[0] - 8 - @collision.x - (mpos[0] - 8 - @collision.x) % 16
    y = mpos[1] - 100 - @collision.y - (mpos[1] - 4 - @collision.y) % 16
    trash = nil
    for stair in @mapcore.stairs
    trash = stair if stair[0] == x && stair[1] == y
    end
    if trash.nil?
    @mapcore.stairs << [x,y]
    @areas.bitmap.fill_rect(x,y,16,16,AWST)
    else
    @areas.bitmap.clear_rect(x,y,16,16)
    @mapcore.stairs.delete(trash)
    end
    end
    def delete_area(mpos)
    x = mpos[0]-8-@collision.x
    y = mpos[1]-100-@collision.y
    trash = []
    for area in (@active_mode == 1 ? @mapcore.water : @mapcore.ice)
    trash << area if x >= area.x && x < (area.x + area.width) && y >= area.y && y < (area.y + area.height)
    end
    trash.each {|item| @active_mode == 1 ? @mapcore.water.delete(item) : @mapcore.ice.delete(item)}
    trash.clear
    refresh_areas
    end
    def set_pixel(x,y,flag)
    @mapcore.table[x,y] = flag
    @collision.bitmap.set_pixel(x,y,COLORS[flag])
    refresh_preview
    end
    def apply_brush(flag)
    x = @brush.x-8-@collision.x
    y = @brush.y-100-@collision.y
    for point in @brush_data[@active_brush]
    @mapcore.table[x+point[0],y+point[1]] = flag
    @collision.bitmap.set_pixel(x+point[0],y+point[1],COLORS[flag])
    end
    refresh_preview
    end
    def load_brushes
    @brush_data = {}
    brush_resource = Cache.system("brushes")
    for i in 0..7
    @brush_data[i] = []
    for x in 0..31
    for y in 0..31
    @brush_data[i] << [x,y] if brush_resource.get_pixel(x+i*32,y).alpha != 0
    end
    end
    end
    brush_resource.dispose
    brush_resource = nil
    end
    def create_editor_windows
    @map_window = Arc_Window.new(640,96,516,380)
    @brush_window = Arc_Window.new(0,96,112,380)
    @save_window = Arc_Window.new(640,4,112,88)
    @save_window.draw_text(0,4,:w,16," Physics Editor ",1,AWC)
    @save_window.hr(22)
    @save_window.draw_text(0,26,:w,16," Map ID: #{@mapcore.id}" ,1,AWC)
    @confirm = Arc_Button.new(548,54,64,16," Save ",1,true)
    @cancel = Arc_Button.new(548,72,64,16," Cancel ",1,true)
    @confirm.z = 50
    @cancel.z = 50
    @save_window.ssx(524,20)
    @logo.ssx(260,20)
    @active_brush = 0
    @active_mode = 0
    @area_mode = 0
    @area_vert1 = [0,0]
    @area_vert2 = [0,0]
    @tilegrid = false
    @brush_window.bitmap.font.color = AWF
    @brush_window.bitmap.draw_text(4,80,104,16," Tile Grid",1)
    @brush_window.bitmap.draw_text(4,98,104,16," Stairs ",1)
    @brush_window.draw_32rect(4,4,@active_mode == 0)
    @brush_window.draw_32rect(40,4,@active_mode == 1)
    @brush_window.draw_32rect(76,4,@active_mode == 2)
    @brush_window.draw_icon(8,8,28,@active_mode == 0)
    @brush_window.draw_icon(44,8,107,@active_mode == 1)
    @brush_window.draw_icon(80,8,105,@active_mode == 2)
    @brush_window.draw_brush(4,40,@active_brush)
    @brush_window.draw_text(40,48,68,16," Brush",0,@active_mode == 0 ? AWA : AWF)
    @brush_window.bitmap.font.color = AWC
    @brush_window.bitmap.draw_text(4,260,104,16," Zoom ",1)
    @map_window.ssx(4,20)
    @brush_window.ssx(524,20)
    @map_window.z = 20
    @brush_window.z = 30
    22.times do
    Graphics.update
    @map_window.opacity += 13
    @map_window.update
    @brush_window.opacity += 13
    @brush_window.update
    @logo.update_slide
    @save_window.opacity += 13
    @save_window.update
    end
    @map_viewport = Viewport.new(8,100,508,372)
    @map_viewport.z = 40
    @tilemap = Tilemap.new(@map_viewport)
    @tilemap.map_data = @map.data
    $data_tilesets = load_data("Data/Tilesets.rvdata2")
    @tileset = $data_tilesets[@map.tileset_id]
    @tileset.tileset_names.each_with_index {|name,i| @tilemap.bitmaps[i] = Cache.tileset(name) }
    @tilemap.flags = @tileset.flags
    @map_viewport.update
    @tilemap.update
    @mapcore.load_sprites_fe(@map_viewport,20,50)
    @zoom_rect = Arc_ZR.new(@map_viewport)
    @brush = Sprite.new
    @brush.z = 300
    @brush.bitmap = Bitmap.new(32,32)
    @brush.bitmap.blt(0,0,Cache.system("brushes"),Rect.new(@active_brush*32,0,32,32))
    @brush.opacity = 150
    @preview_image = Sprite.new
    @preview_image.bitmap = Bitmap.new(32,32)
    @preview_image.z = 200
    @preview_image.x = 532
    @preview_image.y = 372
    @preview_image.zoom_x = 3
    @preview_image.zoom_y = 3
    @preview_image.bitmap.blt(0,0, Graphics.snap_to_bitmap,Rect.new(@zoom_rect.x+9,@zoom_rect.y+101,32,32)) if Enable_Zoom
    end
    def dispose_editor_windows
    @collision.bitmap.dispose
    @collision.dispose
    @collision = nil
    @zoom_rect.bitmap.dispose
    @zoom_rect.dispose
    @zoom_rect = nil
    @areas.bitmap.dispose
    @areas.dispose
    @areas = nil
    @brush.bitmap.dispose
    @brush.dispose
    @brush = nil
    @tileset = nil
    @preview_image.bitmap.dispose
    @preview_image.dispose
    @preview_image = nil
    @confirm.dispose
    @cancel.dispose
    @confirm = nil
    @cancel = nil
    @tilemap.dispose
    @tilemap = nil
    @map_viewport.dispose
    @map_viewport = nil
    @map_window.ssx(640,20)
    @brush_window.ssx(0,20)
    @logo.ssx(320,20)
    @save_window.ssx(640,20)
    20.times do
    Graphics.update
    @map_window.opacity -= 13
    @map_window.update
    @brush_window.opacity -= 13
    @brush_window.update
    @logo.update_slide
    @save_window.opacity -= 13
    @save_window.update_slide
    end
    @map_window.dispose
    @map_window = nil
    @brush_window.dispose
    @brush_window = nil
    @save_window.dispose
    @save_window = nil
    end
    end

    $arc_engine = Arc_Interface.new
    $arc_engine.load
    $arc_engine.call_menu if $TEST && !Arc_Core::Disable_Editor

    #-------------------------------------------------------------------------------
    # * Arc Camera
    #-------------------------------------------------------------------------------

    class Arc_Camera
    include Arc_Core
    def initialize
    @object = nil
    end
    def refresh_limits
    @map_lx = $game_map.core.table.xsize/32.0 - Screen_TX
    @map_ly = $game_map.y_limit/32.0 - Screen_TY
    end
    def focus(*args)
    @object = (args.size == 1 ? args[0] : Arc_VirtualObject.new(args[0],args[1]))
    $game_map.set_display_pos(@object.ax/32.0 - Map_CX,@object.ay/32.0 - Map_CY)
    end
    def update
    cx = @object.ax/32.0 - Map_CX
    if (cx - $game_map.display_x).abs > Max_SX
    $game_map.display_x = [0, [cx + (cx > $game_map.display_x ? -Max_SX : Max_SX),@map_lx].min].max
    $game_map.parallax_x = $game_map.display_x
    end
    cy = @object.ay/32.0 - Map_CY
    if (cy - $game_map.display_y).abs > Max_SY
    $game_map.display_y = [0, [cy + (cy > $game_map.display_y ? -Max_SY : Max_SY),@map_ly].min].max
    $game_map.parallax_y = $game_map.display_y
    end
    end
    def on_screen?(object)
    return false if (@object.ax-object.ax).abs > On_ScreenX
    return false if (@object.ay-object.ay).abs > On_ScreenY
    return true
    end
    end

    #-------------------------------------------------------------------------------
    # * Arc VirtualObject
    #-------------------------------------------------------------------------------

    class Arc_VirtualObject
    attr_accessor :ax
    attr_accessor :ay
    def initialize(ax,ay)
    @ax = ax
    @ay = ay
    end
    end

    #-------------------------------------------------------------------------------
    # * Game Map
    #-------------------------------------------------------------------------------

    class Game_Map
    include Arc_Core
    attr_reader :arc
    attr_reader :y_limit
    attr_accessor :core
    attr_accessor :camera
    attr_accessor :display_x
    attr_accessor :display_y
    attr_accessor :parallax_x
    attr_accessor :parallax_y
    alias arc_initialize initialize
    alias arc_setup setup
    alias arc_update update
    def initialize
    @arc = false
    @core = nil
    @y_limit = 16000
    @camera = Arc_Camera.new
    arc_initialize
    end
    def setup(mid)
    @arc = false
    $map_data.each_value {|core| core.unload}
    if $map_data.keys.include?(mid)
    @arc = true
    @core = $map_data[mid]
    @core.load
    @y_limit = @core.height
    end
    arc_setup(mid)
    if @arc
    @camera.refresh_limits
    @camera.focus($game_player)
    end
    end
    def update(main=false)
    arc_update(main)
    @camera.update if @arc
    end
    def air?(tx,ty)
    return false if $game_map.invalid?(tx,ty)
    @core.table[tx,ty] < 8
    end
    def solid?(tx,ty)
    return true if $game_map.invalid?(tx,ty)
    @core.table[tx,ty] > 7
    end
    def can_kick?(tx,ty)
    return false if $game_map.invalid?(tx,ty)
    @core.table[tx,ty] > 7
    end
    def surface?(tx,ty)
    return true if $game_map.invalid?(tx,ty)
    @core.table[tx,ty] > 8 || @core.table[tx,ty] == 7
    end
    def passable_surface?(tx,ty)
    return false if $game_map.invalid?(tx,ty)
    @core.table[tx,ty] == 7
    end
    def stair?(tx,ty)
    @core.table[tx,ty] == 1
    end
    def surface(tx,ty)
    @core.table[tx,ty]
    end
    def surface_y(cx,cy,tx)
    return nil if $game_map.invalid?(tx,cy)
    @core.surface[@core.table[cx,cy]][tx]
    end
    def water?(tx,ty)
    @core.water.each {|a| return true if tx > a[0] && tx < a[2] && ty > a[1] && ty < a[3]}
    false
    end
    def ice?(tx,ty)
    @core.ice.each {|a| return true if tx > a[0] && tx < a[2] && ty > a[1] && ty < a[3]}
    false
    end
    def invalid?(tx,ty)
    @core.table[tx,ty] == nil
    end
    end

    #-------------------------------------------------------------------------------
    # * Game Interpreter
    #-------------------------------------------------------------------------------

    class Game_Interpreter
    def self_event
    $game_map.events[@event_id]
    end
    end

    #-------------------------------------------------------------------------------
    # * Game CharacterBase
    #-------------------------------------------------------------------------------

    class Game_CharacterBase
    include Arc_Core
    attr_reader :ax
    attr_reader :ay
    attr_accessor :vx
    attr_accessor :vy
    attr_accessor :pattern
    attr_reader :sw1
    attr_reader :sw2
    attr_reader :ch
    alias arc_gcbi initialize
    alias arc_gcsx screen_x
    alias arc_gcsy screen_y
    alias arc_ubd update_bush_depth
    def initialize
    @ax = 0.0
    @ay = 0.0
    reset_vx
    reset_vy
    @wait_c = 0
    set_width(Default_Width)
    set_height(Default_Height)
    set_weight(Default_Weight)
    @tphy = false
    @agrvt = true
    @atimer = 0
    arc_gcbi
    end
    def reset_vx
    @vx = 0.0
    @tx = nil
    end
    def reset_vy
    @vy = 0.0
    @ty = nil
    end
    def screen_x
    @tphy ? arc_sx : arc_gcsx
    end
    def screen_y
    @tphy ? arc_sy : arc_gcsy
    end
    def ladder?
    @tphy ? $game_map.ladder?(@ax/32,@ay/32) : $game_map.ladder?(@x,@y)
    end
    def bush?
    @tphy ? $game_map.bush?(@ax/32,@ay/32) : $game_map.bush?(@x,@y)
    end
    def update_bush_depth
    @tphy ? @bush_depth = 0 : arc_ubd
    end
    def terrain_tag
    @tphy ? $game_map.terrain_tag(@ax/32,@ay/32) : $game_map.terrain_tag(@x,@y)
    end
    def region_id
    @tphy ? $game_map.region_id(@ax/32,@ay/32) : $game_map.region_id(@x,@y)
    end
    def moveto(x,y)
    @x = x % $game_map.width
    @y = y % $game_map.height
    @real_x = @x
    @real_y = @y
    @ax = @x*32+X_Axis
    @ay = @y*32+Y_Axis
    reset_vx
    reset_vy
    @prelock_direction = 0
    straighten
    refresh_tphy
    reset_ss
    end
    def reset_ss
    end
    def refresh_tphy
    @tphy = $game_map.arc
    end
    def arc_sx
    @ax-$game_map.display_x*32
    end
    def arc_sy
    @ay-$game_map.display_y*32
    end
    def set_height(gh)
    @ch = gh
    @h = @ch - 1
    end
    def set_width(gw)
    @w = gw
    @sw1 = @w/2
    @sw2 = @sw1 - 1
    end
    def set_weight(wg)
    @wg = wg
    @res_coef = @wg*Meter_Size
    end
    def arc_update
    @wait_c -= 1 if @wait_c > 0
    if @agrvt
    @vy += Gravity
    @vy -= Air_Resistance*@vy*@vy/(@wg*Meter_Size) if @vy > Insignificant
    end
    if @tx != nil
    @tx > 0 ? @tx -= 1 : reset_vx
    end
    if @ty != nil
    @ty > 0 ? @ty -= 1 : reset_vy
    end
    arc_move
    if @vx.abs > Insignificant
    et = event_below_type
    if (surface_below? || et == 0x01)
    refresh_animation
    elsif et == 0x02
    @pattern = 1
    else
    @pattern = 0
    end
    else
    @pattern = 1
    @atimer = 13
    end
    end
    def refresh_animation
    if @atimer > 15 - @vx.abs*2
    @atimer = 0
    @pattern = (@pattern + 1) % 4
    end
    @atimer += 1
    end
    def enter_water
    @water = true
    RPG::SE.new("Water1",80).play
    end
    def leave_water
    @water = false
    end
    def apply_xforce(fx)
    @vx += fx.to_f/@wg
    end
    def apply_yforce(fy)
    @vy += fy.to_f/@wg
    end
    def move_x(vx,tx=nil)
    @vx = vx
    @tx = tx
    end
    def move_y(vy,ty=nil)
    @vy = vy
    @ty = ty
    end
    def move_dx(dx,tx)
    @vx = dx.to_f/tx
    @tx = tx
    end
    def move_dy(dy,ty)
    @vy = dy.to_f/ty
    @ty = ty
    end
    def push(pusher)
    move_x(@move_speed*(@ax <=> pusher.ax))
    set_direction(@vx > 0 ? 6 : 4)
    move_y(@move_speed*(@ay <=> pusher.ay)) if !@agrvt
    end
    def stop
    reset_vx
    reset_vy
    end
    def surface_below?
    for h in 1..Surface_T
    return true if $game_map.surface?(@ax-@sw1,@ay+h) || $game_map.surface?(@ax+@sw2,@ay+h)
    end
    false
    end
    def event_below?
    for event in $game_map.events.values
    if (@ax-event.ax).abs < (@sw1+event.sw1) && (@ay+Surface_T-event.ay).abs < (event.ay > @ay ? event.ch : @ch)
    next if event.through
    return true if event.priority_type == 1
    end
    end
    false
    end
    def event_below_type
    for event in $game_map.events.values
    if (@ax-event.ax).abs < (@sw1+event.sw1) && (@ay+Surface_T-event.ay).abs < (event.ay > @ay ? event.ch : @ch)
    next if event.through
    return 0x02 if event.sticky && event.vx == @vx
    return 0x01 if event.priority_type == 1
    end
    end
    0x00
    end
    def relative_stop?
    (@vx == 0.0 && @vy == 0.0)
    end
    def enough_speed?
    (@vx.abs > Insignificant || @vy.abs > Insignificant)
    end
    def arc_move
    dx = @vx <=> 0
    dy = @vy <=> 0
    @vy.abs.to_i.times do
    free_cll?(@ax,@ay+dy) ? @ay += dy : reset_vy
    end
    @vx.abs.to_i.times do
    free_cll?(@ax+dx,@ay) ? @ax += dx : reset_vx
    end
    end
    def free_cll?(tx,ty)
    unless @vy < 0
    return false if $game_map.surface?(tx-@sw1,ty)
    return false if $game_map.surface?(tx+@sw2,ty)
    end
    for ht in 0..(@h/Height_CL)
    return false if $game_map.solid?(tx-@sw1,ty-ht*Height_CL)
    return false if $game_map.solid?(tx+@sw2,ty-ht*Height_CL)
    end
    return false if $game_map.solid?(tx-@sw1,ty-@h)
    return false if $game_map.solid?(tx+@sw2,ty-@h)
    return false if touch?(tx,ty)
    return true
    end
    def touch?(tx,ty)
    for event in $game_map.events.values
    if (tx-event.ax).abs < (@sw1+event.sw1) && (ty-event.ay).abs < (event.ay > ty ? event.ch : @ch)
    next if event == self || event.through
    event.reflex(self)
    return true if event.priority_type == 1
    end
    end
    return false
    end
    def trigger_direction(ref,obj)
    if (ref.ax-obj.ax).abs < ref.sw1 + obj.sw2
    return (ref.ay > obj.ay ? 2 : 8)
    else
    return (ref.ax > obj.ax ? 4 : 6)
    end
    end
    end

    #-------------------------------------------------------------------------------
    # * Game Character
    #-------------------------------------------------------------------------------

    class Game_Character < Game_CharacterBase
    alias default_command process_move_command
    alias default_fmr force_move_route
    def force_move_route®
    stop if @tphy
    default_fmr®
    end
    def arc_update
    super
    update_routine_move if @move_route_forcing && relative_stop?
    end
    def process_move_command(command)
    @tphy ? arc_command(command) : default_command(command)
    end
    def arc_command(command)
    params = command.parameters
    case command.code
    when ROUTE_END
    process_route_end
    when ROUTE_MOVE_DOWN
    move_y(@move_speed,32/@move_speed)
    when ROUTE_MOVE_LEFT
    move_x(-@move_speed,32/@move_speed)
    set_direction(4)
    when ROUTE_MOVE_RIGHT
    move_x(@move_speed,32/@move_speed)
    set_direction(6)
    when ROUTE_MOVE_UP
    move_y(-@move_speed,32/@move_speed)
    when ROUTE_MOVE_LOWER_L
    move_y(@move_speed,32/@move_speed)
    move_x(-@move_speed,32/@move_speed)
    set_direction(4)
    when ROUTE_MOVE_LOWER_R
    move_y(@move_speed,32/@move_speed)
    move_x(@move_speed,32/@move_speed)
    set_direction(6)
    when ROUTE_MOVE_UPPER_L
    move_y(-@move_speed,32/@move_speed)
    move_x(-@move_speed,32/@move_speed)
    set_direction(4)
    when ROUTE_MOVE_UPPER_R
    move_y(-@move_speed,32/@move_speed)
    move_x(@move_speed,32/@move_speed)
    set_direction(6)
    when ROUTE_MOVE_RANDOM
    arc_rand_move
    when ROUTE_MOVE_TOWARD
    arc_follow($game_player)
    when ROUTE_MOVE_AWAY
    arc_escape($game_player)
    when ROUTE_MOVE_FORWARD
    move_x(@move_speed*(@direction == 4 ? -1 : 1),32/@move_speed)
    when ROUTE_MOVE_BACKWARD
    move_x(@move_speed*(@direction == 6 ? -1 : 1),32/@move_speed)
    when ROUTE_JUMP
    apply_xforce(params[0]*32)
    apply_yforce(params[1]*32)
    when ROUTE_WAIT
    @wait_count = params[0] - 1
    @wait_c = params[0] - 1
    when ROUTE_TURN_DOWN; set_direction(2)
    when ROUTE_TURN_LEFT; set_direction(4)
    when ROUTE_TURN_RIGHT; set_direction(6)
    when ROUTE_TURN_UP; set_direction(8)
    when ROUTE_TURN_90D_R; turn_right_90
    when ROUTE_TURN_90D_L; turn_left_90
    when ROUTE_TURN_180D; turn_180
    when ROUTE_TURN_90D_R_L; turn_right_or_left_90
    when ROUTE_TURN_RANDOM
    set_direction(rand(2) == 0 ? 4 : 6)
    when ROUTE_TURN_TOWARD
    arc_focus($game_player)
    when ROUTE_TURN_AWAY
    arc_away($game_player)
    when ROUTE_SWITCH_ON; $game_switches[params[0]] = true
    when ROUTE_SWITCH_OFF; $game_switches[params[0]] = false
    when ROUTE_CHANGE_SPEED; @move_speed = params[0]
    when ROUTE_CHANGE_FREQ; @move_frequency = params[0]
    when ROUTE_WALK_ANIME_ON; @walk_anime = true
    when ROUTE_WALK_ANIME_OFF; @walk_anime = false
    when ROUTE_STEP_ANIME_ON; @step_anime = true
    when ROUTE_STEP_ANIME_OFF; @step_anime = false
    when ROUTE_DIR_FIX_ON; @direction_fix = true
    when ROUTE_DIR_FIX_OFF; @direction_fix = false
    when ROUTE_THROUGH_ON; @through = true
    when ROUTE_THROUGH_OFF; @through = false
    when ROUTE_TRANSPARENT_ON; @transparent = true
    when ROUTE_TRANSPARENT_OFF; @transparent = false
    when ROUTE_CHANGE_GRAPHIC; set_graphic(params[0], params[1])
    when ROUTE_CHANGE_OPACITY; @opacity = params[0]
    when ROUTE_CHANGE_BLENDING; @blend_type = params[0]
    when ROUTE_PLAY_SE; params[0].play
    when ROUTE_SCRIPT; eval(params[0])
    end
    end
    def arc_rand_move
    case rand(8)
    when 0..3
    set_direction(6)
    move_x(@move_speed,(rand(6)+1)*30)
    when 4..6
    set_direction(4)
    move_x(-@move_speed,(rand(6)+1)*30)
    when 7
    @wait_c = (rand(6)+1)*30
    end
    end
    def arc_follow(object)
    move_x(@move_speed*(object.ax <=> @ax),5) if (@ax - object.ax).abs > AI_Approach
    set_direction(@vx > 0 ? 6 : 4)
    move_y(@move_speed*(object.ay <=> @ay),5) if !@agrvt && (@ay - object.ay).abs > AI_Approach
    end
    def arc_escape(object)
    move_x(@move_speed*(@ax <=> object.ax),5) if (@ax - object.ax).abs > AI_Approach
    set_direction(@vx > 0 ? 6 : 4)
    move_y(@move_speed*(@ay <=> object.ay),5) if !@agrvt && (@ay - object.ay).abs > AI_Approach
    end
    def arc_focus(object)
    set_direction((object.ax <=> @ax) == -1 ? 4 : 6)
    end
    def arc_away(object)
    set_direction((object.ax <=> @ax) == -1 ? 6 : 4)
    end
    end

    #-------------------------------------------------------------------------------
    # * Game Player
    #-------------------------------------------------------------------------------

    class Game_Player < Game_Character
    attr_accessor :deny_resistance
    attr_reader :groundpound
    alias arc_gpi initialize
    alias arc_gpu update
    def initialize
    reset_ss
    arc_gpi
    end
    def set_weight(wg)
    super(wg)
    @key_acc = Key_Force/@wg
    end
    def reset_vx
    super
    @wallkick = false
    end
    def reset_vy
    super
    @wallkick = false
    end
    def update
    @tphy ? arc_update : arc_gpu
    end
    def reset_ss
    @wk_pos = [0,0]
    @wallkick = false
    @deny_resistance = false
    @groundpound = false
    @grab_stair = false
    end
    def reset_vy
    super
    @wk_pos = [0,0]
    if @groundpound
    @groundpound = false
    Arc_Sound.groundpound
    end
    end
    def arc_update
    try_event if Input.trigger?(:C)
    @wait_c -= 1 if @wait_c > 0
    unless @grab_stair
    if Input.trigger?(:DOWN)
    if !jump_enabled? && !@groundpound
    stop
    apply_yforce(-Jump_Impulse)
    @groundpound = true
    end
    end
    @vy += Gravity
    @vy -= Air_Resistance*@vy*@vy/(@wg*Meter_Size) if @vy > Insignificant
    end
    if @tx != nil
    @tx > 0 ? @tx -= 1 : reset_vx
    end
    if @ty != nil
    @ty > 0 ? @ty -= 1 : reset_vy
    end
    if @move_route_forcing
    arc_move
    check_move_route
    else
    update_arcinput
    arc_move
    check_ungrab
    end
    kill if @ay > $game_map.y_limit
    if @vx.abs > Insignificant
    et = event_below_type
    if (@grab_stair || surface_below? || et == 0x01)
    refresh_animation
    elsif et == 0x02
    @pattern = 1
    else
    @pattern = 0
    end
    elsif @grab_stair && @vy.abs > Insignificant
    stair_animation
    else
    @pattern = 1 unless @move_route_forcing
    @atimer = 13
    end
    end
    def stair_animation
    if @atimer > 11
    @atimer = 0
    @pattern = (@pattern + 1) % 4
    end
    @atimer += 1
    end
    def kill
    reset_vx
    $game_switches[Death_Zone_Switch] = true
    end
    def try_event
    return if $game_map.interpreter.running? || $game_message.busy? || $game_message.visible
    case @direction
    when 4
    for event in $game_map.events.values
    event.try_trigger if (@ax-event.ax).abs < (@sw1+event.sw1) && (@ay-event.ay).abs < (event.ay > @ay ? event.ch : @ch)
    end
    return if $game_map.setup_starting_event
    for event in $game_map.events.values
    event.try_trigger if (@ax-Trigger_X-event.ax).abs < (@sw1+event.sw1) && (@ay-event.ay).abs < (event.ay > @ay ? event.ch : @ch) + Trigger_Y
    end
    when 6
    for event in $game_map.events.values
    event.try_trigger if (@ax-event.ax).abs < (@sw1+event.sw1) && (@ay-event.ay).abs < (event.ay > @ay ? event.ch : @ch)
    end
    return if $game_map.setup_starting_event
    for event in $game_map.events.values
    event.try_trigger if (@ax+Trigger_X-event.ax).abs < (@sw1+event.sw1) && (@ay-event.ay).abs < (event.ay > @ay ? event.ch : @ch) + Trigger_Y
    end
    else
    for event in $game_map.events.values
    event.try_trigger if (@ax-event.ax).abs < (@sw1+event.sw1) && (@ay-event.ay).abs < (event.ay > @ay ? event.ch : @ch)
    end
    end
    end
    def check_ungrab
    unless $game_map.stair?(@ax,@ay-Stair_OY)
    @grab_stair = false
    set_direction(@vx > 0 ? 6 : 4) if @direction == 8
    end
    end
    def try_grab
    if $game_map.stair?(@ax,@ay-Stair_OY)
    @grab_stair = true
    set_direction(8)
    end
    end
    def check_move_route
    return if !relative_stop? || @wait_c > 0
    update_routine_move
    end
    def update_arcinput
    return if $game_map.interpreter.running? || $game_message.busy? || $game_message.visible
    try_grab if Input.trigger?(:UP)
    if @grab_stair
    case Input.dir8
    when 1
    move_x(-Stair_Speed)
    move_y(Stair_Speed)
    when 2
    reset_vx
    move_y(Stair_Speed)
    when 3
    move_x(Stair_Speed)
    move_y(Stair_Speed)
    when 4
    move_x(-Stair_Speed)
    reset_vy
    when 6
    move_x(Stair_Speed)
    reset_vy
    when 7
    move_x(-Stair_Speed)
    move_y(-Stair_Speed)
    when 8
    reset_vx
    move_y(-Stair_Speed)
    when 9
    move_x(Stair_Speed)
    move_y(-Stair_Speed)
    else
    reset_vx
    reset_vy
    end
    if Input.trigger?(:X)
    apply_yforce(Jump_Impulse)
    Arc_Sound.jump
    @grab_stair = false
    set_direction(@vx > 0 ? 6 : 4)
    end
    else
    case Input.dir4
    when 4
    @vx -= @key_acc
    set_direction(4)
    @deny_resistance = false
    r = (Input.press?(:SHIFT) ? Running_Resistance : Body_Resistance)
    when 6
    @vx += @key_acc
    set_direction(6)
    @deny_resistance = false
    r = (Input.press?(:SHIFT) ? Running_Resistance : Body_Resistance)
    else
    r = (@wallkick ? Body_Resistance : Stop_Resistance)
    end
    if Input.trigger?(:X)
    if jump_enabled?
    apply_yforce(Jump_Impulse + Jump_RBonus*@vx.abs)
    Arc_Sound.jump
    elsif wkick_left?
    stop
    @wk_pos = [@ax,@ay]
    @wallkick = true
    @deny_resistance = true
    apply_xforce(WKick_XImpulse)
    apply_yforce(WKick_YImpulse)
    Arc_Sound.jump
    elsif wkick_right?
    stop
    @wk_pos = [@ax,@ay]
    @wallkick = true
    @deny_resistance = true
    apply_xforce(-WKick_XImpulse)
    apply_yforce(WKick_YImpulse)
    Arc_Sound.jump
    end
    end
    if @deny_resistance
    @deny_resistance = false
    else
    if @vx.abs > Insignificant
    rb = r*@vx*@vx/@res_coef
    @vx += (@vx > 0 ? -rb : rb)
    end
    end
    end
    end
    def jump_enabled?
    return true if surface_below? || event_below?
    false
    end
    def pass_surface?
    return false if event_below?
    $game_map.passable_surface?(@ax-@sw1,@ay+1) && $game_map.passable_surface?(@ax+@sw2,@ay+1)
    end
    def deny_wallkick?
    (@wk_pos[0] - @ax).abs < WKick_XRadius && (@wk_pos[1] - @ay).abs < WKick_YRadius
    end
    def wkick_right?
    return false if @direction != 6 || deny_wallkick?
    for d in 1..WKick_T
    return true if $game_map.can_kick?(@ax+@sw2+d,@ay-WKick_OY)
    end
    false
    end
    def wkick_left?
    return false if @direction != 4 || deny_wallkick?
    for d in 1..WKick_T
    return true if $game_map.can_kick?(@ax-@sw1-d,@ay-WKick_OY)
    end
    false
    end
    def refresh_tphy
    @tphy = $game_map.arc
    if @tphy
    @followers.visible = false
    else
    @followers.visible = $data_system.opt_followers
    end
    end
    def touch?(tx,ty)
    rst = false
    for event in $game_map.events.values
    if (tx-event.ax).abs < (@sw1+event.sw1) && (ty-event.ay).abs < (event.ay > ty ? event.ch : @ch)
    next if event.through
    event.reflex(self)
    rst = true if event.priority_type == 1
    end
    end
    rst
    end
    def reflex(object)
    if object.sticky && object.ay > @ay
    @ay -= 1
    end
    end
    end

    #-------------------------------------------------------------------------------
    # * Game Event
    #-------------------------------------------------------------------------------

    class Game_Event < Game_Character
    attr_accessor :direction
    attr_reader :last_trigger_direction
    attr_reader :last_trigger_type
    attr_reader :sticky
    attr_reader :pushable
    attr_reader :enemy
    attr_reader :block_event
    alias arc_gei initialize
    alias arc_geu update
    alias arc_sps setup_page_settings
    alias arc_cps clear_page_settings
    def initialize(m,e)
    arc_clear
    arc_gei(m,e)
    end
    def lock
    unless @locked
    @prelock_direction = @direction
    arc_focus($game_player)
    @locked = true
    end
    end
    def update
    @tphy ? arc_update : arc_geu
    end
    def arc_move
    $game_player.vy += @move_speed if @sticky && touch_player?(@ax,@ay-1) && @vy > 0
    apply_rforce if @apply_friction
    super
    update_ai if $game_map.camera.on_screen?(self) && relative_stop? && @wait_c <= 0
    end
    def arc_update
    super
    return unless @interpreter
    @interpreter.setup(@list,@event.id) unless @interpreter.running?
    @interpreter.update
    end
    def update_ai
    return if $game_map.interpreter.running? || $game_message.busy? || $game_message.visible
    case @move_type
    when 1
    arc_rand_move
    when 2
    arc_follow($game_player)
    when 3
    update_routine_move
    when 4
    @last_dir = @last_dir*-1
    move_x(@move_speed*@last_dir)
    set_direction(@vx > 0 ? 6 : 4)
    end
    end
    def apply_rforce
    if @vx.abs > Insignificant
    rb = Body_Resistance*@vx*@vx/@res_coef
    @vx += (@vx > 0 ? -rb : rb)
    end
    end
    def setup_page_settings
    arc_sps
    arc_clear
    arc_setup
    end
    def clear_page_settings
    arc_cps
    arc_clear
    end
    def arc_setup
    return if @list.nil?
    for value in 0...@list.size
    next if @list[value].code != 108 && @list[value].code != 408
    @sticky = true if @list[value].parameters[0] == "[sticky]"
    @pushable = true if @list[value].parameters[0] == "[pushable]"
    @tphy = false if @list[value].parameters[0] == "[deny_physics]"
    @agrvt = false if @list[value].parameters[0] == "[deny_gravity]"
    @apply_friction = true if @list[value].parameters[0] == "[apply_friction]"
    @move_type = 4 if @list[value].parameters[0] == "[turtle]"
    @block_event = true if @list[value].parameters[0] == "[block_event]"
    @groundpound = true if @list[value].parameters[0] == "[groundpound]"
    @stop_player = true if @list[value].parameters[0] == "[stop_player]"
    @deny_player = true if @list[value].parameters[0] == "[deny_player]"
    @deny_triggers << 2 if @list[value].parameters[0] == "[deny_up]"
    @deny_triggers << 4 if @list[value].parameters[0] == "[deny_left]"
    @deny_triggers << 6 if @list[value].parameters[0] == "[deny_right]"
    @deny_triggers << 8 if @list[value].parameters[0] == "[deny_down]"
    if @list[value].parameters[0].include?("[weight ")
    @list[value].parameters[0].scan(/\[weight ([0.0-9.9]+)\]/)
    set_weight($1.to_i)
    end
    if @list[value].parameters[0].include?("[width ")
    @list[value].parameters[0].scan(/\[width ([0.0-9.9]+)\]/)
    set_width($1.to_i)
    end
    if @list[value].parameters[0].include?("[height ")
    @list[value].parameters[0].scan(/\[height ([0.0-9.9]+)\]/)
    set_height($1.to_i)
    end
    if @list[value].parameters[0].include?("[item_trigger ")
    @list[value].parameters[0].scan(/\[item_trigger ([0.0-9.9]+)\]/)
    @projectile_triggers << $1.to_i
    end
    if @list[value].parameters[0].include?("[object_trigger ")
    @list[value].parameters[0].scan(/\[object_trigger ([0.0-9.9]+)\]/)
    @enemy_triggers << $1.to_i
    end
    if @list[value].parameters[0].include?("[event_trigger ")
    @list[value].parameters[0].scan(/\[event_trigger ([0.0-9.9]+)\]/)
    @event_triggers << $1.to_i
    end
    end
    end
    def arc_clear
    refresh_tphy
    @last_trigger_direction = 2
    @last_dir = 1
    @agrvt = true
    @enemy = nil
    @sticky = false
    @pushable = false
    @groundpound = false
    @stop_player = false
    @block_event = false
    @deny_player = false
    @apply_friction = false
    @deny_triggers = []
    @projectile_triggers = []
    @enemy_triggers = []
    @event_triggers = []
    end
    def touch?(tx,ty)
    for event in $game_map.events.values
    if (tx-event.ax).abs < (@sw1+event.sw1) && (ty-event.ay).abs < (event.ay > ty ? event.ch : @ch)
    next if event == self || event.through
    event.reflex(self)
    return true if event.priority_type == 1 || event.block_event
    end
    end
    if (tx-$game_player.ax).abs < (@sw1+$game_player.sw1) && (ty-$game_player.ay).abs < ($game_player.ay > ty ? $game_player.ch : @ch)
    $game_player.reflex(self)
    return true unless (@sticky && (@ay-@h) > $game_player.ay)
    end
    return false
    end
    def touch_player?(tx,ty)
    return (tx-$game_player.ax).abs < (@sw1+$game_player.sw1) && (ty-$game_player.ay).abs < ($game_player.ay > ty ? $game_player.ch : @ch)
    end
    def reflex(object)
    if object == $game_player
    if @sticky && $game_player.vx.abs <= @vx.abs && $game_player.ay < (@ay-@h) && (@ax-$game_player.ax).abs < (@sw1+$game_player.sw1)
    $game_player.vx = @vx
    $game_player.deny_resistance = true
    elsif @pushable
    try_push
    else
    try_start
    end
    elsif @event_triggers.include?(object.id)
    try_e_start(object)
    end
    end
    def try_push
    return if @deny_triggers.include?(trigger_direction(self,$game_player))
    push($game_player)
    end
    def try_e_start(trigger)
    return if @deny_triggers.include?(trigger_direction(self,trigger))
    @last_trigger_direction = trigger_direction(self,trigger)
    @last_trigger_type = :event
    stop
    start
    end
    def try_start
    return if @deny_player
    return unless (@trigger == 1 || @trigger == 2)
    return if @deny_triggers.include?(trigger_direction(self,$game_player))
    return if @groundpound && !$game_player.groundpound
    return if @stop_player && ($game_map.interpreter.running? || $game_message.busy? || $game_message.visible)
    $game_player.stop if @stop_player
    @last_trigger_direction = trigger_direction(self,$game_player)
    @last_trigger_type = ($game_player.groundpound ? :groundpound : :touch)
    stop
    start
    end
    def try_trigger
    return if @deny_player
    return if @deny_triggers.include?(trigger_direction(self,$game_player))
    return if @groundpound
    $game_player.stop
    @last_trigger_direction = trigger_direction(self,$game_player)
    @last_trigger_type = :action
    stop
    start
    end
    end

    #-------------------------------------------------------------------------------
    # * Sprite Character
    #-------------------------------------------------------------------------------

    class Sprite_Character < Sprite_Base
    def set_tile_bitmap
    sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
    sy = @tile_id % 256 / 8 % 16 * 32;
    self.bitmap = tileset_bitmap(@tile_id)
    self.src_rect.set(sx, sy, 32, 32)
    self.ox = 16
    self.oy = 31
    end
    def set_character_bitmap
    self.bitmap = Cache.character(@character_name)
    sign = @character_name[/^[\!\$]./]
    if sign && sign.include?('$')
    @cw = bitmap.width / 3
    @ch = bitmap.height / 4
    else
    @cw = bitmap.width / 12
    @ch = bitmap.height / 8
    end
    self.ox = @cw / 2
    self.oy = @ch -1
    end
    end

    #-------------------------------------------------------------------------------
    # * End of Arc Engine (by Khas Arcthunder)
    #-------------------------------------------------------------------------------

     

     

  4. Salve , ultimamente volevo cambiare menù e ho scelto quello di mog hunter (per la personalizzazione dell'immagini) l'unica pecca era il salvataggio nel menù cosi tramite lo script provai a levarlo e funzionava benissimo, ma non avevo ancora provato a vedere se c'era qualche conflitto nel sistema di combattimento uso il

    tankentai3.4+atb.Quando entro in combattiemnto e clicco su attacca,abilità,oggetti ecc... mi da un problema su diverse stringhe dell ATB(1,2c),l'errore è wrong line of

    argumetnts (0 for 2).Qualcuno puo aiutarmi a risolverlo?

     

    Questo è lo script modificato da me per togliere il salvataggio

     

    #################################################

    # Mog Menu Yui V 1.0 #

    ##################################################

    # By Moghunter

    # http://www.atelier-rgss.com

    ##################################################

    # Menu com layout em pictures.

    # É necessário criar uma pasta com o nome de

    # Menus e colocar todas as imagens dentro dela, de resto

    # é só criar o seu próprio estilo de menu através de um

    #editor de imagem.

    #-------------------------------------------------

    ###############

    # module Cache #

    ###############

    module Cache

    def self.menu(filename)

    load_bitmap("Graphics/Menus/", filename)

    end

    end

    ###############

    # Window_Base #

    ###############

    class Window_Base < Window

    def draw_actor_level_menu(actor, x, y)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)

    self.contents.font.color = normal_color

    self.contents.draw_text(x + 16, y, 24, WLH, actor.level, 2)

    end

    def draw_currency_value_menu(value, x, y, width)

    cx = contents.text_size(Vocab::gold).width

    self.contents.font.color = normal_color

    self.contents.draw_text(x, y, width-cx-2, WLH, value, 1)

    end

    def draw_actor_hp_menu(actor, x, y)

    back = Cache.menu("Meter_Back")

    cw = back.width

    ch = back.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x + 65, y - ch + 30, back, src_rect)

    meter = Cache.menu("HP_Meter")

    cw = meter.width * actor.hp / actor.maxhp

    ch = meter.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x + 65, y - ch + 30, meter, src_rect)

    text = Cache.menu("HP_Text")

    cw = text.width

    ch = text.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x + 35, y - ch + 30, text, src_rect)

    self.contents.font.color = Color.new(255,255,255,255)

    self.contents.draw_text(x + 81, y - 1, 48, 32, actor.hp.to_s, 2)

    self.contents.font.color = Color.new(255,255,255,255)

    self.contents.draw_text(x + 80, y - 2, 48, 32, actor.hp.to_s, 2)

    end

    def draw_actor_mp_menu(actor, x, y)

    back = Cache.menu("Meter_Back")

    cw = back.width

    ch = back.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x + 65, y - ch + 30, back, src_rect)

    meter = Cache.menu("MP_Meter")

    cw = meter.width * actor.mp / actor.maxmp

    ch = meter.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x + 65, y - ch + 30, meter, src_rect)

    text = Cache.menu("MP_Text")

    cw = text.width

    ch = text.height

    src_rect = Rect.new(0, 0, cw, ch)

    self.contents.blt(x + 35, y - ch + 30, text, src_rect)

    self.contents.font.color = Color.new(0,0,0,255)

    self.contents.draw_text(x + 81, y - 1, 48, 32, actor.mp.to_s, 2)

    self.contents.font.color = Color.new(255,255,255,255)

    self.contents.draw_text(x + 80, y - 2, 48, 32, actor.mp.to_s, 2)

    end

    def draw_actor_name_menu(actor, x, y)

    self.contents.font.color = text_color(23)

    self.contents.draw_text(x, y, 108, WLH, actor.name,1)

    end

    def draw_actor_level_menu(actor, x, y)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 32, WLH, " L")

    self.contents.font.color = text_color(10)

    self.contents.draw_text(x + 18, y, 24, WLH, actor.level, 1)

    end

    end

    ############

    # Game_Map #

    ############

    class Game_Map

    attr_reader :map_id

    def mpname

    $mpname = load_data("Data/MapInfos.rvdata")

    $mpname[@map_id].name

    end

    end

    ########################

    # Window_Selectable_Menu #

    ########################

    class Window_Selectable_Menu < Window_Base

    attr_reader :item_max

    attr_reader :column_max

    attr_reader :index

    def initialize(x, y, width, height, spacing = 32)

    @item_max = 1

    @column_max = 1

    @index = -1

    @spacing = spacing

    super(x, y, width, height)

    end

    def create_contents

    self.contents.dispose

    self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)

    end

    def index=(index)

    @index = index

    end

    def row_max

    return (@item_max + @column_max - 1) / @column_max

    end

    def top_row

    return self.oy / WLH

    end

    def top_row=(row)

    row = 0 if row < 0

    row = row_max - 1 if row > row_max - 1

    self.oy = row * WLH

    end

    def page_row_max

    return (self.height - 32) / WLH

    end

    def page_item_max

    return page_row_max * @column_max

    end

    def bottom_row

    return top_row + page_row_max - 1

    end

    def bottom_row=(row)

    self.top_row = row - (page_row_max - 1)

    end

    def cursor_movable?

    return false if (not visible or not active)

    return false if (index < 0 or index > @item_max or @item_max == 0)

    return false if (@opening or @closing)

    return true

    end

    def cursor_down(wrap = false)

    if (@index < @item_max - @column_max) or (wrap and @column_max == 1)

    @index = (@index + @column_max) % @item_max

    end

    end

    def cursor_up(wrap = false)

    if (@index >= @column_max) or (wrap and @column_max == 1)

    @index = (@index - @column_max + @item_max) % @item_max

    end

    end

    def cursor_right(wrap = false)

    if (@column_max >= 2) and

    (@index < @item_max - 1 or (wrap and page_row_max == 1))

    @index = (@index + 1) % @item_max

    end

    end

    def cursor_left(wrap = false)

    if (@column_max >= 2) and

    (@index > 0 or (wrap and page_row_max == 1))

    @index = (@index - 1 + @item_max) % @item_max

    end

    end

    def update

    super

    if cursor_movable?

    last_index = @index

    if Input.repeat?(Input::DOWN)

    cursor_down(Input.trigger?(Input::DOWN))

    end

    if Input.repeat?(Input::UP)

    cursor_up(Input.trigger?(Input::UP))

    end

    if Input.repeat?(Input::RIGHT)

    cursor_down(Input.trigger?(Input::DOWN))

    end

    if Input.repeat?(Input::LEFT)

    cursor_up(Input.trigger?(Input::UP))

    end

    if @index != last_index

    Sound.play_cursor

    end

    end

    end

    end

    #######################

    # Window_MenuStatus_Yui #

    #######################

    class Window_MenuStatus_Yui < Window_Selectable_Menu

    def initialize(x, y)

    super(x, y, 460, 300)

    self.contents.font.bold = true

    self.contents.font.shadow = true

    self.contents.font.size = 16

    refresh

    self.active = true

    self.index = -1

    end

    def refresh

    self.contents.clear

    @item_max = $game_party.members.size

    for actor in $game_party.members

    if actor.index == 0

    draw_actor_graphic(actor, 65, 110)

    draw_actor_name_menu(actor, 15, 120)

    draw_actor_level_menu(actor, -5, 55)

    draw_actor_state(actor, 20, 100)

    draw_actor_hp_menu(actor, -30, 25)

    draw_actor_mp_menu(actor, 0, 45)

    elsif actor.index == 1

    draw_actor_graphic(actor, 170, 210)

    draw_actor_name_menu(actor, 120, 220)

    draw_actor_level_menu(actor, 100, 155)

    draw_actor_state(actor, 125, 200)

    draw_actor_hp_menu(actor, 75, 120)

    draw_actor_mp_menu(actor, 105, 145)

    elsif actor.index == 2

    draw_actor_graphic(actor, 265, 110)

    draw_actor_name_menu(actor, 215, 120)

    draw_actor_level_menu(actor, 195, 55)

    draw_actor_state(actor, 220, 100)

    draw_actor_hp_menu(actor, 170, 20)

    draw_actor_mp_menu(actor, 205, 45)

    elsif actor.index == 3

    draw_actor_graphic(actor, 370, 210)

    draw_actor_name_menu(actor, 320, 220)

    draw_actor_level_menu(actor, 370, 155)

    draw_actor_state(actor, 325, 200)

    draw_actor_hp_menu(actor, 275, 120)

    draw_actor_mp_menu(actor, 245, 145)

    end

    end

    end

    def update_cursor

    end

    end

    ###############

    # Window_Time #

    ###############

    class Window_Mapname < Window_Base

    def initialize(x, y)

    super(x, y, 160, WLH + 32)

    self.contents.font.bold = true

    self.contents.font.size = 16

    refresh

    end

    def refresh

    self.contents.clear

    self.contents.font.color = normal_color

    self.contents.draw_text(4, 0, 120, 32, $game_map.mpname.to_s, 1)

    end

    end

    ###################

    # Window_Gold_Menu #

    ###################

    class Window_Gold_Menu < Window_Base

    def initialize(x, y)

    super(x, y, 160, WLH + 32)

    self.contents.font.bold = true

    self.contents.font.size = 16

    self.contents.font.color = power_up_color

    refresh

    end

    def refresh

    self.contents.clear

    draw_currency_value_menu($game_party.gold, 10, 0, 120)

    end

    end

    ###############

    # Window_Time #

    ###############

    class Window_Time < Window_Base

    def initialize(x, y)

    super(x, y, 160, WLH + 32)

    self.contents.font.bold = true

    self.contents.font.size = 16

    self.contents.font.color = power_up_color

    refresh

    end

    def refresh

    self.contents.clear

    @total_sec = Graphics.frame_count / Graphics.frame_rate

    hour = @total_sec / 60 / 60

    min = @total_sec / 60 % 60

    sec = @total_sec % 60

    text = sprintf("%02d:%02d:%02d", hour, min, sec)

    self.contents.draw_text(4, 0, 120, 32, text, 2)

    end

    def update

    super

    if Graphics.frame_count / Graphics.frame_rate != @total_sec

    refresh

    end

    end

    end

    ##############

    # Scene_Menu #

    ##############

    class Scene_Menu

    def main

    start

    perform_transition

    Input.update

    loop do

    Graphics.update

    Input.update

    update

    break if $scene != self

    end

    Graphics.update

    pre_terminate

    Graphics.freeze

    terminate

    end

    def initialize(menu_index = 0)

    @menu_index = menu_index

    end

    def perform_transition

    Graphics.transition(10, "Graphics/System/BattleStart", 80)

    end

    def start

    @menu_back = Plane.new

    @menu_back.bitmap = Cache.menu("Background")

    @menu_layout = Sprite.new

    @menu_layout.bitmap = Cache.menu("Menu_Layout")

    @menu_com = Sprite.new

    @menu_com.bitmap = Cache.menu("Menu_Com01")

    @menu_select = Sprite.new

    @menu_select.bitmap = Cache.menu("Menu_Select00")

    create_command_window

    @gold_window = Window_Gold_Menu.new(195, 45)

    @status_window = Window_MenuStatus_Yui.new(100, 60)

    @playtime_window = Window_Time .new(165, 0)

    @mapname_window = Window_Mapname.new(195,360)

    @status_window.opacity = 0

    @playtime_window.opacity = 0

    @mapname_window.opacity = 0

    @gold_window.opacity = 0

    end

    def pre_terminate

    end

    def terminate

    @menu_back.dispose

    @menu_layout.dispose

    @menu_com.dispose

    @menu_select.dispose

    @command_window.dispose

    @gold_window.dispose

    @status_window.dispose

    @playtime_window.dispose

    @mapname_window.dispose

    end

    def update

    @menu_back.ox += 1

    @command_window.update

    @gold_window.update

    @status_window.update

    @mapname_window.update

    @playtime_window.update

    if @command_window.active

    update_command_selection

    elsif @status_window.active

    update_actor_selection

    end

    end

    def create_command_window

    s1 = Vocab::item

    s2 = Vocab::skill

    s3 = Vocab::equip

    s4 = Vocab::status

    s5 = Vocab::game_end

    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])

    @command_window.index = @menu_index

    @command_window.openness = 0

    @command_window.open

    @command_window.opacity = 0

    @command_window.contents_opacity = 0

    if $game_system.save_disabled

    @command_window.draw_item(4, false)

    end

    end

    def update_command_selection

    case @command_window.index

    when 0 #Item

    @menu_com.bitmap = Cache.menu("Menu_Com01")

    when 1 #Status

    @menu_com.bitmap = Cache.menu("Menu_Com02")

    when 2 #Equip

    @menu_com.bitmap = Cache.menu("Menu_Com03")

    when 3 #Skill

    @menu_com.bitmap = Cache.menu("Menu_Com04")

    when 4 # Exit

    @menu_com.bitmap = Cache.menu("Menu_Com06")

    end

    if Input.trigger?(Input::B)

    Sound.play_cancel

    $scene = Scene_Map.new

    elsif Input.trigger?(Input::C)

    if $game_party.members.size == 0 and @command_window.index < 4

    Sound.play_buzzer

    return

    elsif $game_system.save_disabled and @command_window.index == 4

    Sound.play_buzzer

    return

    end

    Sound.play_decision

    case @command_window.index

    when 0

    $scene = Scene_Item.new

    when 1,2,3

    start_actor_selection

    when 4

    $scene = Scene_End.new

    end

    end

    end

    def start_actor_selection

    @command_window.active = false

    @status_window.active = true

    if $game_party.last_actor_index < @status_window.item_max

    @status_window.index = $game_party.last_actor_index

    else

    @status_window.index = 0

    end

    end

    def end_actor_selection

    @command_window.active = true

    @status_window.active = false

    @menu_select.bitmap = Cache.menu("Menu_Select00")

    @status_window.index = -1

    end

    def update_actor_selection

    case @status_window.index

    when 0

    @menu_select.bitmap = Cache.menu("Menu_Select01")

    when 1

    @menu_select.bitmap = Cache.menu("Menu_Select02")

    when 2

    @menu_select.bitmap = Cache.menu("Menu_Select03")

    when 3

    @menu_select.bitmap = Cache.menu("Menu_Select04")

    end

    if Input.trigger?(Input::B)

    Sound.play_cancel

    end_actor_selection

    elsif Input.trigger?(Input::C)

    $game_party.last_actor_index = @status_window.index

    Sound.play_decision

    case @command_window.index

    when 1

    $scene = Scene_Skill.new(@status_window.index)

    when 2

    $scene = Scene_Equip.new(@status_window.index)

    when 3

    $scene = Scene_Status.new(@status_window.index)

    when 4

    actor_id = $game_party.members[@status_window.index].id

    x = $game_party.members[@status_window.index].last_grid_x

    y = $game_party.members[@status_window.index].last_grid_y

    proceed_ability_grid(actor_id,x,y)

    end

    end

    end

    end

    $mogscript = {} if $mogscript == nil

    $mogscript["menu_yui"] = true

     

     

    la modifica parte dalla linea 379

    ps provandolo con il sistema di combattimento base del vx non da problemi

  5. Durante il gioco uno dei protagonisti deve ricordare un evento accaduto e che quindi deve essere visibile al giocatore.

    Per il passaggio tra la schermata dove si trova il protagonista e il ricordo in questione vorrei fare un sorta di animazione (esempio come quando nei telefilm si sente il suono dell'arpa e inizia il ricordo,bordi sfuocati che si muovono) c è qualche effetto che posso utilizzare,e se si come??

  6. Avevo trovato questo script,ma non ha l'animazione che cercavo io(vale a dire che non si posiziona davanti)e non so come farlo partire.a non ha l'animazione che cercavo io(vale a dire che non si posiziona davanti)e non so come farlo partire.

    Sito= http://www.rpgmakerv...showtopic=48699

    #						 Protect Skill v 1.2.3
    #						   by Kal
    #
    #						 ===== How to use =====
    #
    # Make a state that has the magic word in it's note box. When that state
    # is inflicted on an ally, the person who inflicted the state (by casting
    # a spell that adds the state, for example) will receive all the damage
    # that is done to the ally.
    #
    #				  ===== What battle system is this for? =====
    #		
    # The script was designed for the default battle system but it's also works
    # with Tankentai (and ATB). However, there is no animation support for
    # Tankentai at the moment (i.e. protector jumping in front of protectee) and
    # the damage numbers need to be fixed.
    #
    #						 ===== Version history =====
    #
    # 1.0 - Finished script
    #
    # 1.1   - Added message text configuration in the config module.
    #	   - Status effect will be removed immediately after the protector dies
    #	   - Fixed a bug where a dead protector would still protect under certain
    #		 circumstances.
    #	   - Fixed a bug where the protect message got drawn when it shouldn't.
    #
    # 1.2   - Added ability to increase/decrease the amount of damage a protector
    #		 takes when protecting.
    #
    # 1.2.1 - Fixed using items on protector bug with Tankentai + ATB.
    #
    # 1.2.2 - Fixed a bug where you could not cast the state again after a battle.
    #
    # 1.2.3 - Fixed a bug with Tankentai + ATB where the protect state would not
    #		 be removed when the protector died.
    module ProtectConfig
     MAGIC_WORD		   = "Protect"
     # Add this word in the "Note" box for any status in order to enable protect
     # for that status.
     PROTECT_PHYSICAL	 = true
     PROTECT_SKILLS	   = true
     # Set these to true/false to enable/disable protection from physical damage
     # and protection from skills damage.
     PROTECT_LIMIT		= 1
     # This is the number of allies one character can protect at the same time.
     DAMAGE_EFFECT		= 100
     # This is a percentage of damage the protector will take when protecting
     # an ally. For example, if this value is set to 50, the protector will take
     # half damage when protecting an ally.
     MP_DAMAGE_EFFECT	 = false
     # Should DAMAGE_EFFECT apply to MP damage?
     MESSAGE = lambda do |context|
    eval "protector.name + ' protected ' + target.name + '!'", context
    # Edit this line to change the message that is displayed when an actor
    # protects an ally. protector.name is the protector's name and
    # target.name is the protected ally's name. Any text you want to add
    # needs to be in single quote strings, as above.
    # Note: not working for Tankentai at the moment.
     end
    end
    class RPG::State
     attr_accessor :skill_user
    
     def protect?
    set_protect if @protect.nil?
    @protect
     end
    
     def set_protect
    if @note.downcase =~ /#{ProtectConfig::MAGIC_WORD.downcase}/
      @protect = true
    else
      @protect = false
    end
     end
    end
    class Scene_Battle
     unless $@
    alias :kal_old_display_action_effects :display_action_effects
    alias :kal_old_process_action :process_action
     end
     # NOTE: not being called at all with Tankentai and ATB. Fix?
     def display_action_effects(target, obj = nil)
    # If this is a physical attack (obj == nil) and PROTECT_PHYSICAL is false
    if !ProtectConfig::PROTECT_PHYSICAL and obj.nil?
      kal_old_display_action_effects(target, obj) # call original method and return
      return
    # If this is a skills attack and PROTECT_SKILLS is false
    elsif !ProtectConfig::PROTECT_SKILLS and obj
      kal_old_display_action_effects(target, obj) # call original method and return
      return
    end
     
    if target.protect?
      protector = target.states.find { |state| state.protect? }.skill_user
      protector.display_protect = true unless protector.dead?
      if protector != @active_battler and protector.display_protect
    	protector.display_protect = false if protector.dead?
    	text = ProtectConfig::MESSAGE.call(binding)
    	@message_window.add_instant_text(text)
    	wait(30)
    	kal_old_display_action_effects(protector)
    	return
      end
    end
     
    kal_old_display_action_effects(target, obj)
     end
     # Check if any protector is dead after an action has been processed.
     # If dead remove the state.
     def process_action
    kal_old_process_action
    $game_party.members.each do |member|
      member.states.each do |state|
    	if state.protect?
    	  if state.skill_user.dead?
    		state.skill_user.protected_allies = 0
    		member.remove_state(state.id)
    		@status_window.refresh
    	  end
    	end
      end
    end
     end
    end
    class Game_Battler
     attr_accessor :protected_allies, :display_protect, :protecting
    
     unless $@
    alias :kal_old_initialize :initialize
    alias :kal_old_make_attack_damage_value :make_attack_damage_value
    alias :kal_old_add_state :add_state
    alias :kal_old_skill_effect :skill_effect
    alias :kal_old_make_obj_damage_value :make_obj_damage_value
     end
    
     def initialize
    @protected_allies = 0
    @display_protect = true
    @protecting = false
    kal_old_initialize
     end
    
     def make_attack_damage_value(attacker, effect = nil)
    kal_old_make_attack_damage_value(attacker)
    if ProtectConfig::PROTECT_PHYSICAL
      states.each do |state|
    	if state.protect? and !state.skill_user.dead?
    	  @hp_damage = 0
    	  state.skill_user.protecting = true
    	  state.skill_user.attack_effect(attacker)
    	end
      end
      if @protecting
    	@hp_damage *= (ProtectConfig::DAMAGE_EFFECT / 100)
    	@protecting = false
      end
    end
     end
    
     def make_obj_damage_value(user, obj)
    kal_old_make_obj_damage_value(user, obj)
    if ProtectConfig::PROTECT_SKILLS and !$game_party.members.include?(user)
      states.each do |state|
    	if state.protect? and !state.skill_user.dead?
    	  @hp_damage = 0
    	  @mp_damage = 0
    	  state.skill_user.protecting = true
    	  state.skill_user.skill_effect(user, obj)
    	end
      end
      if @protecting
    	@hp_damage *= (ProtectConfig::DAMAGE_EFFECT / 100)
    	@mp_damage *= (ProtectConfig::DAMAGE_EFFECT / 100) if ProtectConfig::MP_DAMAGE_EFFECT
    	@protecting = false
      end
    end
     end
     def add_state(state_id)
    state = $data_states[state_id]
    if state.protect?
      state.skill_user = @skill_user
      @skill_user.protected_allies += 1
    end
    kal_old_add_state(state_id)
     end
    
     def skill_effect(user, skill)
    @skill_user = user
    kal_old_skill_effect(user, skill)
     end
    
     def protect?
    states.any? {|state| state.protect?}
     end
    end
    class Game_Actor
     alias :kal_old_state_resist? :state_resist? unless $@
     def state_resist?(state_id)
    # Prevent castng protect on self
    if @skill_user == self and $data_states[state_id].protect?
      return true
    #  Prevent casting protect on a char that is already protected
    elsif protect? and $data_states[state_id].protect?
      return true
    # Prevent casting protect if the protect limit is reached
    elsif @skill_user.protected_allies >= ProtectConfig::PROTECT_LIMIT
      return true
    end
    kal_old_state_resist?(state_id)
     end
    end
    class Game_Party
     alias :kal_old_remove_states_battle :remove_states_battle unless $@
    
     def remove_states_battle
    kal_old_remove_states_battle
    members.each do |actor|
      actor.protected_allies = 0
    end
     end
    end
    

  7. Salve,

    Ho 2 domande:

    1D Nel combattimento quando faccio un attacco critico la scritta mi viene troppo grande e abbastanza deformata....non c è un modo per avere una grandezza di font nel gioco diversa da quella in combattimento??(uso tanketai)

     

    2D ho il window bianco e nel combattimento tutte le scritte cambiano colore tranne il comando "combatti" e "fuggi" che rimangono bianche e quindi illeggibili..(uso tanketai)

     

    qualcuno sa come risolvere??

    grazie in anticipo

  8. Salve,

    vorrei se possibile un add-on per Kgc Overdrive che vi allego qua sotto.

    Praticamente quando la barra overdrive arriva al 100% a destra tra i comandi Attacca,magia,difesa,oggetti spuntasse fuori un comando overdrive dove se ci clicchi puoi scegliere la mossa "finale" da fare;un po come il limit break di ff7.(uso il tanketai la prima versione)

    Grazie in anticipo

     

    #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

    #_/ ◆ OverDrive System - KGC_OverDrive ◆ VX ◆

    #_/ ◇ Last Update: 2009/11/01 ◇

    #_/ ◆ Original Translation by Touchfuzzy ◆

    #_/ ◆ Updates by Mr. Anonymous & Mr. Bubble ◆

    #_/ ◆ KGC Site: ◆

    #_/ ◆ http://ytomy.sakura.ne.jp/

    #_/-----------------------------------------------------------------------------

    #_/ This script allows you to create skills that are not usable in

    #_/ battle until a character gains enough points from specified actions to use

    #_/ them.

    #_/-----------------------------------------------------------------------------

    #_/ ++ Creating Overdrive Skills (Basic) ++

    #_/ To set up a skill as an "Overdrive" skill (which cannot be used until

    #_/ the Overdrive Gauge is full), go into the database, click the Skills tab,

    #_/ locate the skill you desire, and then enter <overdrive> into the "Notes"

    #_/ text box.

    #_/-----------------------------------------------------------------------------

    #_/ ++ Creating Overdrive Skills (Advanced Options) ++

    #_/ You can specify how many points an Overdrive skill consumes in order to

    #_/ be used. The tag for this is <overdrive n> (where n = OD points)

    #_/

    #_/ EXAMPLE: <overdrive 1500> would require that user has at least 1500

    #_/ Overdrive points before being able to use the skill.

    #_/-- --

    #_/ You can also make skills that increase in power the more extra Overdrive

    #_/ points the user has. Use the tag <overdrive n+> (where n = OD points).

    #_/

    #_/ EXAMPLE: <overdrive 1000+> would consume all of the user's Overdrive

    #_/ points. If the user has any extra Overdrive points over 1000, the excess

    #_/ points will be used to calculate the extra power the skill receives.

    #_/ The extra power formula is:

    #_/ damage = original_damage * ( user's_total_OD_points / n )

    #_/-----------------------------------------------------------------------------

    #_/ ++ Adjusting Overdrive Gain Rate by Skills ++

    #_/ Also, you have the option to have skills increase the Overdrive Gauge more

    #_/ or less than normal. To do so, enter <od_gain_rate n%>

    #_/ (where n = a number) into the skill's "Notes" box.

    #_/

    #_/ EXAMPLE: <od_gain_rate 200%> would increase Overdrive Points

    #_/ gained from using this skill by 200% (x2).

    #_/-----------------------------------------------------------------------------

    #_/ ++ Creating Overdrive Increasing Items & Skills ++

    #_/ To create items and skills that increase, decrease or drain Overdrive

    #_/ gauge points, go into the database, click on the Items tab, locate the

    #_/ item/skill you desire, and then enter <od_add n> (where n = a number)

    #_/ into the "Notes" text box. Do not include a percent sign (%) with this

    #_/ tag.

    #_/

    #_/ Example #1: <od_add +250> would directly increase the target's Overdrive

    #_/ by 250 points.

    #_/ Example #2: <od_add -100> would decrease the target's Overdrive by

    #_/ 100 points.

    #_/=============================================================================

    #_/ ++ Script Commands ++

    #_/ These commands are used in "Script" function in the third page of event

    #_/ commands under "Advanced". Do not include the asterisk (*).

    #_/

    #_/ Increase OverDrive for an actor:

    #_/ * gain_actor_od_gauge(ActorID, Increase)

    #_/

    #_/ Increase OverDrive for an enemy:

    #_/ * gain_enemy_od_gauge(enemy_index, Increase)

    #_/

    #_/ Copy an actor's current overdrive points into a game variable:

    #_/ * get_actor_od_gauge(ActorID, VariableID)

    #_/

    #_/ Copy an enemy's current overdrive points into a game variable:

    #_/ * get_enemy_od_gauge(enemy_index, VariableID)

    #_/

    #_/ Change an actor's maximum number of overdrive gauges:

    #_/ * set_actor_od_gauge_number(ActorID, number)

    #_/

    #_/ Change an enemy's maximum number of overdrive gauges:

    #_/ * set_enemy_od_gauge_number(enemy_index, number)

    #_/

    #_/ Returns true if the actor has a full Overdrive gauge:

    #_/ * actor_od_gauge_max?(ActorID)

    #_/

    #_/ Returns true if the enemy has a full Overdrive gauge:

    #_/ * enemy_od_gauge_max?(enemy_index)

    #_/

    #_/ Modify an actor's drive types:

    #_/ * set_actor_drive_type(ActorID, [DriveTypes])

    #_/

    #_/ Modify an enemy's drive types:

    #_/ * set_enemy_drive_type(enemy_index, [DriveTypes])

    #_/

    #_/ [ Quick Key: ]

    #_/ [ ActorID = The ID number of the selected Actor in the database. ]

    #_/ [ Setting this to -1 will effect all actors. ]

    #_/ [ ]

    #_/ [ enemy_index = The index number of the Enemy in the current troop ]

    #_/ [ where 0 is the first enemy and 7 is the last enemy (0-7). ]

    #_/ [ Setting this to -1 will effect all enemies in battle. ]

    #_/ [ ]

    #_/ [ Increase = The amount of Overdrive points to increase or decrease. ]

    #_/ [ ]

    #_/ [ DriveTypes = The drive types as seen below in the customization block ]

    #_/ [ "DEFAULT_ACTOR_DRIVE_TYPE". If this is omitted, it's reset to default. ]

    #_/ [ ]

    #_/ [ VariableID = The ID number of a game variable in the database. ]

    #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

    #=============================================================================#

    # ★ Customization ★ #

    #=============================================================================#

    module KGC

    module OverDrive

    # ◆ Maximum Gauge Points ◆

    # This affects the amount of OP (Overdrive Points) required to fill the

    # Overdrive Gauge. Default: GAUGE_MAX = 1000

    GAUGE_MAX = 1000

    # ◆ Default OP Gain Rates ◆

    # You may specify the amount of OverDrive Points that battlers will be given

    # for specific actions performed.

    GAIN_RATE = [

    100, # 0 Gained per attack.

    500, # 1 Gained for taking damage.

    # This is per 100% MaxHP of damage taken, so with 500 you would

    # have to take 2 times your MaxHP to fill a 1,000 point GAUGE_MAX.

    200, # 2 Gained for defeating an enemy.

    100, # 3 Gained each time you run away from a fight.

    160, # 4 Gained for each round spent while fighting solo in battle, either

    # being the only character or being the last one alive.

    40, # 5 Gained for taking any action in a round

    160, # 6 Gained for each round surviving with 25% or less HP remaining.

    180, # 7 Gained for each round for guarding.

    ] # ← No not remove these lines. Alter to your heart's content, though.

    # ◆ Amount of Gauges ◆

    # Allows you to specify how many gauges a battler can have. These gauges stack

    # meaning when that after the first gauge is maxed, OverDrive points are

    # allocated to the next gauge. This also means that after using an OverDrive

    # skill, OverDrive points are given for that action if applicable.

    # As a final note, these gauges are displayed as one whole gauge.

    DEFAULT_GAUGE_NUMBER = 1

    # ◆ Default Actor OverDrive Increase Options ◆

    # Default Overdrive types that affect player-characters. The numbers in the

    # brackets [] are chosen from the GAIN_RATE above, to the right of the #.

    # It appears these numbers "stack" when setting up an individual character's

    # Overdrive parameters.

    DEFAULT_ACTOR_DRIVE_TYPE = [0, 1, 6, 7]

     

    # ◆ Default Enemy OverDrive Increase Options ◆

    # Default Overdrive types that affect enemies. The numbers in the brackets []

    # are chosen from the GAIN_RATE above, to the right of the #.

    DEFAULT_ENEMY_DRIVE_TYPE = [0, 1, 4, 5, 6]

    # ◆ OverDrive Gauge Colors ◆

    # Allows you to change the color of the overdrive gauges.

    # The color can also be determined by a red, green, and blue values.

    # Example: GAUGE_NORMAL_START_COLOR = Color.new(255, 0, 0) <- This is red.

    # This method of color assignment is much like Tint Screen event command.

    # Gauge Start Color

    GAUGE_NORMAL_START_COLOR = 14

    # Gauge End Color

    GAUGE_NORMAL_END_COLOR = 6

    # Max Gauge Start Color

    GAUGE_MAX_START_COLOR = 10

    # Max Gauge End Color

    GAUGE_MAX_END_COLOR = 2

     

    # ◆ KGC_GenericGauge Settings

    # These gauge settings only apply when KGC_GenericGauge is installed

    # true : Use GenericGauge image

    # false : Do not use generic gauge image

    ENABLE_GENERIC_GAUGE = true

    # ◆ Overdrive Gauge Image Settings

    # Images must be placed in the Graphics/System folder in your project.

    GAUGE_IMAGE = "GaugeOD" # Normal Gauge Image

    GAUGE_MAX_IMAGE = "GaugeODMax" # Maximum Gauge Image

    GAUGE_OFFSET = [-23, -2] # Position Offset[x, y]

    GAUGE_LENGTH = -4 # Length Correction

    GAUGE_SLOPE = 30 # Gauge slant in degrees (-89 ~ 89)

    # ◆ Gauge Y Coordinate ◆

    # This allows you to adjust the Y coordinate(depth) of the overdrive gauge.

    # Setting to -8 places the OD gauge at the same depth as the HP/MP gauges.

    GAUGE_OFFSET_Y = -8

     

    # ◆ Numerical Display of OverDrive Gauge Style ◆

    # This function allows you to display a numerical representation of the

    # current amount of OverDrive points an actor has.

    # 0: No numerical amount is displayed.

    # 1: OD Points - Displays the current amount as a straight number.

    # 2: Ratio 1 --> x%

    # 3: Ratio 2 --> x.x%

    # 4: Ratio 3 --> x.xx%

    # 5: Full Gauges - Displays total number of full gauges

    GAUGE_VALUE_STYLE = 2

     

    # ◆ Numerical Display Font Size ◆

    # This allows you to change the font size of the numerical display of the

    # OverDrive gauge, as defined above.

    GAUGE_VALUE_FONT_SIZE = 14

    # ◆ Empty OD Gauge Upon Death ◆

    # This toggle affects wether the OP Gauge is reset to zero once an actor

    # dies. true = Reset to 0. false = Gauge remains persistant.

    EMPTY_ON_DEAD = true

    # ◆ Hide Actor OD Gauge ◆

    # Hide the gauge for individual characters. The number of the character in

    # the Actors Database is inserted in the brackets.

    # Example: HIDE_GAUGE_ACTOR = [2] would always hide the gauge for the second

    # actor in the database. (Simple stuff.)

    HIDE_GAUGE_ACTOR = []

     

    # ◆ Hide OD Gauge in Menu ◆

    # This toggle allows you to hide the Overdrive gauge from the command menu.

    # true = Gauge is hidden.

    # false = Gauge remains persistant even in menu.

    HIDE_GAUGE_NOT_IN_BATTLE = false

    # ◆ Hide OD Gauge When Actor Lacks OD Skills ◆

    # This toggle allows you to hide the gauge if a character has no Overdrive

    # skills in his/her arsenal.

    # true = Gauge is hidden.

    # false = Gauge is not hidden.

    HIDE_GAUGE_NO_OD_SKILLS = false

    # ◆ Prevent Actors Without OD Skills From Gaining OP ◆

    # This toggle stops OP from being gained for characters that have no Overdrive

    # skills when HIDE_GAUGE_NO_OD_SKILLS = true.

    NOT_GAIN_GAUGE_HIDING = true

     

    # ◆ Hide OD Skills When Actor Lacks Max OP ◆

    # This toggle allows you to specify wether skills that do not yet meet the

    # required OP are visible.

    # true = Skills are hidden

    # false = skills are not hidden.

    HIDE_SKILL_LACK_OF_GAUGE = false

     

    # ◆ In-Battle Overdrive Gauge Message Name

    # The name for "Overdrive" when using items that affect Overdrive.

    GAUGE_NAME = "Overdrive"

    # ◆ In-battle Overdrive Messages

    # These messages are shown when using items that affect Overdrive.

    # First %s : battler's Name

    # Second %s : String as defined for GAUGE_NAME above.

    OD_GAIN_MESSAGE = {

    :drain_a => "%s's %s was drained!", # Absorbtion : Actor

    :drain_e => "%s's %s was drained!", # Absorbtion : Enemy

    :loss_a => "%s's %s decreased!", # Decrease : Actor

    :loss_e => "%s's %s decreased!", # Decrease : Enemy

    :recover_a => "%s's %s increased!", # Increase : Actor

    :recover_e => "%s's %s increased!", # Increase : Enemy

    } # <- Do not delete.

    end

    end

    #==============================================================================

    # ☆ Customize END ☆

    #==============================================================================

    $imported = {} if $imported == nil

    $imported["OverDrive"] = true

    module KGC::OverDrive

    # ドライブタイプ

    module Type

    ATTACK = 0 # Attack

    DAMAGE = 1 # Damage

    VICTORY = 2 # Victory

    ESCAPE = 3 # Escape

    ALONE = 4 # Alone

    ACTION = 5 # Action

    FATAL = 6 # Fatal

    GUARD = 7 # Guard

    end

    # 蓄積量表記

    module ValueStyle

    NONE = 0 # None

    IMMEDIATE = 1 # Immediate

    RATE = 2 # Ratio 1

    RATE_DETAIL1 = 3 # Ratio 2

    RATE_DETAIL2 = 4 # Ratio 3

    NUMBER = 5 # Gauge Number

    end

    module Regexp

    module UsableItem

    # Overdrive gain; first regexp was changed from original JP

    OD_GAIN = /<(?:OD_INCREASE|od_add)\s*([\+\-]?\d+)>/i

    end

    module Skill

    # OverDrive tag string

    OVER_DRIVE = /<(?:OVER_DRIVE|overdrive)\s*(\d+)?(\+)?>/i

    # OverDrive Gain Rate tag string

    OD_GAIN_RATE =

    /<(?:OD_GAIN_RATE|od_gain)\s*(\d+)[%%]?>/i

    end

    end

    end

    #==================================================

    #==============================================================================

    # □ KGC::Commands

    #==============================================================================

    module KGC

    module Commands

    module_function

    #--------------------------------------------------------------------------

    # ○ アクターのドライブゲージの増減

    # actor_id : アクター ID (-1 : パーティ全体)

    # value : 増加量 (マイナスも可)

    #--------------------------------------------------------------------------

    def gain_actor_od_gauge(actor_id, value)

    if actor_id == -1

    # 生存メンバー全員のゲージを操作

    $game_party.existing_members.each { |actor|

    next unless actor.can_gain_overdrive?

    actor.overdrive += value

    }

    else

    actor = $game_actors[actor_id]

    actor.overdrive += value if actor != nil && actor.exist?

    end

    end

    #--------------------------------------------------------------------------

    # ○ エネミーのドライブゲージの増減

    # enemy_index : エネミー index (-1 : 全体)

    # value : 増加量 (マイナスも可)

    #--------------------------------------------------------------------------

    def gain_enemy_od_gauge(enemy_index, value)

    if enemy_index == -1

    # 生存エネミー全員のゲージを操作

    $game_troop.existing_members.each { |enemy|

    enemy.overdrive += value

    }

    else

    enemy = $game_troop.members[enemy_index]

    enemy.overdrive += value if enemy != nil && enemy.exist?

    end

    end

    #--------------------------------------------------------------------------

    # ○ アクターのドライブゲージの取得

    # actor_id : アクター ID

    # variable_id : 戻り値を格納する変数 ID

    #--------------------------------------------------------------------------

    def get_actor_od_gauge(actor_id, variable_id = 0)

    actor = $game_actors[actor_id]

    n = (actor != nil ? actor.overdrive : 0)

    if variable_id > 0

    $game_variables[variable_id] = n

    end

    return n

    end

    #--------------------------------------------------------------------------

    # ○ エネミーのドライブゲージの取得

    # enemy_index : エネミー index

    # variable_id : 戻り値を格納する変数 ID

    #--------------------------------------------------------------------------

    def get_enemy_od_gauge(enemy_index, variable_id = 0)

    enemy = $game_troop.members[enemy_index]

    n = (enemy != nil ? enemy.overdrive : 0)

    if variable_id > 0

    $game_variables[variable_id] = n

    end

    return n

    end

    #--------------------------------------------------------------------------

    # ○ アクターのドライブゲージの本数を設定

    # actor_id : アクター ID (-1 : パーティ全体)

    # number : ゲージ本数

    #--------------------------------------------------------------------------

    def set_actor_od_gauge_number(actor_id, number)

    if actor_id == -1

    # メンバー全員の本数を設定

    $game_party.members.each { |actor|

    actor.drive_gauge_number = number

    }

    else

    actor = $game_actors[actor_id]

    actor.drive_gauge_number = number if actor != nil

    end

    end

    #--------------------------------------------------------------------------

    # ○ エネミーのドライブゲージの本数を設定

    # enemy_index : エネミー index (-1 : 全体)

    # number : ゲージ本数

    #--------------------------------------------------------------------------

    def set_enemy_od_gauge_number(enemy_index, number)

    if enemy_index == -1

    # 生存エネミー全員の本数を設定

    $game_troop.members.each { |enemy|

    enemy.drive_gauge_number = number

    }

    else

    enemy = $game_troop.members[enemy_index]

    enemy.drive_gauge_number = number if enemy != nil

    end

    end

    #--------------------------------------------------------------------------

    # ○ アクターのドライブゲージが最大か判定

    # actor_id : アクター ID

    #--------------------------------------------------------------------------

    def actor_od_gauge_max?(actor_id)

    actor = $game_actors[actor_id]

    return false if actor == nil

    return actor.overdrive == actor.max_overdrive

    end

    #--------------------------------------------------------------------------

    # ○ エネミーのドライブゲージが最大か判定

    # enemy_index : エネミー index

    #--------------------------------------------------------------------------

    def enemy_od_gauge_max?(enemy_index)

    enemy = $game_troop.members[enemy_index]

    return false if enemy == nil

    return enemy.overdrive == enemy.max_overdrive

    end

    #--------------------------------------------------------------------------

    # ○ アクターのドライブタイプの変更

    # actor_id : アクター ID (-1 : パーティ全体)

    # types : ドライブタイプの配列 (省略時 : 初期化)

    #--------------------------------------------------------------------------

    def set_actor_drive_type(actor_id, types = nil)

    if actor_id == -1

    # メンバー全員のドライブタイプを変更

    $game_party.members.each { |actor|

    actor.drive_type = types

    }

    else

    actor = $game_actors[actor_id]

    actor.drive_type = types if actor != nil

    end

    end

    #--------------------------------------------------------------------------

    # ○ エネミーのドライブタイプの変更

    # enemy_index : エネミー index (-1 : 全体)

    # types : ドライブタイプの配列 (省略時 : 初期化)

    #--------------------------------------------------------------------------

    def set_enemy_drive_type(enemy_index, types = nil)

    if enemy_index == -1

    # エネミー全員のドライブタイプを変更

    $game_troop.members.each { |enemy|

    enemy.drive_type = types

    }

    else

    enemy = $game_troop.members[enemy_index]

    enemy.drive_type = types if enemy != nil

    end

    end

    end

    end

    class Game_Interpreter

    include KGC::Commands

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ RPG::UsableItem

    #==============================================================================

    class RPG::UsableItem < RPG::BaseItem

    #--------------------------------------------------------------------------

    # ○ オーバードライブのキャッシュ生成

    #--------------------------------------------------------------------------

    def create_overdrive_cache

    @__od_gain = 0

    self.note.each_line { |line|

    case line

    when KGC::OverDrive::Regexp::UsableItem::OD_GAIN

    # ドライブゲージ増加

    @__od_gain = $1.to_i

    end

    }

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ増加量

    #--------------------------------------------------------------------------

    def od_gain

    create_overdrive_cache if @__od_gain == nil

    return @__od_gain

    end

    #--------------------------------------------------------------------------

    # ○ ドライブスキルであるか

    #--------------------------------------------------------------------------

    def overdrive

    return false

    end

    alias overdrive? overdrive

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ RPG::Skill

    #==============================================================================

    class RPG::Skill < RPG::UsableItem

    #--------------------------------------------------------------------------

    # ○ オーバードライブのキャッシュ生成

    #--------------------------------------------------------------------------

    def create_overdrive_cache

    super

    @__is_overdrive = false

    @__od_cost = KGC::OverDrive::GAUGE_MAX

    @__od_consume_all = false

    @__od_gain_rate = 100

    self.note.each_line { |line|

    case line

    when KGC::OverDrive::Regexp::Skill::OVER_DRIVE

    # オーバードライブ

    @__is_overdrive = true

    @__od_cost = $1.to_i if $1 != nil

    @__od_consume_all = ($2 != nil)

    when KGC::OverDrive::Regexp::Skill::OD_GAIN_RATE

    # ゲージ増加率

    @__od_gain_rate = $1.to_i

    end

    }

    # ドライブスキルでなければ、ゲージ消費量 0

    unless @__is_overdrive

    @__od_cost = 0

    end

    end

    #--------------------------------------------------------------------------

    # ○ ドライブスキルであるか

    #--------------------------------------------------------------------------

    def overdrive

    create_overdrive_cache if @__is_overdrive == nil

    return @__is_overdrive

    end

    alias overdrive? overdrive

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ消費量

    #--------------------------------------------------------------------------

    def od_cost

    create_overdrive_cache if @__od_cost == nil

    return @__od_cost

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ全消費か

    #--------------------------------------------------------------------------

    def od_consume_all

    create_overdrive_cache if @__od_consume_all == nil

    return @__od_consume_all

    end

    alias od_consume_all? od_consume_all

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ増加率

    #--------------------------------------------------------------------------

    def od_gain_rate

    create_overdrive_cache if @__od_gain_rate == nil

    return @__od_gain_rate

    end

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Vocab

    #==============================================================================

    module Vocab

    # ドライブゲージ名

    def self.overdrive

    return KGC::OverDrive::GAUGE_NAME

    end

    # アクター側メッセージ

    ActorODDrain = KGC::OverDrive::OD_GAIN_MESSAGE[:drain_a]

    ActorODLoss = KGC::OverDrive::OD_GAIN_MESSAGE[:loss_a]

    ActorODRecovery = KGC::OverDrive::OD_GAIN_MESSAGE[:recover_a]

    # 敵側メッセージ

    EnemyODDrain = KGC::OverDrive::OD_GAIN_MESSAGE[:drain_e]

    EnemyODLoss = KGC::OverDrive::OD_GAIN_MESSAGE[:loss_e]

    EnemyODRecovery = KGC::OverDrive::OD_GAIN_MESSAGE[:recover_e]

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Game_Battler

    #==============================================================================

    class Game_Battler

    #--------------------------------------------------------------------------

    # ● 公開インスタンス変数

    #--------------------------------------------------------------------------

    attr_writer :drive_type # ドライブタイプ

    attr_reader :od_damage # 行動結果: ドライブダメージ

    #--------------------------------------------------------------------------

    # ● 行動効果の保持用変数をクリア

    #--------------------------------------------------------------------------

    alias clear_action_results_KGC_OverDrive clear_action_results

    def clear_action_results

    clear_action_results_KGC_OverDrive

    @od_damage = 0

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ量取得

    #--------------------------------------------------------------------------

    def overdrive

    @overdrive = 0 if @overdrive == nil

    return @overdrive

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージの操作

    #--------------------------------------------------------------------------

    def overdrive=(value)

    @overdrive = [[value, max_overdrive].min, 0].max

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ最大量取得

    #--------------------------------------------------------------------------

    def max_overdrive

    return KGC::OverDrive::GAUGE_MAX * drive_gauge_number

    end

    #--------------------------------------------------------------------------

    # ○ ゲージ Max 判定

    #--------------------------------------------------------------------------

    def overdrive_max?

    return (overdrive == max_overdrive)

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ本数取得

    #--------------------------------------------------------------------------

    def drive_gauge_number

    if @drive_gauge_number == nil

    @drive_gauge_number = KGC::OverDrive::DEFAULT_GAUGE_NUMBER

    end

    return @drive_gauge_number

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ本数の操作

    #--------------------------------------------------------------------------

    def drive_gauge_number=(value)

    @drive_gauge_number = [value, 1].max

    end

    #--------------------------------------------------------------------------

    # ○ ドライブタイプの取得

    #--------------------------------------------------------------------------

    def drive_type

    return []

    end

    #--------------------------------------------------------------------------

    # ○ ドライブスキル習得済み判定

    #--------------------------------------------------------------------------

    def overdrive_skill_learned?

    return true

    end

    #--------------------------------------------------------------------------

    # ○ ゲージ表示判定

    #--------------------------------------------------------------------------

    def od_gauge_visible?

    return false

    end

    #--------------------------------------------------------------------------

    # ○ ゲージ増加可否判定

    #--------------------------------------------------------------------------

    def can_gain_overdrive?

    return true

    end

    #--------------------------------------------------------------------------

    # ○ 攻撃時増加判定

    #--------------------------------------------------------------------------

    def drive_attack?

    return drive_type.include?(KGC::OverDrive::Type::ATTACK)

    end

    #--------------------------------------------------------------------------

    # ○ 被ダメージ時増加判定

    #--------------------------------------------------------------------------

    def drive_damage?

    return drive_type.include?(KGC::OverDrive::Type::DAMAGE)

    end

    #--------------------------------------------------------------------------

    # ○ 勝利時増加判定

    #--------------------------------------------------------------------------

    def drive_victory?

    return drive_type.include?(KGC::OverDrive::Type::VICTORY)

    end

    #--------------------------------------------------------------------------

    # ○ 逃走時増加判定

    #--------------------------------------------------------------------------

    def drive_escape?

    return drive_type.include?(KGC::OverDrive::Type::ESCAPE)

    end

    #--------------------------------------------------------------------------

    # ○ 孤独時増加判定

    #--------------------------------------------------------------------------

    def drive_alone?

    return drive_type.include?(KGC::OverDrive::Type::ALONE)

    end

    #--------------------------------------------------------------------------

    # ○ 行動時増加判定

    #--------------------------------------------------------------------------

    def drive_action?

    return drive_type.include?(KGC::OverDrive::Type::ACTION)

    end

    #--------------------------------------------------------------------------

    # ○ 瀕死時増加判定

    #--------------------------------------------------------------------------

    def drive_fatal?

    return drive_type.include?(KGC::OverDrive::Type::FATAL)

    end

    #--------------------------------------------------------------------------

    # ○ 防御時増加判定

    #--------------------------------------------------------------------------

    def drive_guard?

    return drive_type.include?(KGC::OverDrive::Type::GUARD)

    end

    #--------------------------------------------------------------------------

    # ● ステートの付加

    # state_id : ステート ID

    #--------------------------------------------------------------------------

    alias add_state_KGC_OverDrive add_state

    def add_state(state_id)

    add_state_KGC_OverDrive(state_id)

    reset_overdrive_on_dead if dead?

    end

    #--------------------------------------------------------------------------

    # ○ スキルの消費ドライブゲージ計算

    # skill : スキル

    #--------------------------------------------------------------------------

    def calc_od_cost(skill)

    return 0 unless skill.is_a?(RPG::Skill)

    return skill.od_cost

    end

    #--------------------------------------------------------------------------

    # ● スキルの使用可能判定

    # skill : スキル

    #--------------------------------------------------------------------------

    alias skill_can_use_KGC_OverDrive? skill_can_use?

    def skill_can_use?(skill)

    return false unless skill_can_use_KGC_OverDrive?(skill)

    return false if calc_od_cost(skill) > overdrive

    return true

    end

    #--------------------------------------------------------------------------

    # ● スキルまたはアイテムによるダメージ計算

    # user : スキルまたはアイテムの使用者

    # obj : スキルまたはアイテム

    # 結果は @hp_damage または @mp_damage に代入する。

    #--------------------------------------------------------------------------

    alias make_obj_damage_value_KGC_OverDrive make_obj_damage_value

    def make_obj_damage_value(user, obj)

    make_obj_damage_value_KGC_OverDrive(user, obj)

    apply_od_consume_all_for_damage(user, obj)

    end

    #--------------------------------------------------------------------------

    # ○ ゲージ全消費時の効果の適用

    # user : スキルまたはアイテムの使用者

    # obj : スキルまたはアイテム

    # 結果は @hp_damage または @mp_damage に代入する。

    #--------------------------------------------------------------------------

    def apply_od_consume_all_for_damage(user, obj)

    return unless obj.is_a?(RPG::Skill)

    return unless obj.overdrive? && obj.od_consume_all?

    # 余剰消費量に応じて強化 (例: 最低消費量 1000 でゲージが 1200 なら 1.2 倍)

    rate = [user.overdrive * 1000 / obj.od_cost, 1000].max

    @hp_damage = @hp_damage * rate / 1000

    @mp_damage = @mp_damage * rate / 1000

    end

    #--------------------------------------------------------------------------

    # ● ダメージの反映

    # user : スキルかアイテムの使用者

    # 呼び出し前に @hp_damage、@mp_damage、@absorbed が設定されていること。

    #--------------------------------------------------------------------------

    alias execute_damage_KGC_OverDrive execute_damage

    def execute_damage(user)

    execute_damage_KGC_OverDrive(user)

    increase_overdrive(user)

    increase_overdrive_by_item(user)

    end

    #--------------------------------------------------------------------------

    # ○ 死亡時ドライブゲージ初期化処理

    #--------------------------------------------------------------------------

    def reset_overdrive_on_dead

    return unless KGC::OverDrive::EMPTY_ON_DEAD

    self.overdrive = 0

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ増加処理

    # attacker : 攻撃者

    #--------------------------------------------------------------------------

    def increase_overdrive(attacker = nil)

    return unless attacker.is_a?(Game_Battler) # 攻撃者がバトラーでない

    return unless actor? ^ attacker.actor? # 攻撃側と防御側が同じ

    return if hp_damage == 0 && mp_damage == 0 # ダメージなし

    increase_attacker_overdrive(attacker)

    increase_defender_overdrive(attacker)

    reset_overdrive_on_dead if dead?

    end

    #--------------------------------------------------------------------------

    # ○ 攻撃側のドライブゲージ増加処理

    # attacker : 攻撃者

    #--------------------------------------------------------------------------

    def increase_attacker_overdrive(attacker)

    return unless can_gain_overdrive?

    return unless attacker.drive_attack? # ドライブタイプ「攻撃」なし

    od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ATTACK]

    if attacker.action.kind == 1

    rate = attacker.action.skill.od_gain_rate # スキルの倍率を適用

    od_gain = od_gain * rate / 100

    if rate > 0

    od_gain = [od_gain, 1].max

    elsif rate < 0

    od_gain = [od_gain, -1].min

    end

    end

    attacker.overdrive += od_gain

    end

    #--------------------------------------------------------------------------

    # ○ 防御側のドライブゲージ増加処理

    # attacker : 攻撃者

    #--------------------------------------------------------------------------

    def increase_defender_overdrive(attacker)

    return unless can_gain_overdrive?

    return unless self.drive_damage? # ドライブタイプ「ダメージ」なし

    rate = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::DAMAGE]

    od_gain = 0

    od_gain += hp_damage * rate / maxhp if hp_damage > 0

    od_gain += mp_damage * rate / maxmp if mp_damage > 0 && maxmp > 0

    if rate > 0

    od_gain = [od_gain, 1].max

    elsif rate < 0

    od_gain = [od_gain, -1].min

    end

    self.overdrive += od_gain

    end

    #--------------------------------------------------------------------------

    # ○ アイテムによるドライブゲージ増加処理

    # user : 使用者

    #--------------------------------------------------------------------------

    def increase_overdrive_by_item(user = nil)

    return unless user.is_a?(Game_Battler)

    return unless can_gain_overdrive?

    if user.action.skill?

    obj = user.action.skill

    elsif user.action.item?

    obj = user.action.item

    else

    return

    end

    @od_damage = -obj.od_gain

    self.overdrive -= @od_damage

    end

    #--------------------------------------------------------------------------

    # ● スキルの効果適用

    # user : スキルの使用者

    # skill : スキル

    #--------------------------------------------------------------------------

    alias skill_effect_KGC_OverDrive skill_effect

    def skill_effect(user, skill)

    skill_effect_KGC_OverDrive(user, skill)

    # アイテムでスキルを発動した場合はゲージ消費判定を無視

    if $imported["ReproduceFunctions"] && $game_temp.exec_skill_on_item

    return

    end

    end

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Game_Actor

    #==============================================================================

    class Game_Actor < Game_Battler

    #--------------------------------------------------------------------------

    # ● セットアップ

    # actor_id : アクター ID

    #--------------------------------------------------------------------------

    alias setup_KGC_OverDrive setup

    def setup(actor_id)

    setup_KGC_OverDrive(actor_id)

    @overdrive = 0

    @drive_type = nil

    end

    #--------------------------------------------------------------------------

    # ○ ドライブタイプの取得

    #--------------------------------------------------------------------------

    def drive_type

    unless @drive_type.is_a?(Array)

    return KGC::OverDrive::DEFAULT_ACTOR_DRIVE_TYPE

    end

    return @drive_type

    end

    #--------------------------------------------------------------------------

    # ○ ドライブスキル習得済み判定

    #--------------------------------------------------------------------------

    def overdrive_skill_learned?

    result = false

    # 一時的に戦闘中フラグを解除

    last_in_battle = $game_temp.in_battle

    $game_temp.in_battle = false

    self.skills.each { |skill|

    if skill.overdrive?

    result = true

    break

    end

    }

    $game_temp.in_battle = last_in_battle

    return result

    end

    #--------------------------------------------------------------------------

    # ○ ゲージ増加可否判定

    #--------------------------------------------------------------------------

    def can_gain_overdrive?

    if KGC::OverDrive::NOT_GAIN_GAUGE_HIDING

    # 非表示

    return false unless od_gauge_visible_l?

    end

    if KGC::OverDrive::HIDE_GAUGE_NO_OD_SKILLS

    # 未修得

    return false unless overdrive_skill_learned?

    end

    return true

    end

    #--------------------------------------------------------------------------

    # ○ ゲージ表示判定

    #--------------------------------------------------------------------------

    def od_gauge_visible?

    return false unless od_gauge_visible_l?

    return false unless can_gain_overdrive?

    return true

    end

    #--------------------------------------------------------------------------

    # ○ ゲージ表示判定 (簡易版)

    #--------------------------------------------------------------------------

    def od_gauge_visible_l?

    # 戦闘中非表示

    if KGC::OverDrive::HIDE_GAUGE_NOT_IN_BATTLE && !$game_temp.in_battle

    return false

    end

    # 非表示

    return false if KGC::OverDrive::HIDE_GAUGE_ACTOR.include?(self.id)

    return true

    end

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Game_Enemy

    #==============================================================================

    class Game_Enemy < Game_Battler

    #--------------------------------------------------------------------------

    # ● オブジェクト初期化

    # index : 敵グループ内インデックス

    # enemy_id : 敵キャラ ID

    #--------------------------------------------------------------------------

    alias initialize_KGC_OverDrive initialize

    def initialize(index, enemy_id)

    initialize_KGC_OverDrive(index, enemy_id)

    @overdrive = 0

    @drive_type = nil

    end

    #--------------------------------------------------------------------------

    # ○ ドライブタイプの取得

    #--------------------------------------------------------------------------

    def drive_type

    unless @drive_type.is_a?(Array)

    return KGC::OverDrive::DEFAULT_ENEMY_DRIVE_TYPE

    end

    return @drive_type

    end

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Window_Base

    #==============================================================================

    class Window_Base < Window

    #--------------------------------------------------------------------------

    # ○ ドライブゲージの通常時の色 1 の取得

    #--------------------------------------------------------------------------

    def od_gauge_normal_color1

    color = KGC::OverDrive::GAUGE_NORMAL_START_COLOR

    return (color.is_a?(Integer) ? text_color(color) : color)

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージの通常時の色 2 の取得

    #--------------------------------------------------------------------------

    def od_gauge_normal_color2

    color = KGC::OverDrive::GAUGE_NORMAL_END_COLOR

    return (color.is_a?(Integer) ? text_color(color) : color)

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージの最大時の色 1 の取得

    #--------------------------------------------------------------------------

    def od_gauge_max_color1

    color = KGC::OverDrive::GAUGE_MAX_START_COLOR

    return (color.is_a?(Integer) ? text_color(color) : color)

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージの最大時の色 2 の取得

    #--------------------------------------------------------------------------

    def od_gauge_max_color2

    color = KGC::OverDrive::GAUGE_MAX_END_COLOR

    return (color.is_a?(Integer) ? text_color(color) : color)

    end

    #--------------------------------------------------------------------------

    # ● 名前の描画

    # actor : アクター

    # x : 描画先 X 座標

    # y : 描画先 Y 座標

    #--------------------------------------------------------------------------

    alias draw_actor_name_KGC_OverDrive draw_actor_name

    def draw_actor_name(actor, x, y)

    draw_actor_od_gauge(actor, x, y, 108)

    draw_actor_name_KGC_OverDrive(actor, x, y)

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージの描画

    # actor : アクター

    # x : 描画先 X 座標

    # y : 描画先 Y 座標

    # width : 幅

    #--------------------------------------------------------------------------

    def draw_actor_od_gauge(actor, x, y, width = 120)

    return unless actor.od_gauge_visible?

    n = actor.overdrive % KGC::OverDrive::GAUGE_MAX

    n = KGC::OverDrive::GAUGE_MAX if actor.overdrive_max?

    if KGC::OverDrive::ENABLE_GENERIC_GAUGE && $imported["GenericGauge"]

    # 汎用ゲージ

    file = (actor.overdrive_max? ?

    KGC::OverDrive::GAUGE_MAX_IMAGE : KGC::OverDrive::GAUGE_IMAGE)

    draw_gauge(file,

    x, y, width, n, KGC::OverDrive::GAUGE_MAX,

    KGC::OverDrive::GAUGE_OFFSET,

    KGC::OverDrive::GAUGE_LENGTH,

    KGC::OverDrive::GAUGE_SLOPE)

    else

    # デフォルトゲージ

    gw = width * n / KGC::OverDrive::GAUGE_MAX

    gc1 = (gw == width ? od_gauge_max_color1 : od_gauge_normal_color1)

    gc2 = (gw == width ? od_gauge_max_color2 : od_gauge_normal_color2)

    self.contents.fill_rect(x, y + WLH + KGC::OverDrive::GAUGE_OFFSET_Y,

    width, 6, gauge_back_color)

    self.contents.gradient_fill_rect(

    x, y + WLH + KGC::OverDrive::GAUGE_OFFSET_Y, gw, 6, gc1, gc2)

    end

    draw_actor_od_gauge_value(actor, x, y, width)

    end

    #--------------------------------------------------------------------------

    # ○ ドライブゲージ蓄積量の描画

    # actor : アクター

    # x : 描画先 X 座標

    # y : 描画先 Y 座標

    # width : 幅

    #--------------------------------------------------------------------------

    def draw_actor_od_gauge_value(actor, x, y, width = 120)

    text = ""

    value = actor.overdrive * 100.0 / KGC::OverDrive::GAUGE_MAX

    case KGC::OverDrive::GAUGE_VALUE_STYLE

    when KGC::OverDrive::ValueStyle::IMMEDIATE

    text = actor.overdrive.to_s

    when KGC::OverDrive::ValueStyle::RATE

    text = sprintf("%d%%", actor.overdrive * 100 / KGC::OverDrive::GAUGE_MAX)

    when KGC::OverDrive::ValueStyle::RATE_DETAIL1

    text = sprintf("%0.1f%%", value)

    when KGC::OverDrive::ValueStyle::RATE_DETAIL2

    text = sprintf("%0.2f%%", value)

    when KGC::OverDrive::ValueStyle::NUMBER

    text = "#{actor.overdrive / KGC::OverDrive::GAUGE_MAX}"

    else

    return

    end

    last_font_size = self.contents.font.size

    new_font_size = KGC::OverDrive::GAUGE_VALUE_FONT_SIZE

    self.contents.font.size = new_font_size

    self.contents.draw_text(

    x, y + WLH + KGC::OverDrive::GAUGE_OFFSET_Y - new_font_size / 2,

    width, new_font_size, text, 2)

    self.contents.font.size = last_font_size

    end

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Window_Skill

    #==============================================================================

    if KGC::OverDrive::HIDE_SKILL_LACK_OF_GAUGE

    class Window_Skill < Window_Selectable

    #--------------------------------------------------------------------------

    # ○ スキルをリストに含めるかどうか

    # skill : スキル

    #--------------------------------------------------------------------------

    unless $@

    alias include_KGC_OverDrive? include? if method_defined?(:include?)

    end

    def include?(skill)

    return false if skill == nil

    if defined?(include_KGC_OverDrive?)

    return false unless include_KGC_OverDrive?(skill)

    end

    if skill.overdrive?

    return (@actor.calc_od_cost(skill) <= @actor.overdrive)

    else

    return true

    end

    end

    if method_defined?(:include_KGC_OverDrive?)

    #--------------------------------------------------------------------------

    # ● リフレッシュ

    #--------------------------------------------------------------------------

    def refresh

    @data = []

    for skill in @actor.skills

    next unless include?(skill)

    @data.push(skill)

    if skill.id == @actor.last_skill_id

    self.index = @data.size - 1

    end

    end

    @item_max = @data.size

    create_contents

    for i in 0...@item_max

    draw_item(i)

    end

    end

    end

    end # <-- class

    end # <-- if KGC::OverDrive::HIDE_SKILL_LACK_OF_GAUGE

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Scene_Skill

    #==============================================================================

    class Scene_Skill < Scene_Base

    #--------------------------------------------------------------------------

    # ● スキルの使用 (味方対象以外の使用効果を適用)

    #--------------------------------------------------------------------------

    alias use_skill_nontarget_KGC_OverDrive use_skill_nontarget

    def use_skill_nontarget

    consume_od_gauge

    use_skill_nontarget_KGC_OverDrive

    end

    #--------------------------------------------------------------------------

    # ○ スキル使用時のドライブゲージ消費

    #--------------------------------------------------------------------------

    def consume_od_gauge

    if @skill.od_consume_all?

    @actor.overdrive = 0

    else

    @actor.overdrive -= @actor.calc_od_cost(@skill)

    end

    end

    end

    #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

    #==============================================================================

    # ■ Scene_Battle

    #==============================================================================

    class Scene_Battle < Scene_Base

    #--------------------------------------------------------------------------

    # ● 戦闘終了

    # result : 結果 (0:勝利 1:逃走 2:敗北)

    #--------------------------------------------------------------------------

    alias battle_end_KGC_OverDrive battle_end

    def battle_end(result)

    increase_overdrive_on_battle_end(result)

    battle_end_KGC_OverDrive(result)

    end

    #--------------------------------------------------------------------------

    # ○ 戦闘終了時のドライブゲージ増加処理

    # result : 結果 (0:勝利 1:逃走 2:敗北)

    #--------------------------------------------------------------------------

    def increase_overdrive_on_battle_end(result)

    case result

    when 0 # 勝利

    od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::VICTORY]

    $game_party.existing_members.each { |actor|

    actor.overdrive += od_gain if actor.drive_victory?

    }

    when 1 # 逃走

    od_gain = KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ESCAPE]

    $game_party.existing_members.each { |actor|

    actor.overdrive += od_gain if actor.drive_escape?

    }

    end

    end

    #--------------------------------------------------------------------------

    # ● 戦闘行動の実行

    #--------------------------------------------------------------------------

    alias execute_action_KGC_OverDrive execute_action

    def execute_action

    increase_overdrive_on_action

    execute_action_KGC_OverDrive

    end

    #--------------------------------------------------------------------------

    # ○ 行動時のドライブゲージ増加処理

    #--------------------------------------------------------------------------

    def increase_overdrive_on_action

    battler = @active_battler

    od_gain = 0

    unit = (battler.actor? ? $game_party : $game_troop)

    # 孤独戦闘

    if battler.drive_alone? && unit.existing_members.size == 1

    od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ALONE]

    end

    # 行動

    if battler.drive_action?

    od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::ACTION]

    end

    # 瀕死

    if battler.drive_fatal? && battler.hp < battler.maxhp / 4

    od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::FATAL]

    end

    # 防御

    if battler.drive_guard? && battler.action.kind == 0 &&

    battler.action.basic == 1

    od_gain += KGC::OverDrive::GAIN_RATE[KGC::OverDrive::Type::GUARD]

    end

    battler.overdrive += od_gain

    end

    #--------------------------------------------------------------------------

    # ● 戦闘行動の実行 : スキル

    #--------------------------------------------------------------------------

    alias execute_action_skill_KGC_OverDrive execute_action_skill

    def execute_action_skill

    execute_action_skill_KGC_OverDrive

    consume_od_gauge

    end

    #--------------------------------------------------------------------------

    # ○ スキル使用時のドライブゲージ消費

    #--------------------------------------------------------------------------

    def consume_od_gauge

    return unless @active_battler.action.skill?

    skill = @active_battler.action.skill

    if skill.od_consume_all?

    @active_battler.overdrive = 0

    else

    @active_battler.overdrive -= @active_battler.calc_od_cost(skill)

    end

    end

    #--------------------------------------------------------------------------

    # ● ダメージの表示

    # target : 対象者

    # obj : スキルまたはアイテム

    #--------------------------------------------------------------------------

    alias display_damage_KGC_OverDrive display_damage

    def display_damage(target, obj = nil)

    display_damage_KGC_OverDrive(target, obj)

    return if target.missed || target.evaded

    display_od_damage(target, obj)

    end

    #--------------------------------------------------------------------------

    # ○ ドライブダメージ表示

    # target : 対象者

    # obj : スキルまたはアイテム

    #--------------------------------------------------------------------------

    def display_od_damage(target, obj = nil)

    return if target.dead?

    return if target.od_damage == 0

    if target.absorbed # 吸収

    fmt = target.actor? ? Vocab::ActorODDrain : Vocab::EnemyODDrain

    text = sprintf(fmt, target.name, Vocab::overdrive)

    elsif target.od_damage > 0 # ダメージ

    fmt = target.actor? ? Vocab::ActorODLoss : Vocab::EnemyODLoss

    text = sprintf(fmt, target.name, Vocab::overdrive)

    else # 回復

    fmt = target.actor? ? Vocab::ActorODRecovery : Vocab::EnemyODRecovery

    text = sprintf(fmt, target.name, Vocab::overdrive)

    Sound.play_recovery

    end

    @message_window.add_instant_text(text)

    wait(30)

    end

    end

  9. Salve,uso il sistema di parallaxing e fin qui tutto ok,ma dopo 3 mappe del progetto ho aggiunto dei chara, solo che questi si muovono se sposto l'eroe(cioè non si muovono come se impostassi il movimento, ma si spostano leggermente) ,nelle prime mappe non succedeva , cosa può essere?
×
×
  • Create New...