[RPGXP]0----Hướng Dẫn Script Cho RPG Maker XP----0

Thảo luận trong 'Lưu Trữ' bắt đầu bởi ken10, 24/4/06.

  1. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Sau đây là cái script Ngộ nhặt bên nước ngoài và đã thử nghiệm <<<Trên cả tuyệt vời >>> Cái này là để hiển thị thanh HP+MP+EXP .Chép vô phần nào đó bên trên Main ::
    Mã:
    #===================================================
    # ?¡ Game_Actor
    #------------------------------------------------------------------------------
    # ?@ƒAƒNƒ^?[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·?B‚±‚̃Nƒ‰ƒX‚Í Game_Actors ƒNƒ‰ƒX ($game_actors)
    # ‚Ì“à•”‚ÅŽg—p‚³‚ê?AGame_Party ƒNƒ‰ƒX ($game_party) ‚©‚ç‚àŽQ?Æ‚³‚ê‚Ü‚·?B
    #===================================================
    
    class Game_Actor < Game_Battler
    def now_exp
    return @exp - @exp_list[@level]
    end
    def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
    end
    end
    
    #===================================================
    # ?¡ Window_Base
    #------------------------------------------------------------------------------
    # ?@ƒQ?[ƒ€’†‚Ì‚·‚ׂẴEƒBƒ“ƒhƒE‚̃X?[ƒp?[ƒNƒ‰ƒX‚Å‚·?B
    #===================================================
    class Window_Base < Window
    #--------------------------------------------------------------------------
    # ?œ HP ƒQ?[ƒW‚Ì•`‰æ
    #--------------------------------------------------------------------------
    # ƒIƒŠƒWƒiƒ‹‚ÌHP•`‰æ‚ð draw_actor_hp_original ‚Æ–¼‘O•Ï?X
    alias :draw_actor_hp_original :draw_actor_hp
    def draw_actor_hp(actor, x, y, width = 144)
    # •Ï?”rate‚É Œ»?Ý‚ÌHP/MHP‚ð‘ã“ü
    if actor.maxhp != 0
    rate = actor.hp.to_f / actor.maxhp
    else
    rate = 0
    end
    # plus_x:X?À•W‚̈ʒu•â?³ rate_x:X?À•W‚̈ʒu•â?³(%) plus_y:Y?À•W‚̈ʒu•â?³
    # plus_width:•?‚Ì•â?³ rate_width:•?‚Ì•â?³(%) height:?c•?
    # align1:•`‰æƒ^ƒCƒv1 0:?¶‹l‚ß 1:’†‰›‘µ‚¦ 2:‰E‹l‚ß
    # align2:•`‰æƒ^ƒCƒv2 0:?ã‹l‚ß 1:’†‰›‘µ‚¦ 2:‰º‹l‚ß
    # align3:ƒQ?[ƒWƒ^ƒCƒv 0:?¶‹l‚ß 1:‰E‹l‚ß
    plus_x = 0
    rate_x = 0
    plus_y = 25
    plus_width = 0
    rate_width = 100
    height = 10
    align1 = 1
    align2 = 2
    align3 = 0
    # ƒOƒ‰ƒf?[ƒVƒ‡ƒ“?Ý’è grade1:‹óƒQ?[ƒW grade2:ŽÀƒQ?[ƒW
    # (0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“(Œƒ?d)?j
    grade1 = 1
    grade2 = 0
    # ?F?Ý’è?Bcolor1:ŠO˜g?Ccolor2:’†˜g
    # color3:‹óƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor4:‹óƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[
    # color5:ŽÀƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor6:ŽÀƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[
    color1 = Color.new(0, 0, 0, 192)
    color2 = Color.new(255, 255, 192, 192)
    color3 = Color.new(0, 0, 0, 192)
    color4 = Color.new(64, 0, 0, 192)
    color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
    color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
    # •Ï?”sp‚É•`‰æ‚·‚éƒQ?[ƒW‚Ì•?‚ð‘ã“ü
    if actor.maxhp != 0
    hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
    else
    hp = 0
    end
    # ƒQ?[ƒW‚Ì•`‰æ
    gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
    width, plus_width + width * rate_width / 100,
    height, hp, align1, align2, align3,
    color1, color2, color3, color4, color5, color6, grade1, grade2)
    # ƒIƒŠƒWƒiƒ‹‚ÌHP•`‰æ?ˆ—?‚ðŒÄ‚Ñ?o‚µ
    draw_actor_hp_original(actor, x, y, width)
    end
    #--------------------------------------------------------------------------
    # ?œ SP ƒQ?[ƒW‚Ì•`‰æ
    #--------------------------------------------------------------------------
    # ƒIƒŠƒWƒiƒ‹‚ÌSP•`‰æ‚ð draw_actor_sp_original ‚Æ–¼‘O•Ï?X
    alias :draw_actor_sp_original :draw_actor_sp
    def draw_actor_sp(actor, x, y, width = 144)
    # •Ï?”rate‚É Œ»?Ý‚ÌSP/MSP‚ð‘ã“ü
    if actor.maxsp != 0
    rate = actor.sp.to_f / actor.maxsp
    else
    rate = 1
    end
    # plus_x:X?À•W‚̈ʒu•â?³ rate_x:X?À•W‚̈ʒu•â?³(%) plus_y:Y?À•W‚̈ʒu•â?³
    # plus_width:•?‚Ì•â?³ rate_width:•?‚Ì•â?³(%) height:?c•?
    # align1:•`‰æƒ^ƒCƒv1 0:?¶‹l‚ß 1:’†‰›‘µ‚¦ 2:‰E‹l‚ß
    # align2:•`‰æƒ^ƒCƒv2 0:?ã‹l‚ß 1:’†‰›‘µ‚¦ 2:‰º‹l‚ß
    # align3:ƒQ?[ƒWƒ^ƒCƒv 0:?¶‹l‚ß 1:‰E‹l‚ß
    plus_x = 0
    rate_x = 0
    plus_y = 25
    plus_width = 0
    rate_width = 100
    height = 10
    align1 = 1
    align2 = 2
    align3 = 0
    # ƒOƒ‰ƒf?[ƒVƒ‡ƒ“?Ý’è grade1:‹óƒQ?[ƒW grade2:ŽÀƒQ?[ƒW
    # (0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“(Œƒ?d)?j
    grade1 = 1
    grade2 = 0
    # ?F?Ý’è?Bcolor1:ŠO˜g?Ccolor2:’†˜g
    # color3:‹óƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor4:‹óƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[
    # color5:ŽÀƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor6:ŽÀƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[
    color1 = Color.new(0, 0, 0, 192)
    color2 = Color.new(255, 255, 192, 192)
    color3 = Color.new(0, 0, 0, 192)
    color4 = Color.new(0, 64, 0, 192)
    color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
    color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
    # •Ï?”sp‚É•`‰æ‚·‚éƒQ?[ƒW‚Ì•?‚ð‘ã“ü
    if actor.maxsp != 0
    sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
    else
    sp = (width + plus_width) * rate_width / 100
    end
    # ƒQ?[ƒW‚Ì•`‰æ
    gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
    width, plus_width + width * rate_width / 100,
    height, sp, align1, align2, align3,
    color1, color2, color3, color4, color5, color6, grade1, grade2)
    # ƒIƒŠƒWƒiƒ‹‚ÌSP•`‰æ?ˆ—?‚ðŒÄ‚Ñ?o‚µ
    draw_actor_sp_original(actor, x, y, width)
    end
    #--------------------------------------------------------------------------
    # ?œ EXP ƒQ?[ƒW‚Ì•`‰æ
    #--------------------------------------------------------------------------
    # ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æ‚ð draw_actor_sp_original ‚Æ–¼‘O•Ï?X
    alias :draw_actor_exp_original :draw_actor_exp
    def draw_actor_exp(actor, x, y, width = 204)
    # •Ï?”rate‚É Œ»?Ý‚Ìexp/nextexp‚ð‘ã“ü
    if actor.next_exp != 0
    rate = actor.now_exp.to_f / actor.next_exp
    else
    rate = 1
    end
    # plus_x:X?À•W‚̈ʒu•â?³ rate_x:X?À•W‚̈ʒu•â?³(%) plus_y:Y?À•W‚̈ʒu•â?³
    # plus_width:•?‚Ì•â?³ rate_width:•?‚Ì•â?³(%) height:?c•?
    # align1:•`‰æƒ^ƒCƒv1 0:?¶‹l‚ß 1:’†‰›‘µ‚¦ 2:‰E‹l‚ß
    # align2:•`‰æƒ^ƒCƒv2 0:?ã‹l‚ß 1:’†‰›‘µ‚¦ 2:‰º‹l‚ß
    # align3:ƒQ?[ƒWƒ^ƒCƒv 0:?¶‹l‚ß 1:‰E‹l‚ß
    plus_x = 0
    rate_x = 0
    plus_y = 25
    plus_width = 0
    rate_width = 100
    height = 10
    align1 = 1
    align2 = 2
    align3 = 0
    # ƒOƒ‰ƒf?[ƒVƒ‡ƒ“?Ý’è grade1:‹óƒQ?[ƒW grade2:ŽÀƒQ?[ƒW
    # (0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“(Œƒ?d)?j
    grade1 = 1
    grade2 = 0
    # ?F?Ý’è?Bcolor1:ŠO˜g?Ccolor2:’†˜g
    # color3:‹óƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor4:‹óƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[
    # color5:ŽÀƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor6:ŽÀƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[
    color1 = Color.new(0, 0, 0, 192)
    color2 = Color.new(255, 255, 192, 192)
    color3 = Color.new(0, 0, 0, 192)
    color4 = Color.new(64, 0, 0, 192)
    color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
    color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
    # •Ï?”exp‚É•`‰æ‚·‚éƒQ?[ƒW‚Ì•?‚ð‘ã“ü
    if actor.next_exp != 0
    exp = (width + plus_width) * actor.now_exp * rate_width /
    100 / actor.next_exp
    else
    exp = (width + plus_width) * rate_width / 100
    end
    # ƒQ?[ƒW‚Ì•`‰æ
    gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
    width, plus_width + width * rate_width / 100,
    height, exp, align1, align2, align3,
    color1, color2, color3, color4, color5, color6, grade1, grade2)
    # ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æ?ˆ—?‚ðŒÄ‚Ñ?o‚µ
    draw_actor_exp_original(actor, x, y)
    end
    #--------------------------------------------------------------------------
    # ?œ ƒQ?[ƒW‚Ì•`‰æ
    #--------------------------------------------------------------------------
    def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
    color1, color2, color3, color4, color5, color6, grade1, grade2)
    case align1
    when 1
    x += (rect_width - width) / 2
    when 2
    x += rect_width - width
    end
    case align2
    when 1
    y -= height / 2
    when 2
    y -= height
    end
    # ˜g•`‰æ
    self.contents.fill_rect(x, y, width, height, color1)
    self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
    if align3 == 0
    if grade1 == 2
    grade1 = 3
    end
    if grade2 == 2
    grade2 = 3
    end
    end
    if (align3 == 1 and grade1 == 0) or grade1 > 0
    color = color3
    color3 = color4
    color4 = color
    end
    if (align3 == 1 and grade2 == 0) or grade2 > 0
    color = color5
    color5 = color6
    color6 = color
    end
    # ‹óƒQ?[ƒW‚Ì•`‰æ
    self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
    color3, color4, grade1)
    if align3 == 1
    x += width - gauge
    end
    # ŽÀƒQ?[ƒW‚Ì•`‰æ
    self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
    color5, color6, grade2)
    end
    end
    
    #------------------------------------------------------------------------------
    # ?@BitmapƒNƒ‰ƒX‚É?V‚½‚È‹@”\‚ð’ljÁ‚µ‚Ü‚·?B
    #==================
    
    class Bitmap
    #--------------------------------------------------------------------------
    # ?œ ‹éŒ`‚ðƒOƒ‰ƒf?[ƒVƒ‡ƒ“•\Ž¦
    # color1 : ƒXƒ^?[ƒgƒJƒ‰?[
    # color2 : ƒGƒ“ƒhƒJƒ‰?[
    # align : 0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“
    # 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“
    # 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“?iŒƒ?d‚ɂ‚«’?ˆÓ?j
    #--------------------------------------------------------------------------
    def gradation_rect(x, y, width, height, color1, color2, align = 0)
    if align == 0
    for i in x...x + width
    red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
    green = color1.green +
    (color2.green - color1.green) * (i - x) / (width - 1)
    blue = color1.blue +
    (color2.blue - color1.blue) * (i - x) / (width - 1)
    alpha = color1.alpha +
    (color2.alpha - color1.alpha) * (i - x) / (width - 1)
    color = Color.new(red, green, blue, alpha)
    fill_rect(i, y, 1, height, color)
    end
    elsif align == 1
    for i in y...y + height
    red = color1.red +
    (color2.red - color1.red) * (i - y) / (height - 1)
    green = color1.green +
    (color2.green - color1.green) * (i - y) / (height - 1)
    blue = color1.blue +
    (color2.blue - color1.blue) * (i - y) / (height - 1)
    alpha = color1.alpha +
    (color2.alpha - color1.alpha) * (i - y) / (height - 1)
    color = Color.new(red, green, blue, alpha)
    fill_rect(x, i, width, 1, color)
    end
    elsif align == 2
    for i in x...x + width
    for j in y...y + height
    red = color1.red + (color2.red - color1.red) *
    ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    green = color1.green + (color2.green - color1.green) *
    ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    blue = color1.blue + (color2.blue - color1.blue) *
    ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    alpha = color1.alpha + (color2.alpha - color1.alpha) *
    ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    color = Color.new(red, green, blue, alpha)
    set_pixel(i, j, color)
    end
    end
    elsif align == 3
    for i in x...x + width
    for j in y...y + height
    red = color1.red + (color2.red - color1.red) *
    ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    green = color1.green + (color2.green - color1.green) *
    ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    blue = color1.blue + (color2.blue - color1.blue) *
    ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    alpha = color1.alpha + (color2.alpha - color1.alpha) *
    ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
    color = Color.new(red, green, blue, alpha)
    set_pixel(i, j, color)
    end
    end
    end
    end
    end
    
    #===========================
    # ?¡ Spriteƒ‚ƒWƒ…?[ƒ‹
    #------------------------------------------------------------------------------
    # ?@ƒAƒjƒ??[ƒVƒ‡ƒ“‚ÌŠÇ—?‚ð?s‚¤ƒ‚ƒWƒ…?[ƒ‹‚Å‚·?B
    #============================
    module RPG
    class Sprite < ::Sprite
    def damage(value, critical)
    dispose_damage
    if value.is_a?(Numeric)
    damage_string = value.abs.to_s
    else
    damage_string = value.to_s
    end
    bitmap = Bitmap.new(160, 48)
    bitmap.font.name = "Arial Black"
    bitmap.font.size = 32
    bitmap.font.color.set(0, 0, 0)
    bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
    bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
    bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
    bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
    if value.is_a?(Numeric) and value < 0
    bitmap.font.color.set(176, 255, 144)
    else
    bitmap.font.color.set(255, 255, 255)
    end
    bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
    if critical
    bitmap.font.size = 20
    bitmap.font.color.set(0, 0, 0)
    bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
    bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
    bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
    bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
    bitmap.font.color.set(255, 255, 255)
    bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
    end
    @_damage_sprite = ::Sprite.new
    @_damage_sprite.bitmap = bitmap
    @_damage_sprite.ox = 80 + self.viewport.ox
    @_damage_sprite.oy = 20 + self.viewport.oy
    @_damage_sprite.x = self.x + self.viewport.rect.x
    @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
    @_damage_sprite.z = 3000
    @_damage_duration = 40
    end
    def animation(animation, hit)
    dispose_animation
    @_animation = animation
    return if @_animation == nil
    @_animation_hit = hit
    @_animation_duration = @_animation.frame_max
    animation_name = @_animation.animation_name
    animation_hue = @_animation.animation_hue
    bitmap = RPG::Cache.animation(animation_name, animation_hue)
    if @@_reference_count.include?(bitmap)
    @@_reference_count[bitmap] += 1
    else
    @@_reference_count[bitmap] = 1
    end
    @_animation_sprites = []
    if @_animation.position != 3 or not @@_animations.include?(animation)
    for i in 0..15
    sprite = ::Sprite.new
    sprite.bitmap = bitmap
    sprite.visible = false
    @_animation_sprites.push(sprite)
    end
    unless @@_animations.include?(animation)
    @@_animations.push(animation)
    end
    end
    update_animation
    end
    def loop_animation(animation)
    return if animation == @_loop_animation
    dispose_loop_animation
    @_loop_animation = animation
    return if @_loop_animation == nil
    @_loop_animation_index = 0
    animation_name = @_loop_animation.animation_name
    animation_hue = @_loop_animation.animation_hue
    bitmap = RPG::Cache.animation(animation_name, animation_hue)
    if @@_reference_count.include?(bitmap)
    @@_reference_count[bitmap] += 1
    else
    @@_reference_count[bitmap] = 1
    end
    @_loop_animation_sprites = []
    for i in 0..15
    sprite = ::Sprite.new
    sprite.bitmap = bitmap
    sprite.visible = false
    @_loop_animation_sprites.push(sprite)
    end
    update_loop_animation
    end
    def animation_set_sprites(sprites, cell_data, position)
    for i in 0..15
    sprite = sprites[i]
    pattern = cell_data[i, 0]
    if sprite == nil or pattern == nil or pattern == -1
    sprite.visible = false if sprite != nil
    next
    end
    sprite.visible = true
    sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
    if position == 3
    if self.viewport != nil
    sprite.x = self.viewport.rect.width / 2
    sprite.y = self.viewport.rect.height - 160
    else
    sprite.x = 320
    sprite.y = 240
    end
    else
    sprite.x = self.x + self.viewport.rect.x -
    self.ox + self.src_rect.width / 2
    sprite.y = self.y + self.viewport.rect.y -
    self.oy + self.src_rect.height / 2
    sprite.y -= self.src_rect.height / 4 if position == 0
    sprite.y += self.src_rect.height / 4 if position == 2
    end
    sprite.x += cell_data[i, 1]
    sprite.y += cell_data[i, 2]
    sprite.z = 2000
    sprite.ox = 96
    sprite.oy = 96
    sprite.zoom_x = cell_data[i, 3] / 100.0
    sprite.zoom_y = cell_data[i, 3] / 100.0
    sprite.angle = cell_data[i, 4]
    sprite.mirror = (cell_data[i, 5] == 1)
    sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
    sprite.blend_type = cell_data[i, 7]
    end
    end
    end
    end
    
    Đáp ứng nhu cầu anh Ken .Đây là screenhot đây
    Screenhot
    Screenhot
     
  2. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Chắc hẳn mấy bạn đã nghe nói và đã từng chơi qua game Đặt bomb của Window rồi chứ >Và giờ nó hoàn toàn có thể thực hiên trong rpg
    Đây là Screenhot
    Screenhot
    Screenhot
    Screenhot
    Đây là Demo
    DEMO
    Và đây là script (Chép bên trên phần Main)
    Mã:
    #==============================================================================
    # ** Minesweeper
    #==============================================================================
    # SephirothSpawn
    # Version 1
    # 2006-05-14
    #------------------------------------------------------------------------------
    # * Requires Near Fantastica's Keyboard & Mouse Module
    #------------------------------------------------------------------------------
    # * Requires  Icons in the Icon Folder (16 * 16)
    #
    #  Minesweeper Flag
    #  Minesweeper Tile - U
    #  Minesweeper Tile - S
    #  Minesweeper Mine - U
    #  Minesweeper Mine - S
    #------------------------------------------------------------------------------
    # * Instructions:
    #  
    #  ~ Calling Minesweeper Scene:
    #    $scene = Scene_Minesweeper.new
    #------------------------------------------------------------------------------
    # * Customization:
    #  
    #  ~ To Write Solution Files In Game Folder
    #    Write_Solution_File = true (On) or false (Off)
    #
    #  ~ To Enable Auto-Click Tiles with 0 Surrounding Mines
    #    Auto_Click_Zero_Tiles = true (On) or false (Off)
    #==============================================================================
    
    #------------------------------------------------------------------------------
    # * SDK Log Script
    #------------------------------------------------------------------------------
    SDK.log('Minesweeper', 'SephirothSpawn', 1, '2006-05-14')
    
    #------------------------------------------------------------------------------
    # * Begin SDK Enable Test
    #------------------------------------------------------------------------------
    if SDK.state('Minesweeper') == true
    
    #==============================================================================
    # ** MinesweeperBoard
    #==============================================================================
    
    class MinesweeperBoard
      #--------------------------------------------------------------------------
      # * Write Solution Text File
      #--------------------------------------------------------------------------
      Write_Solution_File = true
      Auto_Click_Zero_Tiles = true
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :width
      attr_accessor :height
      attr_accessor :mines
      attr_accessor :mine_locations
      attr_accessor :mine_numbers
      #--------------------------------------------------------------------------
      # * Object Initialization
      #  ~ width   : Board Width
      #  ~ height  : Board Height
      #  ~ mines   : Number Of Mines
      #--------------------------------------------------------------------------
      def initialize(width = 10, height = 10, mines = 10)
        # Set Board Dimensions
        @width = [[width, 10].max, 24].min
        @height = [[height, 10].max, 24].min
        # Set Mine Number
        @mines = [[mines, 10].max, (@width * @height / 2)].min
        # Sets Up Mine Locations
        @mine_locations = Table.new(@width, @height)
        placed_mines = 0
        while placed_mines < @mines
          x, y = rand(@width), rand(@height)
          if @mine_locations[x, y] == 0
            @mine_locations[x, y] = 1
            placed_mines += 1
          end
        end
        # Gets Mine Numbers
        @mine_numbers = Table.new(@width, @height)
        for i in 0...@width
          for j in 0...@height
            @mine_numbers[i, j] = get_mines_number(i, j)
          end
        end
        # Writes Solution file
        if Write_Solution_File
          file = File.open('Minesweeper Solution.txt', 'wb')
          file2 = File.open('Minesweeper Numbers.txt', 'wb')
          for i in 0...@width
            for j in 0...@height
              file.write("#{@mine_locations[i, j]}")
              if @mine_numbers[i, j] == -1
                file2.write('X')
              else
                file2.write("#{@mine_numbers[i, j]}")
              end
            end
            file.write('\n')
            file2.write('\n')
          end
          file.close
          file2.close
        end
      end
      #--------------------------------------------------------------------------
      # * Get Number
      #  ~ x : X Location
      #  ~ y : Y Location
      #--------------------------------------------------------------------------
      def get_mines_number(x, y)
        # If Mine
        if @mine_locations[x, y] == 1
          return -1
        end
        # If No Mine Present
        mines = 0
        # Checks Surrounding Locations
        # Left
        if x > 0
          mines += 1 if @mine_locations[x - 1, y] == 1
        end
        # Right
        if x < @width - 1
          mines += 1 if @mine_locations[x + 1, y] == 1
        end
        # Down
        if y > 0
          mines += 1 if @mine_locations[x, y - 1] == 1
        end
        # Up
        if y < @height - 1
          mines += 1 if @mine_locations[x, y + 1] == 1
        end
        # Down Left
        if x > 0 && y > 0
          mines += 1 if @mine_locations[x - 1, y - 1] == 1
        end
        # Down Right
        if x < @width - 1 && y > 0
          mines += 1 if @mine_locations[x + 1, y - 1] == 1
        end
        # Up Left
        if x > 0 && y < @height - 1
          mines += 1 if @mine_locations[x - 1, y + 1] == 1
        end
        # Up Right
        if x < @width - 1 && y < @height - 1
          mines += 1 if @mine_locations[x + 1, y + 1] == 1
        end
        return mines
      end
    end
    
    #==============================================================================
    # ** Window_MinesweeperBoard
    #==============================================================================
    
    class Window_MinesweeperBoard < Window_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader :board
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(224, 64, 416, 416)
      end
      #--------------------------------------------------------------------------
      # * Score
      #--------------------------------------------------------------------------
      def score
        return board.mines * 100 / (board.width * board.height)
      end
      #--------------------------------------------------------------------------
      # * Reset Board
      #--------------------------------------------------------------------------
      def reset_board(board)
        # Dispose Contents
        unless self.contents.nil?
          self.contents.dispose
        end
        # Store Board
        @board = board
        # Return if No Board
        return if board.nil?
        # Setup Board Info    
        self.contents = Bitmap.new(board.width * 16, board.height * 16)
        self.contents.font.size = 16
        self.contents.font.bold = true
        self.ox = -(192 - self.contents.width / 2)
        self.oy = -(192 - self.contents.height / 2)
        @selected_tiles = Table.new(board.width, board.height)
        @flagged_tiles = Table.new(board.width, board.height)
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        for i in 0...@board.width
          for j in 0...@board.height
            draw_tile(i, j)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Tile
      #--------------------------------------------------------------------------
      def draw_tile(x, y)
        # Gets Tile Number
        tile_number = @board.mine_numbers[x, y]
        # If Tile Flagged
        if @flagged_tiles[x, y] == 1
          bitmap = RPG::Cache.icon('Minesweeper Flag')
          self.contents.blt(x * 16, y * 16, bitmap, Rect.new(0, 0, 16, 16))
          return
        end
        # If Mine
        if tile_number == -1 && lost?
          # Icon Name
          icon_name = 'Minesweeper Mine - '
          # Suffix
          icon_name += @selected_tiles[x, y] == 1 ? 'S' : 'U'
          bitmap = RPG::Cache.icon(icon_name)
          self.contents.blt(x * 16, y * 16, bitmap, Rect.new(0, 0, 16, 16))
          return
        end
        # If Tile Selected
        if @selected_tiles[x, y] == 1
          # Draws Tile
          bitmap = RPG::Cache.icon('Minesweeper Tile - S')
          self.contents.blt(x * 16, y * 16, bitmap, Rect.new(0, 0, 16, 16))
          # Gets Font Color
          self.contents.font.color = Color.new(255 / 9 * tile_number, 0, 0, 255)
          # Draws Number
          if tile_number > 0 && 
            self.contents.draw_text(x * 16, y * 16, 16, 16, tile_number.to_s, 1)
          end
        # Not Selected
        else
          # Draws Tile
          bitmap = RPG::Cache.icon('Minesweeper Tile - U')
          self.contents.blt(x * 16, y * 16, bitmap, Rect.new(0, 0, 16, 16))
        end
      end
      #--------------------------------------------------------------------------
      # * Select Tile
      #  ~ x : X Location
      #  ~ y : Y Location
      #--------------------------------------------------------------------------
      def select_tile(x = 0, y = 0)
        # If Tile already Selected
        return if @selected_tiles[x, y] == 1
        # If Tile flagged
        return if @flagged_tiles[x, y] == 1
        # Records Clicked Location
        @selected_tiles[x, y] = 1
        # Checks If Mine Is There
        if @board.mine_locations[x, y] == 0
          # Gets Mine Number
          mines = @board.mine_numbers[x, y]
          # If AutoClick Mines
          if MinesweeperBoard::Auto_Click_Zero_Tiles
            # If No Mines Around, click surrounding tiles
            if mines == 0
              select_tile(x - 1, y) if x > 0
              select_tile(x + 1, y) if x < @board.width - 1
              select_tile(x, y - 1) if y > 0
              select_tile(x, y + 1) if y < @board.height - 1
              select_tile(x - 1, y - 1) if x > 0 && y > 0
              select_tile(x + 1, y - 1) if x < @board.width - 1 && y > 0
              select_tile(x - 1, y + 1) if x > 0 && y < @board.height - 1
              select_tile(x + 1, y + 1) if x < @board.width - 1 && y < @board.height - 1
            end
          end
        # Draws Lost
        else
          refresh
        end
        # Redraw Tile
        draw_tile(x, y)
      end
      #--------------------------------------------------------------------------
      # * Flag Tile
      #--------------------------------------------------------------------------
      def flag_tile(x = 0, y = 0)
        # If Tile already Selected
        return if @selected_tiles[x, y] == 1
        # Toggle Flag
        @flagged_tiles[x, y] = @flagged_tiles[x, y] == 0 ? 1 : 0
        # Redraw Tile
        draw_tile(x, y)
      end
      #--------------------------------------------------------------------------
      # * Won?
      #--------------------------------------------------------------------------
      def won?
        return false if lost?
        for i in 0...@board.width
          for j in 0...@board.height
            if @board.mine_locations[i, j] == 0
              if @selected_tiles[i, j] == 0
                return false
              end
            end
          end
        end
        return true
      end
      #--------------------------------------------------------------------------
      # * Lost?
      #--------------------------------------------------------------------------
      def lost?
        for i in 0...@board.width
          for j in 0...@board.height
            if @selected_tiles[i, j] == 1
              if @board.mine_numbers[i, j] == -1
                return true
              end
            end
          end
        end
        return false
      end
    end
    
    #==============================================================================
    # ** Window_MinesweeperOptions
    #==============================================================================
    
    class Window_MinesweeperOptions < Window_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader :board_width
      attr_reader :board_height
      attr_reader :board_mines
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 224, 224, 256)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.active = false
        @board_width = 10
        @board_height = 10
        @board_mines = 10
        refresh
        @index = 0
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        # Text
        @left_text = ['Width', 'Height', 'Mines'].collect! {|x| "Board #{x} :"}
        @right_text = [@board_width, @board_height, @board_mines]
        # Draws Left Text
        self.contents.font.color = system_color
        for i in 0..2
          self.contents.draw_text(4, i * 32, 192, 32, @left_text[i])
        end
        # Draws Right Text
        self.contents.font.color = normal_color
        for i in 0..2
          self.contents.draw_text(- 4, i * 32, 192, 32, @right_text[i].to_s, 2)
        end
        # Draws Maxes
        max = @board_width * @board_height / 2
        self.contents.font.color = system_color
        self.contents.draw_text(0, 96, 192, 32, 'Width : 10 to 24', 1)
        self.contents.draw_text(0, 128, 192, 32, 'Height : 10 to 24', 1)
        self.contents.draw_text(0, 160, 192, 32, "Mines : 10 to #{max}", 1)
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        # Update Cursor Rect
        update_cursor_rect
        # If Active
        if self.active
          # Mine Max
          max = @board_width * @board_height / 2
          # Last Values
          last_w = @board_width
          last_h = @board_height
          last_m = @board_mines
          # If Up is Pressed
          if Input.repeat?(Input::UP)
            # Play cursor SE
            $game_system.se_play($data_system.cursor_se)
            @index == 0 ? @index = 2 : @index -= 1
          # If Down is Pressed
          elsif Input.repeat?(Input::DOWN)
            # Play cursor SE
            $game_system.se_play($data_system.cursor_se)
            @index == 2 ? @index = 0 : @index += 1
          # If Left is Pressed
          elsif Input.repeat?(Input::LEFT)
            # Branch By Index
            case @index
            when 0 ; @board_width -= 1 if @board_width > 10
            when 1 ; @board_height -= 1 if @board_height > 10
            when 2 ; @board_mines -= 1 if @board_mines > 10
            end
          # If Right is Pressed
          elsif Input.repeat?(Input::RIGHT)
            # Branch By Index
            case @index
            when 0 ; @board_width += 1 if @board_width < 24
            when 1 ; @board_height += 1 if @board_height < 24
            when 2 ; @board_mines += 1 if @board_mines < max
            end
          end
          # If Change Occured
          unless last_w == @board_width && last_h == @board_height &&
            last_m == @board_mines
            # Play cursor SE
            $game_system.se_play($data_system.cursor_se)
            # Update Mine Max
            max = @board_width * @board_height / 2
            @board_mines = [@board_mines, max].min
            # Refresh Window
            refresh
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Cursor Rectangle Update
      #--------------------------------------------------------------------------
      def update_cursor_rect
        if @index < 0 || !self.active
          self.cursor_rect.empty
        else
          self.cursor_rect.set(0, @index * 32, contents.width, 32)
        end
      end
    end
    
    #==============================================================================
    # ** Window_MinesweeperScores
    #==============================================================================
    
    class Window_MinesweeperScores < Window_Base
      #--------------------------------------------------------------------------
      # * Highscores
      #--------------------------------------------------------------------------
      @@highscores = [ ['SephirothSpawn', 20],
                       ['SephirothSpawn', 15],
                       ['SephirothSpawn', 10],
                       ['SephirothSpawn', 5] ]
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 224, 224, 256)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.visible = false
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.contents.font.color = system_color
        self.contents.draw_text(0, 0, 196, 32, 'High Scores List', 1)
        self.contents.font.color = normal_color
        for i in 0..3
          self.contents.draw_text(4, 32 * i + 32, 188, 32, @@highscores[i][0])
          self.contents.draw_text(- 4, 32 * i + 32, 188, 32, @@highscores[i][1].to_s, 2)
        end
        self.contents.font.color = system_color
        self.contents.draw_text(4, 176, 188, 32, 'Score =')
        self.contents.draw_text(72, 160, 120, 32, 'Mines * 100', 1)
        self.contents.draw_text(72, 192, 120, 32, 'Board Aread', 1)
        self.contents.fill_rect(72, 192, 120, 1, normal_color)
      end
      #--------------------------------------------------------------------------
      # * Set High Score
      #--------------------------------------------------------------------------
      def set_high_score(score = 0)
        for i in 0..3
          if score > @@highscores[i][1]
            @@highscores.insert(i, [$game_party.actors[0].name, score])
            refresh
            return i
          end
        end
        return nil
      end
    end
    
    #==============================================================================
    # ** Scene_Minesweeper
    #==============================================================================
    
    class Scene_Minesweeper
      #--------------------------------------------------------------------------
      # * Main Processing
      #--------------------------------------------------------------------------
      def main
        # Creates Help Window
        @help_window = Window_Help.new
        # Creates Command Window
        @commands = ['Start Game', 'End Game', 'Options', 'View High Scores']
        @command_window = Window_Command.new(224, @commands)
        @command_window.y = 64
        # Creates Options Window
        @options_window = Window_MinesweeperOptions.new
        # Creates High Scores Window
        @highscores_window = Window_MinesweeperScores.new
        # Creates Minesweeper Board
        @minesweeper_board = Window_MinesweeperBoard.new
        # Update Help Window
        update_help_window
        # Scene Objects
        @scene_objects = [@help_window, @command_window, @options_window,
          @highscores_window, @minesweeper_board]
        # Execute transition
        Graphics.transition
        # Main loop
        while $scene == self
          # Update game screen
          Graphics.update
          # Update input information
          Input.update
          # Update Keyboard information
          Keyboard.update
          # Update Mouse information
          Mouse.update
          # Update Scene Objects
          @scene_objects.each {|x| x.update}
          # Frame update
          update
        end
        # Prepare for transition
        Graphics.freeze
        # Dispose Scene Objects
        @scene_objects.each {|x| x.dispose}
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        # If Up or Down Is Pressed
        if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)
          update_help_window
        end
        # If Main Command Active
        if @command_window.active
          update_command_window
        # If Options Window Active
        elsif @options_window.active
          update_options_window
        end
        # Unless No Game Started Yet
        unless @minesweeper_board.board.nil?
          update_board_selection
        end
      end
      #--------------------------------------------------------------------------
      # * Frame Update : Main Command
      #--------------------------------------------------------------------------
      def update_command_window
        # If B Button Pressed
        if Input.trigger?(Input::B)
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          # Reset Board
          @minesweeper_board.reset_board(nil)
          # Return to Map
          $scene = Scene_Map.new
        end
        # If C Button Pressed
        if Input.trigger?(Input::C)
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Branch By Index
          case @command_window.index
          when 0 # Start Game
            # Creates Random Board
            w = @options_window.board_width
            h = @options_window.board_height
            m = @options_window.board_mines
            board = MinesweeperBoard.new(w, h, m)
            @minesweeper_board.reset_board(board)
            # Turns Off Options Window
            @options_window.visible = false
            # Turns On Hish Scores Window
            @highscores_window.visible = true
            # Set Help Text
            @help_window.set_text('Use the Mouse to Select Board Tiles', 1)
          when 1 # End Game
            # Reset Board
            @minesweeper_board.reset_board(nil)
            # Set Help Text
            @help_window.set_text('You Quit your current Game', 1)
          when 2 # Options
            # Turns Off Main Command
            @command_window.active = false
            # Turns Off Hish Scores Window
            @highscores_window.visible = false
            # Turns On Options Window
            @options_window.visible = true
            @options_window.active = true
            # Update Help Text
            update_help_window
          when 3 # View High Scores
            # Turns Off Options Window
            @options_window.visible = false
            # Turns On Hish Scores Window
            @highscores_window.visible = true
            # Set Help Text
            @help_window.set_text('Viewing High Scores', 1)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Frame Update : Options
      #--------------------------------------------------------------------------
      def update_options_window
        # If B or C Button Pressed
        if Input.trigger?(Input::B) || Input.trigger?(Input::C)
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Turns Off Main Command
          @command_window.active = true
          # Turns On Options Window
          @options_window.active = false
          # Update Help Text
          update_help_window
        end
      end
      #--------------------------------------------------------------------------
      # * Frame Update : Board Selection
      #--------------------------------------------------------------------------
      def update_board_selection
        # If Left Click (Select Tile)
        if Keyboard.trigger?(Keyboard::Mouse_Left)
          # Gets X & Y
          x = (Mouse.position[0] - 224 + @minesweeper_board.ox) /16
          y = (Mouse.position[1] - 64 + @minesweeper_board.oy) / 16
          # Gets Max X and Max Y
          max_x = @minesweeper_board.board.width + 1
          max_y = @minesweeper_board.board.height + 1
          # Selects Locations
          if x > 0 && y > 0 && x < max_x && y < max_y
            @minesweeper_board.select_tile(x - 1, y - 1)
            # Check for Win
            if @minesweeper_board.won?
              set_high_score
            end
            # If Lost
            if @minesweeper_board.lost?
              @help_window.set_text('Sorry, You Lost', 1)
            end
          end
        end
        # If Right Click (Flag Tile)
        if Keyboard.trigger?(Keyboard::Mouse_Right)
          # Gets X & Y
          x = (Mouse.position[0] - 224 + @minesweeper_board.ox) /16
          y = (Mouse.position[1] - 64 + @minesweeper_board.oy) / 16
          # Gets Max X and Max Y
          max_x = @minesweeper_board.board.width + 1
          max_y = @minesweeper_board.board.height + 1
          # Selects Locations
          if x > 0 && y > 0 && x < max_x && y < max_y
            @minesweeper_board.flag_tile(x - 1, y - 1)
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Update Help Window
      #--------------------------------------------------------------------------
      def update_help_window
        # If Main Command Active
        if @command_window.active
          # Branch By Index
          case @command_window.index
          when 0 ; text = 'Select to Start a New Game'
          when 1 ; text = 'Select to End Current Game'
          when 2 ; text = 'Select to Change Options'
          when 3 ; text = 'Select to View High Scores'
          end
        # If Options Window Active
        elsif @options_window.active
          text = 'Use Right & Left to Scroll Board Options'
        end
        # Set Help Text
        @help_window.set_text(text, 1)
      end
      #--------------------------------------------------------------------------
      # * Set High Score
      #--------------------------------------------------------------------------
      def set_high_score
        score = @highscores_window.set_high_score(@minesweeper_board.score)
        if score.nil?
          @help_window.set_text('You Won, But You Did Not Score Well Enough to Place', 1)
        else
          case score
          when 0 ; score = '1st'
          when 1 ; score = '2nd'
          when 2 ; score = '3rd'
          when 3 ; score = '4th'
          end
          @help_window.set_text("You Won and took #{score} Place!", 1)
        end
      end
    end
    
    #------------------------------------------------------------------------------
    # * End SDK Enable Test
    #------------------------------------------------------------------------------
    end
    
    Kích hoạt trò này bằng cách đánh vào script trong event :$scene = Scene_Minesweeper.new
    #Lưu ý:Đây không phải là bài của ngộ đâu àh nghen#
     
  3. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    1-Scene Custom Menu System :UPDATE 1.17

    Đây là Menu đẹp nhất từ trước đến nay mà ngộ từng nhìn thấy (Cái này không nên kết hợp với cái HP+MP+EXP nếu không thì sẽ có chuyện đó)
    Đầu tiên là Screenhot
    Screenhot
    Screenhot
    Screenhot
    [urlhttp://serv4.imagehigh.com/imgs//9344_CMS04.png]Screenhot[/url]
    Và cái này là phần quan trọng nhất chép bên trên cái main đó nghen:
    Mã:
    #=============================================================
    # 1-Scene Custom Menu System
    #=============================================================
    # LegACy  
    # Version 1.17b
    # 7.29.06
    #=============================================================
    # This script is a further development of Hydrolic's CMS 
    # request. I enhance it toward every aspect of a menu system
    # so now it all operates in one scene full of animation.
    # There's an animated sprite and element wheel features.
    # There's also different category for items implemented.
    # Now there's enhanced equipment features as well as faceset
    # features. Don't forget the icon command feature, too!
    # The newest version now has an integrated party swapper!
    #
    # To put items into different catagory, simply apply 
    # attributes to them, you can apply more than 1 attributes
    # to each item. In default, the attributes are :
    # :: 17 > Recovery items
    # :: 18 > Weaponry
    # :: 19 > Armor
    # :: 20 > Accessories
    # :: 21 > Key Items
    # :: 22 > Miscellanous Items
    #
    # Faceset pictures should be 'Potrait_', or 'Class_' if you based it
    # on actor's class, followed with the ID of the actor. So for Arshes
    # it will either 'Potrait_1' or 'Class_1'
    #
    # For customization, look in LegACy class, further explanation's
    # located there.
    #
    # Special thanks to Hydrolic for the idea, Diego for the
    # element wheel, SephirotSpawn for sprite animation, KGC
    # for the his AlterEquip script and Squall for his ASM.
    #=============================================================
    
      #==============================================================================
      # ** LegACy's Script Customization (CMS)
      #==============================================================================
      class LegACy
        #--------------------------------------------------------------------------
        # * Custom Scripts Support
        #--------------------------------------------------------------------------
        AMS             = false                       # True if you're using AMS script.
        ATS             = false                       # True if you're using ATS script.
        ABS             = false                       # True if you're using Near's ABS script.
        PREXUS          = false                       # True if you're using Prexus' ABS script.
        #--------------------------------------------------------------------------
        # * Features Customization Constants
        #--------------------------------------------------------------------------
        ANIMATED        = false                       # True if you want to have animated chara feature.
        ITEM_GROUPING   = true                        # True if you want to use item grouping feature.
        EXTRA_EQUIP     = true                        # True if you want to use Enhanced Equipment feature.
        PARTY_SWAP      = true                        # True if you want to use Party Swapper feature.
        BATTLE_BAR      = true                        # True if you want to have bar for battle system.
        ICON            = true                        # True if you want to have icon on command_window.
        MAX_PARTY       = 4                           # Number of max member in the party.
        SAVE_NUMBER     = 99                          # Number of save slot available
        #--------------------------------------------------------------------------
        # * Grouping Customization Constants
        #--------------------------------------------------------------------------
        ITEM_GROUPS     = ['Recov.', 'Weapon',        # Group names for items.
                          'Armor', 'Accessory',
                          'Quest', 'Misc.']
        ITEMS           = [17, 19, 21, 18, 20, 22]    # Attributes ID for Item Catagory in order.
        #--------------------------------------------------------------------------
        # * Display Customization Constants
        #--------------------------------------------------------------------------
        WIN_OPACITY     = 200                         # Opacity of CMS' windows
        WIN_Z           = 201                         # Z value of CMS' windows
        ICON_NAME       = ['menu', 'item'] 		  # Image name for icon, for main menu, for item command and lastly for skill grouping.
        POTRAIT         = [false, false]              # True if you want to use faceset instead of charset display, first is for front menu while the second is for status window.
        CLASS_POTRAIT   = [false, false]              # True if you want to base the faceset on class instead of actor, first is for front menu while the second is for status window.
        POTRAIT_DIR     = 'Potrait_'                  # Image name for actor-based faceset.
        CLASS_DIR       = 'Class_'                    # Image name for class-based faceset.
        STAT_BAR        = [false, false, true]        # Windows where the stat bar appears.
        BAR_COLOR       = [Color.new(255, 0, 0, 200), # Color for bars.
                          Color.new(255, 255, 0, 200),
                          Color.new(0, 255, 255, 200),
                          Color.new(200, 64, 64, 255),
                          Color.new(64, 128, 64, 255),           
                          Color.new(160, 100, 160, 255),
                          Color.new(128, 128, 200, 255)]
        #--------------------------------------------------------------------------
        # * Element Wheel Customization Constants
        #--------------------------------------------------------------------------
        ELEMENT_NUMBER  = 8                          # Number of elements applied in the element wheel.
        ELEMENTS        = [1, 2, 3, 4, 5, 6, 7, 8]   # Elements that appear on the element wheel, in order.
      end
      
      #==============================================================================
      # ** Bitmap
      #==============================================================================
      class Bitmap
        def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
          distance = (start_x - end_x).abs + (start_y - end_y).abs
          if end_color == start_color
            for i in 1..distance
              x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
              y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
              if width == 1
                self.set_pixel(x, y, start_color) 
               else
                self.fill_rect(x, y, width, width, start_color) 
              end
            end
          else
            for i in 1..distance
              x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
              y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
              r = start_color.red   * (distance-i)/distance + end_color.red   * i/distance
              g = start_color.green * (distance-i)/distance + end_color.green * i/distance
              b = start_color.blue  * (distance-i)/distance + end_color.blue  * i/distance
              a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
              if width == 1
                self.set_pixel(x, y, Color.new(r, g, b, a))
              else
                self.fill_rect(x, y, width, width, Color.new(r, g, b, a)) 
              end
            end
          end
        end
      end
    
      #==============================================================================
      # ** Game_Actor
      #------------------------------------------------------------------------------
      #  This class handles the actor. It's used within the Game_Actors class
      #  ($game_actors) and refers to the Game_Party class ($game_party).
      #==============================================================================
      class Game_Actor < Game_Battler
        #--------------------------------------------------------------------------
        # * Get Current Experience Points
        #--------------------------------------------------------------------------
        def now_exp 
          return @exp - @exp_list[@level] 
        end
        #--------------------------------------------------------------------------
        # * Get Needed Experience Points
        #--------------------------------------------------------------------------
        def next_exp 
          return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 
        end
      end  
      
      #==============================================================================
      # ** Game_Party
      #------------------------------------------------------------------------------
      #  This class handles the party. It includes information on amount of gold 
      #  and items. Refer to "$game_party" for the instance of this class.
      #==============================================================================
      class Game_Party
        #--------------------------------------------------------------------------
        # * Public Instance Variables
        #--------------------------------------------------------------------------
        attr_accessor   :reserve                   # reserve actors
         #--------------------------------------------------------------------------
        # * Alias Initialization
        #--------------------------------------------------------------------------
        alias legacy_CMS_gameparty_init initialize
         #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          # Create reserve actor array
          @reserve = []
          legacy_CMS_gameparty_init
        end
        #--------------------------------------------------------------------------
        # * Add an Actor
        #     actor_id : actor ID
        #--------------------------------------------------------------------------
        def add_actor(actor_id)
          # Get actor
          actor = $game_actors[actor_id]
          # If the party has less than 4 members and this actor is not in the party
          if @actors.size < LegACy::MAX_PARTY and not @actors.include?(actor)
            # Add actor
            @actors.push(actor)
          else
            @reserve.push(actor)
          end
          # Refresh player
          $game_player.refresh
        end
        #--------------------------------------------------------------------------
        # * Remove Actor
        #     actor_id : actor ID
        #--------------------------------------------------------------------------
        def remove_actor(actor_id)
          # Get actor
          actor = $game_actors[actor_id]
          # Delete actor
          @actors.delete(actor) if @actors.include?(actor)
          @reserve.delete(actor) if @reserve.include?(actor)
          # Refresh player
          $game_player.refresh
        end   
        
      end
      
      #==============================================================================
      # ** Game_Map
      #------------------------------------------------------------------------------
      #  This class handles the map. It includes scrolling and passable determining
      #  functions. Refer to "$game_map" for the instance of this class.
      #==============================================================================
      class Game_Map
        #--------------------------------------------------------------------------
        # * Get Map Name
        #--------------------------------------------------------------------------
        def name
           load_data("Data/MapInfos.rxdata")[@map_id].name
        end  
      end  
      
      #==============================================================================
      # ** Window_Base
      #------------------------------------------------------------------------------
      #  This class is for all in-game windows.
      #==============================================================================
      class Window_Base < Window
        FONT_SIZE          = 16 
        GRAPH_SCALINE_COLOR        = Color.new(255, 255, 255, 128)
        GRAPH_SCALINE_COLOR_SHADOW = Color.new(  0,   0,   0, 192) 
        GRAPH_LINE_COLOR           = Color.new(255, 255,  64, 255)
        GRAPH_LINE_COLOR_MINUS     = Color.new( 64, 255, 255, 255) 
        GRAPH_LINE_COLOR_PLUS      = Color.new(255,  64,  64, 255)    
        
        def draw_actor_element_radar_graph(actor, x, y, radius = 43)      
          cx = x + radius + FONT_SIZE + 48
          cy = y + radius + FONT_SIZE + 32
          for loop_i in 0..LegACy::ELEMENT_NUMBER
            if loop_i != 0
            @pre_x  = @now_x
            @pre_y  = @now_y
            @pre_ex = @now_ex
            @pre_ey = @now_ey
            @color1 = @color2
          end
          if loop_i == LegACy::ELEMENT_NUMBER
            eo = LegACy::ELEMENTS[0]
          else
            eo = LegACy::ELEMENTS[loop_i]
          end
          er = actor.element_rate(eo) 
          estr = $data_system.elements[eo] 
          @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
          er = er.abs
          th = Math::PI * (0.5 - 2.0 * loop_i / LegACy::ELEMENT_NUMBER)
          @now_x  = cx + (radius * Math.cos(th)).floor
          @now_y  = cy - (radius * Math.sin(th)).floor
          @now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
          @now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
          @now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
           @now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
           @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
           @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
           if loop_i == 0
             @pre_x  = @now_x
             @pre_y  = @now_y
             @pre_ex = @now_ex
             @pre_ey = @now_ey
             @color1 = @color2
           else       
           end
           next if loop_i == 0
           self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
           self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
           self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
           self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
           self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
           self.contents.font.color = system_color
           self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
           self.contents.font.color = Color.new(255,255,255,128)
           self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
           self.contents.font.color = normal_color
         end
       end
        #--------------------------------------------------------------------------
        # Draw Stat Bar
        #     actor  : actor
        #     x      : bar x-coordinate
        #     y      : bar y-coordinate
        #     stat   : stat to be displayed
        #--------------------------------------------------------------------------
        def draw_LegACy_bar(actor, x, y, stat, width = 156, height = 7)
          bar_color = Color.new(0, 0, 0, 255)
          end_color = Color.new(255, 255, 255, 255)
          max = 999
          case stat
          when "hp"
            bar_color = Color.new(150, 0, 0, 255)
            end_color = Color.new(255, 255, 60, 255)
            min = actor.hp
            max = actor.maxhp
          when "sp"
            bar_color = Color.new(0, 0, 155, 255)
            end_color = Color.new(255, 255, 255, 255)
            min = actor.sp
            max = actor.maxsp
          when "exp"
            bar_color = Color.new(0, 155, 0, 255)
            end_color = Color.new(255, 255, 255, 255)
            unless actor.level == $data_actors[actor.id].final_level
              min = actor.now_exp
              max = actor.next_exp
            else
              min = 1
              max = 1
            end  
          when 'atk'
            bar_color = LegACy::BAR_COLOR[0]
            min = actor.atk
          when 'pdef'
            bar_color = LegACy::BAR_COLOR[1]
            min = actor.pdef
          when 'mdef'
            bar_color = LegACy::BAR_COLOR[2]
            min = actor.mdef
          when 'str'
            bar_color = LegACy::BAR_COLOR[3]
            min = actor.str
          when 'dex'
            bar_color = LegACy::BAR_COLOR[4]
            min = actor.dex
          when 'agi'
            bar_color = LegACy::BAR_COLOR[5]
            min = actor.agi
          when 'int'
            bar_color = LegACy::BAR_COLOR[6]
            min = actor.int
          end
          max = 1 if max == 0
          # Draw Border
          for i in 0..height
            self.contents.fill_rect(x + i, y + height - i, width + 1, 1,
            Color.new(50, 50, 50, 255))
          end
          # Draw Background
          for i in 1..(height - 1)
            r = 100 * (height - i) / height + 0 * i / height
            g = 100 * (height - i) / height + 0 * i / height
            b = 100 * (height - i) / height + 0 * i / height
            a = 255 * (height - i) / height + 255 * i / height
            self.contents.fill_rect(x + i, y + height - i, width, 1,
            Color.new(r, b, g, a))
          end
          # Draws Bar
          for i in 1..( (min.to_f / max.to_f) * width - 1)
            for j in 1..(height - 1)
              r = bar_color.red * (width - i) / width + end_color.red * i / width
              g = bar_color.green * (width - i) / width + end_color.green * i / width
              b = bar_color.blue * (width - i) / width + end_color.blue * i / width
              a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
              self.contents.fill_rect(x + i + j, y + height - j, 1, 1,
              Color.new(r, g, b, a))
            end
          end
          case stat
          when "hp"
            draw_actor_hp(actor, x - 1, y - 18)
          when "sp"
            draw_actor_sp(actor, x - 1, y - 18)
          when "exp" 
            draw_actor_exp(actor, x - 1, y - 18)
          end
        end
        #--------------------------------------------------------------------------
        # * Draw Sprite
        #--------------------------------------------------------------------------
        def draw_LegACy_sprite(x, y, name, hue, frame)
          bitmap = RPG::Cache.character(name, hue)
          cw = bitmap.width / 4
          ch = bitmap.height / 4
          # Current Animation Slide
          case frame
            when 0 ;b = 0
            when 1 ;b = cw
            when 2 ;b = cw * 2
            when 3 ;b = cw * 3
          end
          # Bitmap Rectange
          src_rect = Rect.new(b, 0, cw, ch)
          # Draws Bitmap      
          self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
        end
        #--------------------------------------------------------------------------
        # * Get Upgrade Text Color
        #--------------------------------------------------------------------------
        def up_color
          return Color.new(74, 210, 74)
        end
        #--------------------------------------------------------------------------
        # * Get Downgrade Text Color
        #--------------------------------------------------------------------------
        def down_color
          return Color.new(170, 170, 170)
        end
        #--------------------------------------------------------------------------
        # * Draw Potrait
        #     actor : actor
        #     x     : draw spot x-coordinate
        #     y     : draw spot y-coordinate
        #--------------------------------------------------------------------------
        def draw_actor_potrait(actor, x, y, classpotrait = false, width = 96, height = 96)
          classpotrait ? bitmap = RPG::Cache.picture(LegACy::CLASS_DIR + actor.class_id.to_s) : 
            bitmap = RPG::Cache.picture(LegACy::POTRAIT_DIR + actor.id.to_s)
          src_rect = Rect.new(0, 0, width, height)
          self.contents.blt(x, y, bitmap, src_rect)
        end
        #--------------------------------------------------------------------------
        # * Draw parameter
        #     actor : actor
        #     x     : draw spot x-coordinate
        #     y     : draw spot y-coordinate
        #     type  : parameter type
        #------------------------------------------------------------------------
        def draw_actor_parameter(actor, x, y, type, width = 120, bar = false)
          case type
          when 0
            parameter_name = $data_system.words.atk
            parameter_value = actor.atk
            stat = 'atk'
          when 1
            parameter_name = $data_system.words.pdef
            parameter_value = actor.pdef
            stat = 'pdef'
          when 2
            parameter_name = $data_system.words.mdef
            parameter_value = actor.mdef
            stat = 'mdef'
          when 3
            parameter_name = $data_system.words.str
            parameter_value = actor.str
            stat = 'str'
          when 4
            parameter_name = $data_system.words.dex
            parameter_value = actor.dex
            stat = 'dex'
          when 5
            parameter_name = $data_system.words.agi
            parameter_value = actor.agi
            stat = 'agi'
          when 6
            parameter_name = $data_system.words.int
            parameter_value = actor.int
            stat = 'int'
          when 7 
            parameter_name = "Evasion" 
            parameter_value = actor.eva 
            stat = 'eva'
          end 
          if bar == true && stat != 'eva'
            draw_LegACy_bar(actor, x + 16, y + 17, stat, width - 16, 5)
          end
          self.contents.font.color = system_color 
          self.contents.draw_text(x, y, 120, 32, parameter_name) 
          self.contents.font.color = normal_color 
          self.contents.draw_text(x + width, y, 36, 32, parameter_value.to_s, 2) 
        end
      end
      
      #==============================================================================
      # ** Window_NewCommand
      #------------------------------------------------------------------------------
      #  This window deals with general command choices.
      #==============================================================================
    
      class Window_NewCommand < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     width    : window width
        #     commands : command text string array
        #--------------------------------------------------------------------------
        def initialize(width, commands, icon = nil)
          # Compute window height from command quantity
          super(0, 0, width, 96)
          @item_max = commands.size
          @commands = commands
          @icon = icon
          @column_max = @item_max / 2
          self.contents = Bitmap.new(width - 32, height - 32)
          refresh
          self.index = 0
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          for i in 0...@item_max
            draw_item(i, normal_color)
          end
        end
        #--------------------------------------------------------------------------
        # * Draw Item
        #     index : item number
        #     color : text color
        #--------------------------------------------------------------------------
        def draw_item(index, color)
          self.contents.font.color = color
          self.contents.font.size = 20
          self.contents.font.bold = true
          rect = Rect.new((109 * (index / 2)), 32 * (index % 2), self.width / @column_max - 12, 32)
          self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
          unless @icon == nil
            bitmap = RPG::Cache.icon(@icon + index.to_s)
            self.contents.blt((106 * (index / 2)), 32 * (index % 2) + 4, bitmap, Rect.new(0, 0, 30, 30))
          end      
          self.contents.draw_text(rect, @commands[index])
        end
        #--------------------------------------------------------------------------
        # * Disable Item
        #     index : item number
        #--------------------------------------------------------------------------
        def disable_item(index)
          draw_item(index, disabled_color)
        end
        #--------------------------------------------------------------------------
        # * Update Cursor Rectangle
        #--------------------------------------------------------------------------
        def update_cursor_rect
          # If cursor position is less than 0
          if @index < 0
            self.cursor_rect.empty
            return
          end
          # Get current row
          row = @index / @column_max
          # If current row is before top row
          if row < self.top_row
            # Scroll so that current row becomes top row
            self.top_row = row
          end
          # If current row is more to back than back row
          if row > self.top_row + (self.page_row_max - 1)
            # Scroll so that current row becomes back row
            self.top_row = row - (self.page_row_max - 1)
          end
          # Calculate cursor width
          cursor_width = self.width / @column_max - 32
          # Calculate cursor coordinates
          x = @index % @column_max * (cursor_width + 32)
          y = @index / @column_max * 32 - self.oy
          # Update cursor rectangle
          self.cursor_rect.set(x, y, cursor_width + 8, 32)
        end
      end
    
      #==============================================================================
      # ** Window_NewMenuStatus
      #------------------------------------------------------------------------------
      #  This window displays party member status on the menu screen.
      #==============================================================================
    
      class Window_NewMenuStatus < Window_Base
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          $game_party.actors.size < 4 ? i = 14 : i = 0
          $game_party.actors.size == 1 ? i = 24 : i = i
          super(0, 0, 480, ($game_party.actors.size * 84) + i)
          self.contents = Bitmap.new(width - 32, height - 32)
          refresh
          self.active = false
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          for i in 0...$game_party.actors.size
            x = 4
            y = (i * 76) - 6
            actor = $game_party.actors[i]
            self.contents.font.size = 19
            self.contents.font.bold = true
            draw_actor_class(actor, x, y - 1)
            draw_actor_state(actor, x + 160, y - 1)
            self.contents.font.size = 15
            draw_actor_parameter(actor, x, y + 14, 0, 120, LegACy::STAT_BAR[0])
            draw_actor_parameter(actor, x, y + 29, 1, 120, LegACy::STAT_BAR[0])
            draw_actor_parameter(actor, x, y + 44, 2, 120, LegACy::STAT_BAR[0])
            draw_actor_parameter(actor, x, y + 59, 3, 120, LegACy::STAT_BAR[0])
            draw_actor_parameter(actor, x + 240, y + 14, 4, 120, LegACy::STAT_BAR[0])
            draw_actor_parameter(actor, x + 240, y + 29, 5, 120, LegACy::STAT_BAR[0])
            draw_actor_parameter(actor, x + 240, y + 44, 6, 120, LegACy::STAT_BAR[0])
            draw_LegACy_bar(actor, x + 240, y + 75, 'exp')
          end
        end    
      end
    
      #==============================================================================
      # ** Window_Actor
      #------------------------------------------------------------------------------
      #  This window displays party member status on the menu screen.
      #==============================================================================
    
      class Window_Actor < Window_Selectable
        #--------------------------------------------------------------------------
        # * Public Instance Variables
        #--------------------------------------------------------------------------
        attr_accessor :party                    # party switcher
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          $game_party.actors.size < 4 ? i = 14 : i = 0      
          $game_party.actors.size == 1 ? i = 24 : i = i
          super(0, 0, 160, ($game_party.actors.size * 84) + i)
          self.contents = Bitmap.new(width - 32, height - 32)
          @frame = 0
          @party = false
          refresh
          self.active = false
          self.index = -1
        end    
        #--------------------------------------------------------------------------
        # * Returning Party Swapping State
        #--------------------------------------------------------------------------
        def party
          return @party
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          #@party ? @item_max = $game_party.actors.size : @item_max = 4
          @item_max = $game_party.actors.size # if $game_party.actors.size <= 4
          $game_party.actors.size < 4 ? i = 14 : i = 0      
          $game_party.actors.size == 1 ? i = 24 : i = i
          self.contents = Bitmap.new(width - 32, (@item_max * 84) + i - 32)
          for i in 0...@item_max
            x = 4
            y = (i * 77) - 12
            actor = $game_party.actors[i]
            self.contents.font.size = 17
            self.contents.font.bold = true
            LegACy::POTRAIT[0] ? draw_actor_potrait(actor, x, y - 1, LegACy::CLASS_POTRAIT[0]) : draw_LegACy_sprite(x + 20,
            y + 57, actor.character_name, actor.character_hue, @frame)
            draw_actor_name(actor, x + 52, y + 6)
            draw_actor_level(actor, x + 52, y + 24)
            draw_LegACy_bar(actor, x - 3, y + 60, 'hp', 120)
            draw_LegACy_bar(actor, x - 3, y + 75, 'sp', 120)
          end
        end
        #--------------------------------------------------------------------------
        # * Cursor Rectangle Update
        #--------------------------------------------------------------------------
        def update_cursor_rect       
          @index > 3 ? self.oy = (@index - 3) * 77 : self.oy = 0 
          if @index < 0
            self.cursor_rect.empty
          else
            self.cursor_rect.set(-4, (@index * 77) - 2 - self.oy, self.width - 24, 77)
          end
        end
        #--------------------------------------------------------------------------
        # Frame Update
        #--------------------------------------------------------------------------
        def frame_update      
          @frame == 3 ? @frame = 0 : @frame += 1
          refresh
        end
      end
      
      #==============================================================================
      # ** Window_Stat
      #------------------------------------------------------------------------------
      #  This window displays play time on the menu screen.
      #==============================================================================
    
      class Window_Stat < Window_Base
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          super(0, 0, 320, 96)
          self.contents = Bitmap.new(width - 32, height - 32)
          refresh
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          self.contents.font.color = system_color
          self.contents.font.size = 18
          self.contents.font.bold = true
          @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, -4, 120, 32, "Play Time")
          cx = contents.text_size($data_system.words.gold).width
          self.contents.draw_text(4, 18, 120, 32, "Step Count")
          self.contents.draw_text(4, 38, cx, 32, $data_system.words.gold, 2)
          self.contents.font.color = normal_color      
          if LegACy::ATS
            self.contents.draw_text(144, -4, 120, 32, $ats.clock, 2)
          else
            self.contents.draw_text(144, -4, 120, 32, text, 2)
          end
          self.contents.draw_text(144, 18, 120, 32, $game_party.steps.to_s, 2)
          self.contents.draw_text(144, 40, 120, 32, $game_party.gold.to_s, 2)
        end
        #--------------------------------------------------------------------------
        # * Frame Update
        #--------------------------------------------------------------------------
        def update
          super
          if Graphics.frame_count / Graphics.frame_rate != @total_sec
            refresh
          end
        end
      end
      
      #==============================================================================
      # ** Window_Location
      #------------------------------------------------------------------------------
      #  This window displays current map name.
      #==============================================================================
      
      class Window_Location < Window_Base
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          super(0, 0, 640, 48)
          self.contents = Bitmap.new(width - 32, height - 32)
          refresh
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          self.contents.font.color = system_color  
          self.contents.font.bold = true
          self.contents.font.size = 20
          self.contents.draw_text(4, -4, 120, 24, "Location")
          self.contents.font.color = normal_color
          self.contents.draw_text(170, -4, 400, 24, $game_map.name.to_s, 2)
        end    
      end
      
      #==============================================================================
      # ** Window_NewHelp
      #------------------------------------------------------------------------------
      #  This window shows skill and item explanations along with actor status.
      #==============================================================================
    
      class Window_NewHelp < Window_Base
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          super(0, 0, 640, 48)
          self.contents = Bitmap.new(width - 32, height - 32)
        end
        #--------------------------------------------------------------------------
        # * Set Text
        #  text  : text string displayed in window
        #  align : alignment (0..flush left, 1..center, 2..flush right)
        #--------------------------------------------------------------------------
        def set_text(text, align = 0)
          self.contents.font.bold = true
          self.contents.font.size = 20
          # If at least one part of text and alignment differ from last time
          if text != @text or align != @align
            # Redraw text
            self.contents.clear
            self.contents.font.color = normal_color
            self.contents.draw_text(4, -4, self.width - 40, 24, text, align)
            @text = text
            @align = align
            @actor = nil
          end
          self.visible = true
        end
      end
    
      #==============================================================================
      # ** Window_NewItem
      #------------------------------------------------------------------------------
      #  This window displays items in possession on the item and battle screens.
      #==============================================================================
    
      class Window_NewItem < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          super(0, 96, 480, 336)
          @column_max = 2
          @attribute = LegACy::ITEMS[0] if LegACy::ITEM_GROUPING
          refresh
          self.index = 0
          self.active = false
        end
        #--------------------------------------------------------------------------
        # * Get Item
        #--------------------------------------------------------------------------
        def item
          return @data[self.index]
        end
        #--------------------------------------------------------------------------
        # * Updates Window With New Item Type
        #     attribute : new item type
        #--------------------------------------------------------------------------
        def update_item(attribute)
          @attribute = attribute
          refresh
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          if self.contents != nil
            self.contents.dispose
            self.contents = nil
          end
          @data = []
          # Add item
          if LegACy::ITEM_GROUPING
            for i in 1...$data_items.size
              if $game_party.item_number(i) > 0 and 
                $data_items[i].element_set.include?(@attribute)
                @data.push($data_items[i])
              end
            end
            # Also add weapons and armors
            for i in 1...$data_weapons.size
              if $game_party.weapon_number(i) > 0 and
                $data_weapons[i].element_set.include?(@attribute)
                @data.push($data_weapons[i])
              end
            end
           for i in 1...$data_armors.size
              if $game_party.armor_number(i) > 0 and
                $data_armors[i].guard_element_set.include?(@attribute)
                @data.push($data_armors[i])
              end
            end
          else
            for i in 1...$data_items.size          
              @data.push($data_items[i]) if $game_party.item_number(i) > 0
            end
            # Also add weapons and armors
            for i in 1...$data_weapons.size          
              @data.push($data_weapons[i]) if $game_party.weapon_number(i) > 0
            end
           for i in 1...$data_armors.size          
              @data.push($data_armors[i]) if $game_party.armor_number(i) > 0
            end
          end      
          # If item count is not 0, make a bit map and draw all items
          @item_max = @data.size
          if @item_max > 0
            self.contents = Bitmap.new(width - 32, row_max * 32)
            for i in 0...@item_max
              draw_item(i)
            end
          end
        end
        #--------------------------------------------------------------------------
        # * Draw Item
        #     index : item number
        #--------------------------------------------------------------------------
        def draw_item(index)
          item = @data[index]
          case item
          when RPG::Item
            number = $game_party.item_number(item.id)
          when RPG::Weapon
            number = $game_party.weapon_number(item.id)
          when RPG::Armor
            number = $game_party.armor_number(item.id)
          end
          if item.is_a?(RPG::Item) and
             $game_party.item_can_use?(item.id)
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          x = 4 + index % 2 * (208 + 32)
          y = index / 2 * 32
          rect = Rect.new(x, y, self.width / @column_max - 32, 32)
          self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
          bitmap = RPG::Cache.icon(item.icon_name)
          opacity = self.contents.font.color == normal_color ? 255 : 128
          self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
          self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
          self.contents.draw_text(x + 160, y, 16, 32, ":", 1)
          self.contents.draw_text(x + 176, y, 24, 32, number.to_s, 2)
        end
        #--------------------------------------------------------------------------
        # * Help Text Update
        #--------------------------------------------------------------------------
        def update_help
          @help_window.set_text(self.item == nil ? "" : self.item.description)
        end
      end
      
      #==============================================================================
      # ** Window_NewSkill
      #------------------------------------------------------------------------------
      #  This window displays usable skills on the skill screen.
      #==============================================================================
    
      class Window_NewSkill < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     actor : actor
        #--------------------------------------------------------------------------
        def initialize(actor)
          super(0, 96, 480, 336)
          @actor = actor
          @column_max = 2
          refresh
          self.index = 0
          self.active = false      
        end
        #--------------------------------------------------------------------------
        # * Acquiring Skill
        #--------------------------------------------------------------------------
        def skill
          return @data[self.index]
        end
        #--------------------------------------------------------------------------
        # * Updates Window With New Actor
        #     actor : new actor
        #--------------------------------------------------------------------------
        def update_actor(actor)
          @actor = actor
          refresh
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          if self.contents != nil
            self.contents.dispose
            self.contents = nil
          end
          @data = []
          for i in 0...@actor.skills.size
            skill = $data_skills[@actor.skills[i]]
            if skill != nil
              @data.push(skill)
            end
          end
          # If item count is not 0, make a bit map and draw all items
          @item_max = @data.size
          if @item_max > 0
            self.contents = Bitmap.new(width - 32, row_max * 32)
            for i in 0...@item_max
              LegACy::PREXUS ? draw_prexus_item(i) : draw_item(i)
            end
          end
        end
        #--------------------------------------------------------------------------
        # * Draw Item
        #     index : item number
        #--------------------------------------------------------------------------
        def draw_item(index)
          skill = @data[index]
          if @actor.skill_can_use?(skill.id)
            self.contents.font.color = normal_color
          else
            self.contents.font.color = disabled_color
          end
          x = 4 + index % 2 * (208 + 32)
          y = index / 2 * 32
          rect = Rect.new(x, y, self.width / @column_max - 32, 32)
          self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
          bitmap = RPG::Cache.icon(skill.icon_name)
          opacity = self.contents.font.color == normal_color ? 255 : 128
          self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
          self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
          self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
        end
        #--------------------------------------------------------------------------
        # * Draw Item (For Prexus ABS)
        #     index : item number
        #--------------------------------------------------------------------------
        def draw_prexus_item(index)
          skill = @data[index]
          if @actor.skill_can_use?(skill.id)
            if $ABS.player.abs.hot_key.include?(skill.id)
              self.contents.font.color = Color.new(0, 225, 0, 255)
            else
              self.contents.font.color = normal_color
            end
          else
            if $ABS.player.abs.hot_key.include?(skill.id)
              self.contents.font.color = Color.new(0, 225, 0, 160)
            else
              self.contents.font.color = disabled_color
            end
          end
          x = 4 + index % 2 * (208 + 32)
          y = index / 2 * 32
          rect = Rect.new(x, y, self.width / @column_max - 32, 32)
          self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
          bitmap = RPG::Cache.icon(skill.icon_name)
          opacity = self.contents.font.color == normal_color ? 255 : 128
          self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
          self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
          self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
        end
        #--------------------------------------------------------------------------
        # * Help Text Update
        #--------------------------------------------------------------------------
        def update_help
          @help_window.set_text(self.skill == nil ? "" : self.skill.description)
        end
      end
      
      #==============================================================================
      # ** Window_Hotkey
      #------------------------------------------------------------------------------
      #  This window displays the skill shortcut
      #==============================================================================
      
      class Window_Hotkey < Window_Base
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          super(0, 336, 480, 96)
          self.contents = Bitmap.new(width - 32, height - 32)
          refresh
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          self.contents.font.size = 18
          self.contents.font.bold = true
          self.contents.font.color = system_color
          self.contents.draw_text(4, 0, 32, 32, 'H')
          self.contents.draw_text(4, 32, 32, 32, 'J')
          self.contents.draw_text(228, 0, 32, 32, 'K')
          self.contents.draw_text(228, 32, 32, 32, 'L')
          self.contents.font.color = normal_color
          for i in 0...4
            if ABS.skill_key[i] == nil
              self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, 'Not assigned')
              next
            end        
            skill = $data_skills[ABS.skill_key[i + 1]]        
            bitmap = RPG::Cache.icon(skill.icon_name)
            self.contents.blt((i / 2 * 224) + 26, (32 * (i % 2)) + 4, bitmap, Rect.new(0, 0, 24, 24))
            self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, skill.name)
            self.contents.draw_text((i / 2 * 224) + 178, 32 * (i % 2), 32, 32, skill.sp_cost.to_s, 2)
          end
        end 
      end
    
      #==============================================================================
      # ** Window_EquipStat
      #------------------------------------------------------------------------------
      #  This window displays actor parameter changes on the equipment screen.
      #==============================================================================
      class Window_EquipStat < Window_Base
        #--------------------------------------------------------------------------
        # * Public Instance Variables
        #--------------------------------------------------------------------------
        attr_accessor :changes
        attr_accessor :mode
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     actor : actor
        #--------------------------------------------------------------------------
        def initialize(actor)
          super(0, 96, 240, 336)
          self.contents = Bitmap.new(width - 32, height - 32)
          @actor = actor    
          @changes = [0, 0, 0, 0, 0, 0, 0, 0]
          @mode = 0
          @elem_text = ""
          @stat_text = ""
          refresh
        end
        #--------------------------------------------------------------------------
        # * Updates Window With New Actor
        #     actor : new actor
        #--------------------------------------------------------------------------
        def update_actor(actor)
          @actor = actor
          refresh
        end  
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          self.contents.font.size = 18
          self.contents.font.bold = true
          for i in 0..7
            draw_actor_parameter(@actor, 16, (i * 20) - 8, i, 96, LegACy::STAT_BAR[1])
          end      
          self.contents.font.color = system_color
          oldelem_text = ""
          oldstat_text = ""
          if @mode == 0
            item = $data_weapons[@actor.weapon_id]
            if item != nil
              more = false
              for i in item.element_set
                next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
                  i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
                  i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
                oldelem_text += ", " if more
                oldelem_text += $data_system.elements[i].to_s
                more = true
              end        
              more = false
              for i in item.plus_state_set
                oldstat_text += ", " if more
                oldstat_text += $data_states[i].name
                more = true
              end
            else
              oldelem_text = ""
              oldstat_text = ""
            end
          else
            item = $data_armors[eval("@actor.armor#{mode}_id")]
            if item != nil
              more = false
              for i in item.guard_element_set
               next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
                  i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
                  i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
                oldelem_text += ", " if more
                oldelem_text += $data_system.elements[i].to_s
                more = true
              end
              more = false
              for i in item.guard_state_set
                oldstat_text += ", " if more
                oldstat_text += $data_states[i].name
                more = true
              end
            else
              oldelem_text = ""
              oldstat_text = ""
            end
          end
          if @mode == 0
            self.contents.draw_text(4, 176, 200, 32, "Elemental Attack:")
            self.contents.draw_text(4, 240, 200, 32, "Status Attack:")
          else      
            self.contents.draw_text(4, 176, 200, 32, "Elemental Defense:")
            self.contents.draw_text(4, 240, 200, 32, "Status Defense:")
          end        
          self.contents.font.color = normal_color
          self.contents.draw_text(24, 194, 220, 32, oldelem_text)
          self.contents.draw_text(24, 258, 220, 32, oldstat_text)
          if @elem_text != ""
            self.contents.draw_text(24, 218, 220, 32, @elem_text)
          end
          if @stat_text != ""
            self.contents.draw_text(24, 282, 220, 32, @stat_text)
          end 
          if @new_atk != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, -8, 32, 32, "??", 1)
            if @changes[0] == 0
              self.contents.font.color = normal_color
            elsif @changes[0] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, -8, 32, 32, @new_atk.to_s, 2)
          end
          if @new_pdef != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, 12, 32, 32, "??", 1)
            if @changes[1] == 0
              self.contents.font.color = normal_color
            elsif @changes[1] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, 12, 32, 32, @new_pdef.to_s, 2)
          end
          if @new_mdef != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, 32, 32, 32, "??", 1)
            if @changes[2] == 0
              self.contents.font.color = normal_color
            elsif @changes[2] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, 32, 32, 32, @new_mdef.to_s, 2)
          end
          if @new_str != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, 52, 32, 32, "??", 1)
            if @changes[3] == 0
              self.contents.font.color = normal_color
            elsif @changes[3] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, 52, 32, 32, @new_str.to_s, 2)
          end
           if @new_dex != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, 72, 32, 32, "??", 1)
            if @changes[4] == 0
              self.contents.font.color = normal_color
            elsif @changes[4] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, 72, 32, 32, @new_dex.to_s, 2)
          end
            if @new_agi != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, 92, 32, 32, "??", 1)
            if @changes[5] == 0
              self.contents.font.color = normal_color
            elsif @changes[5] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, 92, 32, 32, @new_agi.to_s, 2)
          end
          if @new_int != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, 112, 32, 32, "??", 1)
            if @changes[6] == 0
              self.contents.font.color = normal_color
            elsif @changes[6] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, 112, 32, 32, @new_int.to_s, 2)
          end      
          if @new_eva != nil
            self.contents.font.color = system_color
            self.contents.draw_text(152, 132, 32, 32, "??", 1)
            if @changes[7] == 0
              self.contents.font.color = normal_color
            elsif @changes[7] == -1
              self.contents.font.color = down_color
            else
              self.contents.font.color = up_color
            end
            self.contents.draw_text(176, 132, 32, 32, @new_eva.to_s, 2)
          end
        end
        #--------------------------------------------------------------------------
        # * Set parameters after changing equipment
        #     new_atk  : attack power after changing equipment
        #     new_pdef : physical defense after changing equipment
        #     new_mdef : magic defense after changing equipment
        #     new_str  : strength after changing equipment
        #     new_dex  : dexterity after changing equipment
        #     new_agi  : agility after changing equipment
        #     new_int  : inteligence after changing equipment
        #     new_eva  : evasion after changing equipment
        #--------------------------------------------------------------------------
        def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
          new_agi, new_int, new_eva, elem_text, stat_text)
          flag = false
          if new_atk != @new_atk || new_pdef != @new_pdef || new_str != @new_str ||
            new_mdef != @new_mdef || new_dex != @new_dex || new_agi != @new_agi ||
            new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
            flag = true
          end
          @new_atk = new_atk
          @new_pdef = new_pdef
          @new_mdef = new_mdef
          @new_str = new_str
          @new_dex = new_dex
          @new_agi = new_agi
          @new_int = new_int
          @new_eva = new_eva
          @elem_text = elem_text
          @stat_text = stat_text
          if flag
            refresh
          end
        end      
      end
      
      #==============================================================================
      # ** Window_Equipment
      #------------------------------------------------------------------------------
      #  This window displays items the actor is currently equipped with on the
      #  equipment screen.
      #==============================================================================
    
      class Window_Equipment < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     actor : actor
        #--------------------------------------------------------------------------
        def initialize(actor)
          super(0, 96, 240, 176)
          self.contents = Bitmap.new(width - 32, height - 32)
          @actor = actor
          refresh
          self.index = 0
          self.active = false
        end
        #--------------------------------------------------------------------------
        # * Updates Window With New Actor
        #     actor : new actor
        #--------------------------------------------------------------------------
        def update_actor(actor)
          @actor = actor
          refresh
        end    
        #--------------------------------------------------------------------------
        # * Item Acquisition
        #--------------------------------------------------------------------------
        def item
          return @data[self.index]
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          @data = []
          @data.push($data_weapons[@actor.weapon_id])
          @data.push($data_armors[@actor.armor1_id])
          @data.push($data_armors[@actor.armor2_id])
          @data.push($data_armors[@actor.armor3_id])
          @data.push($data_armors[@actor.armor4_id])
          @item_max = @data.size
          self.contents.font.color = system_color
          self.contents.font.size = 19
          self.contents.font.bold = true
          self.contents.draw_text(0, 28 * 0, 76, 32, $data_system.words.weapon)
          self.contents.draw_text(0, 28 * 1, 76, 32, $data_system.words.armor1)
          self.contents.draw_text(0, 28 * 2, 76, 32, $data_system.words.armor2)
          self.contents.draw_text(0, 28 * 3, 76, 32, $data_system.words.armor3)
          self.contents.draw_text(0, 28 * 4, 76, 32, $data_system.words.armor4)
          self.contents.font.bold = false
          for i in 0..4
            draw_item_name(@data[i], 76, 28 * i)
          end
        end
        #--------------------------------------------------------------------------
        # * Update Cursor Rectangle
        #--------------------------------------------------------------------------
        def update_cursor_rect  
          # Calculate cursor width
          cursor_width = self.width / @column_max - 24
          # Calculate cursor coordinates
          x = @index % @column_max * (cursor_width + 24)
          y = @index  * 28
          # Update cursor rectangle
          self.cursor_rect.set(x - 4, y, cursor_width, 32)
        end
        def update
          #super
          # If cursor is movable
          if self.active and @item_max > 0 and @index >= 0
            # If pressing down on the directional buttons
            if Input.repeat?(Input::DOWN)
              # If column count is 1 and directional button was pressed down with no
              # repeat, or if cursor position is more to the front than
              # (item count - column count)
              if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
                 @index < @item_max - @column_max
                # Move cursor down
                $game_system.se_play($data_system.cursor_se)
                @index = (@index + @column_max) % @item_max
              end
            end
            # If the up directional button was pressed
            if Input.repeat?(Input::UP)
              # If column count is 1 and directional button was pressed up with no
              # repeat, or if cursor position is more to the back than column count
              if (@column_max == 1 and Input.trigger?(Input::UP)) or
                 @index >= @column_max
                # Move cursor up
                $game_system.se_play($data_system.cursor_se)
                @index = (@index - @column_max + @item_max) % @item_max
              end
            end
            # If the right directional button was pressed
            if Input.repeat?(Input::RIGHT)
              # If column count is 2 or more, and cursor position is closer to front
              # than (item count -1)
              if @column_max >= 2 and @index < @item_max - 1
                # Move cursor right
                $game_system.se_play($data_system.cursor_se)
                @index += 1
              end
            end
            # If the left directional button was pressed
            if Input.repeat?(Input::LEFT)
              # If column count is 2 or more, and cursor position is more back than 0
              if @column_max >= 2 and @index > 0
                # Move cursor left
                $game_system.se_play($data_system.cursor_se)
                @index -= 1
              end
            end
          end
          # Update help text (update_help is defined by the subclasses)
          if self.active and @help_window != nil
            update_help
          end
          # Update cursor rectangle
          update_cursor_rect
        end
        #--------------------------------------------------------------------------
        # * Help Text Update
        #--------------------------------------------------------------------------
        def update_help
          @help_window.set_text(self.item == nil ? "" : self.item.description)
        end
      end
      #==============================================================================
      # ** Window_EquipmentItem
      #------------------------------------------------------------------------------
      #  This window displays choices when opting to change equipment on the
      #  equipment screen.
      #==============================================================================
    
      class Window_EquipmentItem < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     actor      : actor
        #     equip_type : equip region (0-3)
        #--------------------------------------------------------------------------
        def initialize(actor, equip_type)
          super(0, 272, 240, 160)
          @actor = actor
          @equip_type = equip_type
          refresh
          self.active = false
          self.index = -1
        end
        #--------------------------------------------------------------------------
        # * Updates Window With New Actor
        #     actor : new actor
        #--------------------------------------------------------------------------
        def update_actor(actor)
          @actor = actor
          refresh
        end    
        #--------------------------------------------------------------------------
        # * Updates Window With New Equipment Type
        #     equip_type : new teyp of equipment
        #--------------------------------------------------------------------------
        def update_equipment(equip_type)
          @equip_type = equip_type
        end   
        #--------------------------------------------------------------------------
        # * Item Acquisition
        #--------------------------------------------------------------------------
        def item
          if self.index == 0
            return @data[@item_max - 1]
          else
            return @data[self.index - 1]
          end
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          if self.contents != nil
            self.contents.dispose
            self.contents = nil
          end
          @data = []
          # Add equippable weapons
          if @equip_type == 0
            weapon_set = $data_classes[@actor.class_id].weapon_set
            for i in 1...$data_weapons.size
              if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
                @data.push($data_weapons[i])
              end
            end
          end
          # Add equippable armor
          if @equip_type != 0
            armor_set = $data_classes[@actor.class_id].armor_set
            for i in 1...$data_armors.size
              if $game_party.armor_number(i) > 0 and armor_set.include?(i)
                if $data_armors[i].kind == @equip_type-1
                  @data.push($data_armors[i])
                end
              end
            end
          end
          # Add blank page
          @data.push(nil)
          # Make a bit map and draw all items
          @item_max = @data.size
          self.contents = Bitmap.new(width - 32, row_max * 32)
          for i in 0...@item_max - 1
            draw_item(i)
          end
          self.contents.draw_text(4, 0, 204, 32, 'Unequip', 0)
        end
        #--------------------------------------------------------------------------
        # * Draw Item
        #     index : item number
        #--------------------------------------------------------------------------
        def draw_item(index)
          item = @data[index]
          x = 4
          y = (index + 1) * 32
          case item
          when RPG::Weapon
            number = $game_party.weapon_number(item.id)
          when RPG::Armor
            number = $game_party.armor_number(item.id)
          end
          bitmap = RPG::Cache.icon(item.icon_name)
          self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
          self.contents.font.color = normal_color
          self.contents.font.size = 20
          self.contents.font.bold = true
          self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
          self.contents.draw_text(x + 160, y, 12, 32, ":", 1)
          self.contents.draw_text(x + 176, y, 24, 32, number.to_s, 2)
        end
        #--------------------------------------------------------------------------
        # * Help Text Update
        #--------------------------------------------------------------------------
        def update_help
          @help_window.set_text(self.item == nil ? 'Unequip the current equipment.' :
            self.item.description)
        end
      end
      
      #==============================================================================
      # ** Window_Status
      #------------------------------------------------------------------------------
      #  This window displays full status specs on the status screen.
      #==============================================================================
    
      class Window_NewStatus < Window_Base
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     actor      : actor
        #--------------------------------------------------------------------------
        def initialize(actor)
          super(0, 96, 640, 336)
          self.contents = Bitmap.new(width - 32, height - 32)
          @actor = actor
          refresh
          self.active = false
        end
        #--------------------------------------------------------------------------
        # * Updates Window With New Actor
        #     actor : new actor
        #--------------------------------------------------------------------------    
        def update_actor(actor)
          @actor = actor
          refresh
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          self.contents.font.size = 22
          self.contents.font.bold = false
          draw_actor_name(@actor, 12, 0)
          if LegACy::POTRAIT[1]
            draw_actor_potrait(@actor, 12, 40, LegACy::POTRAIT[1])
            draw_LegACy_bar(@actor, 120, 60, 'hp', 200)
            draw_LegACy_bar(@actor, 120, 92, 'sp', 200)
            draw_LegACy_bar(@actor, 120, 124, 'exp', 200)
          else
            draw_actor_graphic(@actor,         40, 120)
            draw_LegACy_bar(@actor, 96, 60, 'hp', 200)
            draw_LegACy_bar(@actor, 96, 92, 'sp', 200)
            draw_LegACy_bar(@actor, 96, 124, 'exp', 200)
          end      
          draw_actor_class(@actor, 262, 0)
          draw_actor_level(@actor, 184, 0)
          draw_actor_state(@actor, 96, 0)      
          self.contents.font.size = 17
          self.contents.font.bold = true
          for i in 0..7
            draw_actor_parameter(@actor, 386, (i * 20) - 6, i, 120, LegACy::STAT_BAR[2])
          end
          self.contents.font.color = system_color
          self.contents.font.size = 16
          draw_actor_element_radar_graph(@actor, 48, 136)
          self.contents.font.size = 18
          self.contents.font.color = system_color
          self.contents.draw_text(380, 156, 96, 32, "Equipment")
          self.contents.draw_text(300, 180, 96, 32, "Weapon")
          self.contents.draw_text(300, 204, 96, 32, "Shield")
          self.contents.draw_text(300, 228, 96, 32, "Helmet")
          self.contents.draw_text(300, 252, 96, 32, "Armor")
          self.contents.draw_text(300, 276, 96, 32, "Accessory")
          equip = $data_weapons[@actor.weapon_id]
          if  @actor.equippable?(equip)
            draw_item_name($data_weapons[@actor.weapon_id], 406, 180)
          else 
            self.contents.font.color = knockout_color
            self.contents.draw_text(406, 180, 192, 32, "Nothing equipped")
          end
          equip1 = $data_armors[@actor.armor1_id]
            if  @actor.equippable?(equip1)
            draw_item_name($data_armors[@actor.armor1_id], 406, 204)
          else 
            self.contents.font.color = crisis_color
            self.contents.draw_text(406, 204, 192, 32, "Nothing equipped")
          end
          equip2 = $data_armors[@actor.armor2_id]
            if  @actor.equippable?(equip2)
            draw_item_name($data_armors[@actor.armor2_id], 406, 228)
          else 
            self.contents.font.color = crisis_color
            self.contents.draw_text(406, 228, 192, 32, "Nothing equipped")
          end
          equip3 = $data_armors[@actor.armor3_id]
            if  @actor.equippable?(equip3)
            draw_item_name($data_armors[@actor.armor3_id], 406, 252)
          else 
            self.contents.font.color = crisis_color
            self.contents.draw_text(406, 252, 192, 32, "Nothing equipped")
          end
          equip4 = $data_armors[@actor.armor4_id]
            if  @actor.equippable?(equip4)
            draw_item_name($data_armors[@actor.armor4_id], 406, 276)
          else 
            self.contents.font.color = crisis_color
            self.contents.draw_text(406, 276, 192, 32, "Nothing equipped")
          end    
        end    
        def dummy
          self.contents.font.color = system_color
          self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
          self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
          self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
          self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
          self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
          draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
          draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
          draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
          draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
          draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
        end    
      end
      
      #==============================================================================
      # ** Window_Files
      #------------------------------------------------------------------------------
      # This window shows a list of recorded save files.
      #==============================================================================
    
      class Window_File < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize()
          super(0, 96, 320, 336)
          self.contents = Bitmap.new(width - 32, LegACy::SAVE_NUMBER * 32)
          index = $game_temp.last_file_index == nil ? 0 : $game_temp.last_file_index
          self.index = index
          self.active = false
          @item_max = LegACy::SAVE_NUMBER
          refresh
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          self.contents.font.color = normal_color
          time_stamp = Time.at(0)
          for i in 0...LegACy::SAVE_NUMBER
            filename = "Save#{i + 1}.rxdata"
            self.contents.draw_text(1, i * 32, 32, 32, (i + 1).to_s, 1)
            if FileTest.exist?(filename)
              size = File.size(filename)
              if size.between?(1000, 999999)
                size /= 1000
                size_str = "#{size} KB"
              elsif size > 999999
                size /= 1000000
                size_str = "#{size} MB"
              else
                size_str = size.to_s
              end
              time_stamp = File.open(filename, "r").mtime
              date = time_stamp.strftime("%m/%d/%Y")
              time = time_stamp.strftime("%H:%M")
              self.contents.font.size = 20
              self.contents.font.bold = true
              self.contents.draw_text(38, i * 32, 120, 32, date)
              self.contents.draw_text(160, i * 32, 100, 32, time)
              self.contents.draw_text(0, i * 32, 284, 32, size_str, 2)
            end
          end
        end
      end
    
      #==============================================================================
      # ** Window_FileStat
      #------------------------------------------------------------------------------
      # This window shows the status of the currently selected save file
      #==============================================================================
    
      class Window_FileStatus < Window_Base
       #--------------------------------------------------------------------------
        # * Object Initialization
        #     save_window      : current save file
        #--------------------------------------------------------------------------
        def initialize(save_window)
          super(0, 96, 320, 336)
          self.contents = Bitmap.new(width - 32, height - 32)
          @save_window = save_window
          @index = @save_window.index
          refresh
        end
        #--------------------------------------------------------------------------
        # # Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          filename = "Save#{@index + 1}.rxdata"
          return unless FileTest.exist?(filename)
          file = File.open(filename, "r")
          Marshal.load(file)
          frame_count = Marshal.load(file)
          for i in 0...6
            Marshal.load(file)
          end
          party = Marshal.load(file)
          Marshal.load(file)
          map = Marshal.load(file)
          self.contents.font.size = 20
          self.contents.font.bold = true
          for i in 0...party.actors.size
            actor = party.actors[i]
            x = 4
            y = i * 56
            draw_LegACy_bar(actor, x + 112, y + 14, 'hp', 160)
            draw_LegACy_bar(actor, x + 112, y + 36, 'sp', 160)
            draw_actor_name(actor, x + 40, y - 2)
            draw_actor_level(actor, x + 40, y + 22)
            draw_actor_graphic(actor, x + 10, y + 48)        
          end
          total_sec = 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)
          map_name = load_data("Data/MapInfos.rxdata")[map.map_id].name
          self.contents.font.color = system_color
          self.contents.draw_text(4, 224, 96, 32, "Play Time ")
          self.contents.draw_text(4, 252, 96, 32, $data_system.words.gold)
          self.contents.draw_text(4, 280, 96, 32, "Location ")
          self.contents.draw_text(104, 224, 16, 32, ":")
          self.contents.draw_text(104, 252, 16, 32, ":")
          self.contents.draw_text(104, 280, 16, 32, ":")
          self.contents.font.color = normal_color
          self.contents.draw_text(120, 224, 144, 32, text)
          self.contents.draw_text(120, 252, 144, 32, party.gold.to_s)
          self.contents.draw_text(120, 280, 144, 32, map_name)
        end 
        #--------------------------------------------------------------------------
        # * Update
        #--------------------------------------------------------------------------
        def update
          if @index != @save_window.index
            @index = @save_window.index
            refresh
          end
          super
        end
      end
      
      #==============================================================================
      # ** Scene_Menu
      #------------------------------------------------------------------------------
      #  This class performs menu screen processing.
      #==============================================================================
    
      class Scene_Menu
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     menu_index : command cursor's initial position
        #--------------------------------------------------------------------------
        def initialize(menu_index = 0)
          @menu_index = menu_index
          @update_frame = 0
          @targetactive = false
          @exit = false
          @actor = $game_party.actors[0]
          @old_actor = nil      
        end
        #--------------------------------------------------------------------------
        # * Main Processing
        #--------------------------------------------------------------------------
        def main
          # Make command window
          if LegACy::ICON
            s1 = '     ' + $data_system.words.item
            s2 = '     ' + $data_system.words.skill
            s3 = '    ' + $data_system.words.equip
            s4 = '    ' + 'Status'
            s5 = '    ' + 'Save'
            s6 = '    ' + 'Exit'
            t1 = '     ' + LegACy::ITEM_GROUPS[0]
            t2 = '      ' + LegACy::ITEM_GROUPS[1]
            t3 = '     ' + LegACy::ITEM_GROUPS[2]
            t4 = '      ' + LegACy::ITEM_GROUPS[3]
            t5 = '    ' + LegACy::ITEM_GROUPS[4]
            t6 = '    ' + LegACy::ITEM_GROUPS[5]
          else
            s1 = ' ' + $data_system.words.item
            s2 = ' ' + $data_system.words.skill
            s3 = ' ' + $data_system.words.equip
            s4 = ' ' + 'Status'
            s5 = 'Save'
            s6 = 'Exit'
            t1 = ' ' + LegACy::ITEM_GROUPS[0]
            t2 = ' ' + LegACy::ITEM_GROUPS[1]
            t3 = ' ' + LegACy::ITEM_GROUPS[2]
            t4 = ' ' + LegACy::ITEM_GROUPS[3]
            t5 = LegACy::ITEM_GROUPS[4]
            t6 = LegACy::ITEM_GROUPS[5]
          end      
          u1 = 'To Title'
          u2 = 'Quit'
          v1 = 'Optimize'
          v2 = 'Unequip All'      
          @command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6])
          @command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6], LegACy::ICON_NAME[0]) if LegACy::ICON
          @command_window.y = -96
          @command_window.index = @menu_index
          # If number of party members is 0
          if $game_party.actors.size == 0
            # Disable items, skills, equipment, and status
            @command_window.disable_item(0)
            @command_window.disable_item(1)
            @command_window.disable_item(2)
            @command_window.disable_item(3)
          end
          # If save is forbidden
          if $game_system.save_disabled
            # Disable save
            @command_window.disable_item(4)
          end
          # Make stat window
          @stat_window = Window_Stat.new
          @stat_window.x = 320
          @stat_window.y = -96
          # Make status window
          @status_window = Window_NewMenuStatus.new
          @status_window.x = 640
          @status_window.y = 96
          # Make location window
          @location_window = Window_Location.new
          @location_window.y = 480
          # Make actor status window
          @actor_window = Window_Actor.new
          @actor_window.x = -160
          @actor_window.y = 96
          # If Item Grouping feature is used
          if LegACy::ITEM_GROUPING
            # Make item grouping window
            @itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6])
            @itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6], LegACy::ICON_NAME[1]) if LegACy::ICON
            @itemcommand_window.x = -320
            @itemcommand_window.active = false
          end
          # Make help window
          @help_window = Window_NewHelp.new
          @help_window.x = -640
          @help_window.y = 432
          # Make item window
          @item_window = Window_NewItem.new
          @item_window.x = -480      
          @item_window.help_window = @help_window
          # Make skill window
          @skill_window = Window_NewSkill.new(@actor)
          @skill_window.x = -480      
          @skill_window.help_window = @help_window
          # If Near's SBABS is used
          if LegACy::ABS 
            # Make skill hotkey window
            @hotkey_window = Window_Hotkey.new
            @hotkey_window.x = -480
          end
          # Make player  window stat on equipment menu
          @equipstat_window = Window_EquipStat.new(@actor)
          @equipstat_window.x = -480
          # Make equipment window
          @equip_window = Window_Equipment.new(@actor)
          @equip_window.x = -240
          @equip_window.help_window = @help_window
          # Make equipable item window
          @equipitem_window = Window_EquipmentItem.new(@actor, 0)
          @equipitem_window.x = -240
          @equipitem_window.help_window = @help_window
          # Make special equipment features select window
          @equipenhanced_window = Window_Command.new(160, [v1, v2])
          @equipenhanced_window.x = -160
          @equipenhanced_window.active = false
          @playerstatus_window = Window_NewStatus.new(@actor)
          @playerstatus_window.x = -640
          @file_window = Window_File.new
          @file_window.x = -640
          @filestatus_window = Window_FileStatus.new(@file_window)
          @filestatus_window.x = -320
          @end_window = Window_Command.new(120, [u1, u2])
          @end_window.x = 640
          @end_window.active = false
          @spriteset = Spriteset_Map.new
          @windows = [@command_window, @stat_window, @status_window, 
            @location_window, @actor_window, @help_window, @item_window, 
            @skill_window, @equipstat_window, @equip_window, @equipitem_window, 
            @equipenhanced_window, @playerstatus_window, @file_window,
            @filestatus_window, @end_window]
          @windows.push(@itemcommand_window) if LegACy::ITEM_GROUPING
          @windows.push(@hotkey_window) if LegACy::ABS
          @windows.each {|i| i.opacity = LegACy::WIN_OPACITY}
          @windows.each {|i| i.z += LegACy::WIN_Z}
          # Execute transition
          Graphics.transition
          # Main loop
          loop do
            # Update game screen
            Graphics.update
            # Update input information
            Input.update        
            # Frame update
            update
            # Abort loop if screen is changed
            if $scene != self
              break
            end
          end
          # Prepare for transition
          Graphics.freeze
          # Dispose of windows      
          @spriteset.dispose
          @windows.each {|i| i.dispose}
        end
        #--------------------------------------------------------------------------
        # * Frame Update
        #--------------------------------------------------------------------------
        def update
          # Update windows
          @windows.each {|i| i.update}
          animate     
          menu_update
          update_scroll if @skill_window.active || @equip_window.active || @playerstatus_window.active
          if LegACy::ANIMATED       
            @update_frame += 1
            if @update_frame == 3
              @update_frame = 0
              @actor_window.frame_update
            end
          end      
        end
        #--------------------------------------------------------------------------
        # * Animating windows.
        #--------------------------------------------------------------------------
        def animate
          if @command_window.active && @skill_window.x == -480 &&
           @file_window.x == -640 && @item_window.x == -480
            @command_window.y += 6 if @command_window.y < 0
            @stat_window.y += 6 if @stat_window.y < 0
            @actor_window.x += 10 if @actor_window.x < 0
            @status_window.x -= 30 if @status_window.x > 160
            @location_window.y -= 3 if @location_window.y > 432
          elsif @exit == true
            @command_window.y -= 6 if @command_window.y > -96
            @stat_window.y -= 6 if @stat_window.y > -96
            @actor_window.x -= 10 if @actor_window.x > -160
            @status_window.x += 30 if @status_window.x < 640
            @location_window.y += 3 if @location_window.y < 480
            $scene = Scene_Map.new if @location_window.y == 480
          end
          if LegACy::ITEM_GROUPING
            if @itemcommand_window.active        
              if @itemcommand_window.x < 0
                @stat_window.x += 40
                @command_window.x += 40
                @itemcommand_window.x += 40 
              end
            else
              if @itemcommand_window.x > -320 && @command_window.active
                @stat_window.x -= 40
                @command_window.x -= 40
                @itemcommand_window.x -= 40
              end
            end
          end
          if @item_window.active        
            if @item_window.x < 0
              @location_window.x += 40
              @help_window.x += 40
              @status_window.x += 30
              @actor_window.x += 30
              @item_window.x += 30 
            end
          elsif @targetactive != true
            if @item_window.x > -480
              @help_window.x -= 40
              @location_window.x -= 40
              @item_window.x -= 30 
              @actor_window.x -= 30
              @status_window.x -= 30
            end 
          end
          if @skill_window.active        
            if @skill_window.x < 0
              @location_window.x += 40
              @help_window.x += 40
              @status_window.x += 30
              @actor_window.x += 30
              @hotkey_window.x += 30 if @actor_window.index == 0 && LegACy::ABS
              @skill_window.x += 30 
            end
          elsif @targetactive != true
            if @skill_window.x > -480
              @help_window.x -= 40
              @location_window.x -= 40
              @skill_window.x -= 30
              if LegACy::ABS
                @hotkey_window.x -= 30 if @hotkey_window.x > -480
              end
              @actor_window.x -= 30          
              @status_window.x -= 30
            end 
          end
          if @equip_window.active        
            if @equipstat_window.x < 0
              @status_window.x += 48
              @actor_window.x += 48
              @equip_window.x += 48
              @equipitem_window.x += 48
              @equipstat_window.x += 48          
              @location_window.x += 64
              @help_window.x += 64
            end
          elsif ! @equipitem_window.active && ! @equipenhanced_window.active
            if @equipstat_window.x > -480
              @equipstat_window.x -= 48 
              @equip_window.x -= 48
              @equipitem_window.x -= 48
              @actor_window.x -= 48
              @status_window.x -= 48
              @help_window.x -= 64
              @location_window.x -= 64
            end 
          end
          if @equipenhanced_window.active        
            if @equipenhanced_window.x < 0 
              @stat_window.x += 16
              @command_window.x += 16
              @equipenhanced_window.x += 16 
            end
          else
            if @equipenhanced_window.x > -160 && @equip_window.active
              @equipenhanced_window.x -= 16
              @stat_window.x -= 16
              @command_window.x -= 16
            end
          end
          if @playerstatus_window.active        
            if @playerstatus_window.x < 0
              @status_window.x += 40
              @actor_window.x += 40
              @playerstatus_window.x += 40 
            end
          else
            if @playerstatus_window.x > -640
              @playerstatus_window.x -= 40 
              @actor_window.x -= 40
              @status_window.x -= 40
            end 
          end
          if @file_window.active        
            if @file_window.x < 0
              @status_window.x += 40
              @actor_window.x += 40
              @filestatus_window.x += 40
              @file_window.x += 40 
            end
          else
            if @file_window.x > -640
              @file_window.x -= 40 
              @filestatus_window.x -= 40     
              @actor_window.x -= 40
              @status_window.x -= 40     
            end
          end
          if @end_window.active        
            if @end_window.x > 520
              @stat_window.x -= 10
              @command_window.x -= 10
              @end_window.x -= 10 
            end
          else
            if @end_window.x < 640
              @end_window.x += 10
              @stat_window.x += 10
              @command_window.x += 10
            end
          end
        end
        #--------------------------------------------------------------------------
        # * Checking Update Method Needed
        #--------------------------------------------------------------------------
        def menu_update
          if @command_window.active && @command_window.y == 0 && @command_window.x == 0 then update_command
          elsif @item_window.x == -480 && LegACy::ITEM_GROUPING && @itemcommand_window.active && @itemcommand_window.x == 0 then update_itemcommand
          elsif @item_window.active && @item_window.x == 0 then update_item
          elsif @skill_window.active then update_skill
          elsif @targetactive == true then update_target
          elsif @equip_window.active && @equip_window.x == 240 then update_equip
          elsif @equipitem_window.active then update_equipment
          elsif @equipenhanced_window.x == 0 then update_extraequip 
          elsif @playerstatus_window.x == 0 then update_playerstatus
          elsif @file_window.x == 0 then update_save
          elsif @actor_window.active && @actor_window.x == 0 then update_status
          elsif @end_window.active then update_end     
          end
        end
        #--------------------------------------------------------------------------
        # * Windows Actor Scrolling Update
        #--------------------------------------------------------------------------
        def update_scroll
          if Input.trigger?(Input::R)
            # Play cursor SE
            $game_system.se_play($data_system.cursor_se)
            # To next actor
            if $game_party.actors.size - 1 == @actor_window.index
              @actor_window.index = 0
            else
              @actor_window.index += 1
            end        
            actor = $game_party.actors[@actor_window.index]
            if @skill_window.active
              if LegACy::ABS
                @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
                @actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
              end       
              @skill_window.update_actor(actor) 
            end        
            if @equip_window.active
              @equip_window.update_actor(actor)
              @equipitem_window.update_actor(actor)
              @equipstat_window.update_actor(actor)
            end        
            @playerstatus_window.update_actor(actor) if @playerstatus_window.active
            return
          end
          # If L button was pressed
          if Input.trigger?(Input::L)
            # Play cursor SE
            $game_system.se_play($data_system.cursor_se)
            # To previous actor
            if @actor_window.index == 0
              @actor_window.index = $game_party.actors.size - 1
            else
              @actor_window.index -= 1
            end
            actor = $game_party.actors[@actor_window.index]
            if @skill_window.active
              if LegACy::ABS
                @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
                @actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
              end       
              @skill_window.update_actor(actor) 
            end         
            if @equip_window.active
              @equip_window.update_actor(actor)
              @equipitem_window.update_actor(actor)
              @equipstat_window.update_actor(actor)
            end        
            @playerstatus_window.update_actor(actor) if @playerstatus_window.active
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when command window is active)
        #--------------------------------------------------------------------------
        def update_command
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to map screen
            @command_window.active = false
            @exit = true
            return
          end
          # If B button was pressed
          if Input.trigger?(Input::SHIFT) && LegACy::PARTY_SWAP
            # Play cancel SE
            $game_system.se_play($data_system.decision_se)
            # Switch to map screen
            @command_window.active = false
            @actor_window.party = true
            unless $game_party.reserve == []
              for i in 0...$game_party.reserve.size
                $game_party.actors.push($game_party.reserve[i])
              end
            end        
            @actor_window.refresh
            @actor_window.active = true        
            @actor_window.index = 0
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # If command other than save or end game, and party members = 0
            if $game_party.actors.size == 0 and @command_window.index < 4
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            @command_window.active = false
            # Branch by command window cursor position
            case @command_window.index
            when 0  # item
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              # Switch to item screen
              if LegACy::ITEM_GROUPING
                @itemcommand_window.active = true
              else
                @item_window.active = true
                @item_window.index = 0
                @help_window.active = true
              end          
            when 1  # equipment
             # Play decision SE
              $game_system.se_play($data_system.decision_se)
              # Make status window active
              @actor_window.active = true
              @actor_window.index = 0
            when 2  # save
              # If saving is forbidden
              if $game_system.save_disabled
                # Play buzzer SE
                $game_system.se_play($data_system.buzzer_se)
                return
              end
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              # Switch to save screen
              @file_window.active = true
            when 3..4  # skill & status
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              # Make status window active
              @actor_window.active = true
              @actor_window.index = 0
            when 5  # end game
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              # Switch to end game screen
              @end_window.active = true
            end
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when item command window is active)
        #--------------------------------------------------------------------------
        def update_itemcommand
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to item command window
            @command_window.active = true
            @itemcommand_window.active = false
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Branch by command window cursor position
            type = LegACy::ITEMS[@itemcommand_window.index]
            @item_window.active = true
            @itemcommand_window.active = false
            @item_window.update_item(type)
            @item_window.index = 0
            @help_window.active = true
            return
          end
        end    
        #--------------------------------------------------------------------------
        # * Frame Update (when item window is active)
        #--------------------------------------------------------------------------
        def update_item
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to item command window
            @item_window.active = false
            @help_window.active = false
            if LegACy::ITEM_GROUPING
              @itemcommand_window.active = true
            else
              @command_window.active = true
            end        
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Get currently selected data on the item window
            @item = @item_window.item
            # If not a use item
            unless @item.is_a?(RPG::Item)
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # If it can't be used
            unless $game_party.item_can_use?(@item.id)
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # If effect scope is an ally
            if @item.scope >= 3
              # Activate target window
              @item_window.active = false
              @targetactive = true
              @actor_window.active = true
              # Set cursor position to effect scope (single / all)
              if @item.scope == 4 || @item.scope == 6
                @actor_window.index = -1
              else
                @actor_window.index = 0
              end
            # If effect scope is other than an ally
            else
              # If command event ID is valid
              if @item.common_event_id > 0
                # Command event call reservation
                $game_temp.common_event_id = @item.common_event_id
                # Play item use SE
                $game_system.se_play(@item.menu_se)
                # If consumable
                if @item.consumable
                  # Decrease used items by 1
                  $game_party.lose_item(@item.id, 1)
                  # Draw item window item
                  @item_window.draw_item(@item_window.index)
                end
                # Switch to map screen
                $scene = Scene_Map.new
                return
              end
            end
            return
          end
        end    
        #--------------------------------------------------------------------------
        # * Frame Update (if skill window is active)
        #--------------------------------------------------------------------------
        def update_skill
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to main command menu
            @skill_window.active = false
            @help_window.active = false
            @actor_window.active = true
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Get currently selected data on the skill window
            @skill = @skill_window.skill
            # If unable to use
            if @skill == nil or not @actor.skill_can_use?(@skill.id)
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # If effect scope is ally
            if @skill.scope >= 3
              # Activate target window
              @skill_window.active = false
              @targetactive = true
              @actor_window.active = true
              # Set cursor position to effect scope (single / all)
              if @skill.scope == 4 || @skill.scope == 6
                @actor_window.index = -1
              elsif @skill.scope == 7
                @actor_index = @actor_window.index
                @actor_window.index = @actor_index - 10
              else
                @actor_window.index = 0
              end
            # If effect scope is other than ally
            else
              # If common event ID is valid
              if @skill.common_event_id > 0
                # Common event call reservation
                $game_temp.common_event_id = @skill.common_event_id
                # Play use skill SE
                $game_system.se_play(@skill.menu_se)
                # Use up SP
                @actor.sp -= @skill.sp_cost
                # Remake each window content
                @actor_window.refresh
                @skill_window.refresh
                # Switch to map screen
                $scene = Scene_Map.new
                return
              end
            end
            return
          end
          if @skill_window.height == 240 && LegACy::ABS
            if Kboard.keyboard($R_Key_H)
              $game_system.se_play($data_system.decision_se)
              $ABS.skill_key[1] = @skill_window.skill.id
              @hotkey_window.refresh 
              return
            end
            if Kboard.keyboard($R_Key_J)
              $game_system.se_play($data_system.decision_se)
              $ABS.skill_key[2] = @skill_window.skill.id
              @hotkey_window.refresh 
              return
            end
            if Kboard.keyboard($R_Key_K)
              $game_system.se_play($data_system.decision_se)
              $ABS.skill_key[3] = @skill_window.skill.id
              @hotkey_window.refresh 
              return
            end
            if Kboard.keyboard($R_Key_L)
              $game_system.se_play($data_system.decision_se)
              $ABS.skill_key[4] = @skill_window.skill.id
              @hotkey_window.refresh 
              return
            end
          end
          if LegACy::PREXUS
            if Input.trigger?(Input::X)
              skill = @skill_window.skill
              unless $ABS.player.abs.hot_key[0] or 
                     $ABS.player.abs.hot_key.include?(skill.id)
                $ABS.player.abs.hot_key[0] = skill.id
              end
              @skill_window.refresh
              return
            end
            if Input.trigger?(Input::Y)
              skill = @skill_window.skill
              unless $ABS.player.abs.hot_key[1] or 
                     $ABS.player.abs.hot_key.include?(skill.id)
                $ABS.player.abs.hot_key[1] = skill.id
              end
              @skill_window.refresh
              return
            end
            if Input.trigger?(Input::Z)
              skill = @skill_window.skill
              unless $ABS.player.abs.hot_key[2] or 
                     $ABS.player.abs.hot_key.include?(skill.id)
                $ABS.player.abs.hot_key[2] = skill.id
              end
              @skill_window.refresh
              return
            end
            if Input.trigger?(Input::A)
              skill = @skill_window.skill
              for i in 0..$ABS.player.abs.hot_key.size
                skillX = $ABS.player.abs.hot_key[i]
                next unless skillX
                $ABS.player.abs.hot_key[i] = nil if skill.id == skillX
              end
              @skill_window.refresh
              return
            end
          end      
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when target window is active)
        #--------------------------------------------------------------------------
        def update_target
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # If unable to use because items ran out
            @actor_window.index = 0
            if @command_window.index == 0 
                # Remake item window contents
                @item_window.refresh
                @item_window.active = true
                @actor_window.active = false
            end
            if @command_window.index == 3
              # Remake skill window contents
              @skill_window.refresh
              @skill_window.active = true
              @actor_window.active = false
              @skill_window.update_actor($game_party.actors[0])
            end
            @targetactive = false
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            if @command_window.index == 0
              # If items are used up
              if $game_party.item_number(@item.id) == 0
                # Play buzzer SE
                $game_system.se_play($data_system.buzzer_se)
                return
              end
              # If target is all
              if @actor_window.index == -1
                # Apply item effects to entire party
                used = false
                for i in $game_party.actors
                  used |= i.item_effect(@item)
                end
              end
              # If single target
              if @actor_window.index >= 0
                # Apply item use effects to target actor
                target = $game_party.actors[@actor_window.index]
                used = target.item_effect(@item)
              end
              # If an item was used
              if used
                # Play item use SE
                $game_system.se_play(@item.menu_se)
                # If consumable
                if @item.consumable
                  # Decrease used items by 1
                  $game_party.lose_item(@item.id, 1)
                  # Redraw item window item
                  @item_window.draw_item(@item_window.index)
                end
                # Remake target window contents
                @actor_window.refresh
                @status_window.refresh
                # If all party members are dead
                if $game_party.all_dead?
                  @targetactive = false
                  # Switch to game over screen
                  $scene = Scene_Gameover.new
                  return
                end
                # If common event ID is valid
                if @item.common_event_id > 0
                  # Common event call reservation
                  $game_temp.common_event_id = @item.common_event_id
                  @targetactive = false
                  # Switch to map screen
                  $scene = Scene_Map.new
                  return
                end
              end
              # If item wasn't used
              unless used
                # Play buzzer SE
                $game_system.se_play($data_system.buzzer_se)
              end
              return
            end
            if @command_window.index == 3
              # If unable to use because SP ran out
              unless @actor.skill_can_use?(@skill.id)
                # Play buzzer SE
                $game_system.se_play($data_system.buzzer_se)
                return
              end
              # If target is all
              if @actor_window.index == -1
                # Apply skill use effects to entire party
                used = false
                for i in $game_party.actors
                  used |= i.skill_effect(@actor, @skill)
                end
              end
              # If target is user
              if @actor_window.index <= -2
                # Apply skill use effects to target actor
                target = $game_party.actors[@actor_window.index + 10]
                used = target.skill_effect(@actor, @skill)
              end
              # If single target
              if @actor_window.index >= 0
                # Apply skill use effects to target actor
                target = $game_party.actors[@actor_window.index]
                used = target.skill_effect(@actor, @skill)
              end
              # If skill was used
              if used
                # Play skill use SE
                $game_system.se_play(@skill.menu_se)
                # Use up SP
                @actor.sp -= @skill.sp_cost
                # Remake each window content
                @actor_window.refresh
                @skill_window.refresh
                # If entire party is dead
                if $game_party.all_dead?
                  # Switch to game over screen
                  @targetactive = false
                  $scene = Scene_Gameover.new
                  return
                end
                # If command event ID is valid
                if @skill.common_event_id > 0
                  # Command event call reservation
                  $game_temp.common_event_id = @skill.common_event_id
                  @targetactive = false
                  # Switch to map screen
                  $scene = Scene_Map.new
                  return
                end
              end
              # If skill wasn't used
              unless used
                # Play buzzer SE
                $game_system.se_play($data_system.buzzer_se)
              end
              return
            end
          end      
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when equip window is active)
        #--------------------------------------------------------------------------
        def update_equip
          @equipstat_window.mode = @equip_window.index
          @equipitem_window.update_equipment(@equip_window.index)
          @equipstat_window.refresh
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            @status_window.refresh
            # Switch to menu screen
            @equip_window.active = false
            @help_window.active = false
            @actor_window.active = true
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # If equipment is fixed
            if @actor.equip_fix?(@equip_window.index)
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Activate item window
            @equip_window.active = false
            @equipitem_window.active = true
            @equipitem_window.index = 0
            return
          end
          # If Shift button was pressed
          if Input.trigger?(Input::SHIFT) && LegACy::EXTRA_EQUIP        
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Activate item window
            @equip_window.active = false
            @equipenhanced_window.active = true
            @equipenhanced_window.index = 0
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when equipment item window is active)
        #--------------------------------------------------------------------------
        def update_equipment    
          # Get currently item      
          item1 = @equip_window.item
          item2 = @equipitem_window.item
          last_hp = @actor.hp
          last_sp = @actor.sp
          old_atk = @actor.atk
          old_pdef = @actor.pdef
          old_mdef = @actor.mdef
          old_str = @actor.str
          old_dex = @actor.dex
          old_agi = @actor.agi
          old_int = @actor.int
          old_eva = @actor.eva
          @actor.equip(@equip_window.index, item2 == nil ? 0 : item2.id)
          # Get parameters for after equipment change
          new_atk = @actor.atk
          new_pdef = @actor.pdef
          new_mdef = @actor.mdef
          new_str = @actor.str
          new_dex = @actor.dex
          new_agi = @actor.agi
          new_int = @actor.int
          new_eva = @actor.eva
          @equipstat_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
          @equipstat_window.changes[0] = new_atk > old_atk ? 1 : @equipstat_window.changes[0]
          @equipstat_window.changes[0] = new_atk < old_atk ? -1 : @equipstat_window.changes[0]
          @equipstat_window.changes[1] = new_pdef > old_pdef ? 1 : @equipstat_window.changes[1]
          @equipstat_window.changes[1] = new_pdef < old_pdef ? -1 : @equipstat_window.changes[1]
          @equipstat_window.changes[2] = new_mdef > old_mdef ? 1 : @equipstat_window.changes[2]
          @equipstat_window.changes[2] = new_mdef < old_mdef ? -1 : @equipstat_window.changes[2]
          @equipstat_window.changes[3] = new_str > old_str ? 1 : @equipstat_window.changes[3]
          @equipstat_window.changes[3] = new_str < old_str ? -1 : @equipstat_window.changes[3]
          @equipstat_window.changes[4] = new_dex > old_dex ? 1 : @equipstat_window.changes[4]
          @equipstat_window.changes[4] = new_dex < old_dex ? -1 : @equipstat_window.changes[4]
          @equipstat_window.changes[5] = new_agi > old_agi ? 1 : @equipstat_window.changes[5]
          @equipstat_window.changes[5] = new_agi < old_agi ? -1 : @equipstat_window.changes[5]
          @equipstat_window.changes[6] = new_int > old_int ? 1 : @equipstat_window.changes[6]
          @equipstat_window.changes[6] = new_int < old_int ? -1 : @equipstat_window.changes[6]
          @equipstat_window.changes[7] = new_eva > old_eva ? 1 : @equipstat_window.changes[7]
          @equipstat_window.changes[7] = new_eva < old_eva ? -1 : @equipstat_window.changes[7]
          # Return equipment             
          @actor.equip(@equip_window.index, item1 == nil ? 0 : item1.id)
          @actor.hp = last_hp
          @actor.sp = last_sp
          elem_text = ""
          stat_text = ""
          if item2.is_a?(RPG::Weapon)        
            flag = false
            for i in item2.element_set
              next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
                  i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
                  i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
              elem_text += ", " if flag  
              elem_text += $data_system.elements[i]
              flag = true
            end        
            flag = false
            for i in item2.plus_state_set
              stat_text += ", " if flag
              stat_text += $data_states[i].name
              flag = true
            end
          end
          if item2.is_a?(RPG::Armor)
            flag = false
            for i in item2.guard_element_set
             next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
                  i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
                  i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
              elem_text += ", " if flag
              elem_text += $data_system.elements[i]
              flag = true
            end
            flag = false
            for i in item2.guard_state_set
              stat_text += ", " if flag
              stat_text += $data_states[i].name
              flag = true
            end
          end
          # Draw in left window
          @equipstat_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
            new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)        
            # Erase parameters for after equipment change
            @equipstat_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil, '', '')
            # Activate right window
            @equip_window.active = true
            @equipitem_window.active = false
            @equipitem_window.index = -1
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Play equip SE
            $game_system.se_play($data_system.equip_se)
            # Get currently selected data on the item window
            item = @equipitem_window.item
            # Change equipment
            @actor.equip(@equip_window.index, item == nil ? 0 : item.id)
            # Erase parameters for after equipment change
            @equipstat_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil, '', '')
            # Activate right window
            @equip_window.active = true
            @equipitem_window.active = false
            @equipitem_window.index = -1
            # Remake right window and item window contents
            @equip_window.refresh
            @equipitem_window.refresh
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when enhnaced equip window is active)
        #--------------------------------------------------------------------------
        def update_extraequip
          # If B button was pressed
          if Input.trigger?(Input::B) || Input.trigger?(Input::SHIFT)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to menu screen
            @equipenhanced_window.active = false
            @equip_window.active = true
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            $game_system.se_play($data_system.equip_se)
            case @equipenhanced_window.index
            when 0
              for i in 0..4
                @actor.equip(i, 0) unless @actor.equip_fix?(i)
                next if @actor.equip_fix?(i)
                case i
                when 0 
                  weapons = []
                  weapon_set = $data_classes[@actor.class_id].weapon_set
                  for j in 1...$data_weapons.size
                    if $game_party.weapon_number(j) > 0 && weapon_set.include?(j)
                      weapons.push($data_weapons[j])
                    end
                  end
                  next if weapons == []
                  weapons = weapons.reverse
                  strongest_weapon = weapons[0]
                  for weapon in weapons
                    strongest_weapon = weapon if strongest_weapon.atk < weapon.atk
                  end           
                  @actor.equip(0, strongest_weapon.id)
                when 1..4  
                  armors = []
                  armor_set = $data_classes[@actor.class_id].armor_set
                  for j in 1...$data_armors.size
                    if $game_party.armor_number(j) > 0 && armor_set.include?(j)
                      if $data_armors[j].kind == i - 1
                        armors.push($data_armors[j])
                      end
                    end
                  end
                  next if armors == []
                  armors = armors.reverse
                  strongest_armor = armors[0]
                  for armor in armors
                    strongest_armor = armor if strongest_armor.pdef < armor.pdef
                  end
                  @actor.equip(i, strongest_armor.id)
                end
              end      
            when 1
              for j in 0..4
                @actor.equip(j, 0) unless @actor.equip_fix?(j)
              end
            end
            @equip_window.refresh
            @equipitem_window.refresh
            @equipstat_window.refresh
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when status window is active)
        #--------------------------------------------------------------------------
        def update_playerstatus
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to menu screen
            @playerstatus_window.active = false
            @actor_window.active = true
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when save window is active)
        #--------------------------------------------------------------------------
        def update_save
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to menu screen
            @file_window.active = false
            @command_window.active = true
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            $game_system.se_play($data_system.save_se)
            file = File.open("Save#{@file_window.index + 1}.rxdata", "wb")
            characters = []
            for i in 0...$game_party.actors.size
              actor = $game_party.actors[i]
              characters.push([actor.character_name, actor.character_hue])
            end
            Marshal.dump(characters, file)
            Marshal.dump(Graphics.frame_count, file)
            $game_system.save_count += 1
            $game_system.magic_number = $data_system.magic_number
            Marshal.dump($game_system, file)
            Marshal.dump($game_switches, file)
            Marshal.dump($game_variables, file)
            Marshal.dump($game_self_switches, file)
            Marshal.dump($game_screen, file)
            Marshal.dump($game_actors, file)
            Marshal.dump($game_party, file)
            Marshal.dump($game_troop, file)
            Marshal.dump($game_map, file)
            Marshal.dump($game_player, file)
            Marshal.dump($ams, file) if LegACy::AMS
            Marshal.dump($ABS, file) if LegACy::PREXUS
            Marshal.dump($game_allies, file) if LegACy::ABS
            file.close
            @file_window.refresh
            @filestatus_window.refresh
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (when status window is active)
        #--------------------------------------------------------------------------
        def update_status
          @actor = $game_party.actors[@actor_window.index]      
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            if @old_actor == nil
              @command_window.active = true
              @actor_window.active = false
              if @actor_window.party
                for i in 4...$game_party.actors.size
                  unless $game_party.reserve == []
                    $game_party.reserve[i - 4] = $game_party.actors[4]
                    $game_party.actors.delete($game_party.actors[4])
                  end
                end
                @actor_window.party = false
                @actor_window.refresh
              end
              @actor_window.index = -1
            else
              @old_actor = nil
            end  
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            if @actor_window.party == false
              # Branch by command window cursor position
              case @command_window.index
              when 1  # equipment
                # Play decision SE
                $game_system.se_play($data_system.decision_se)
                # Switch to skill screen
                @equip_window.active = true
                @equip_window.update_actor(@actor)
                @equipitem_window.update_actor(@actor)
                @equipstat_window.update_actor(@actor)
                @help_window.active = true
                @actor_window.active = false
              when 3  # skill
                
                # If this actor's action limit is 2 or more
                if $game_party.actors[@actor_window.index].restriction >= 2
                  # Play buzzer SE
                  $game_system.se_play($data_system.buzzer_se)
                  return
                end
                # Play decision SE
                $game_system.se_play($data_system.decision_se)
                # Switch to skill screen
                if LegACy::ABS
                  @actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
                end
                @skill_window.active = true
                @skill_window.index = 0
                @skill_window.update_actor(@actor)
                @help_window.active = true
                @actor_window.active = false
              when 4  # status
                # Play decision SE
                $game_system.se_play($data_system.decision_se)
                # Switch to status screen
                @playerstatus_window.active = true
                @playerstatus_window.update_actor(@actor)
                @actor_window.active = false
              end
              return
            else          
              # Play decision SE
              $game_system.se_play($data_system.decision_se)
              if @old_actor == nil
                @old_actor = @actor
              else
                $game_party.actors[$game_party.actors.index(@old_actor)] = $game_party.actors[@actor_window.index]
                $game_party.actors[@actor_window.index] = @old_actor
                @actor_window.refresh
                $game_player.refresh
                @old_actor = nil            
              end
              return
            end      
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update
        #--------------------------------------------------------------------------
        def update_end
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to menu screen
            @end_window.active = false
            @command_window.active = true
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Play decision SE
            $game_system.se_play($data_system.decision_se) 
            # Fade out BGM, BGS, and ME
            Audio.bgm_fade(800)
            Audio.bgs_fade(800)
            Audio.me_fade(800)      
            # Branch by command window cursor position
            case @end_window.index
            when 0  # to title
              # Switch to title screen
              $scene = Scene_Title.new
            when 1  # shutdown
              # Shutdown
              $scene = nil
            end
            return
          end
        end
      end
      
      #==============================================================================
      # ** Window_BattleStatus
      #------------------------------------------------------------------------------
      #  This window displays the status of all party members on the battle screen.
      #==============================================================================
      if LegACy::BATTLE_BAR
        class Window_BattleStatus < Window_Base   
          #--------------------------------------------------------------------------
          # * Refresh
          #--------------------------------------------------------------------------
          def refresh
            self.contents.clear
            @item_max = $game_party.actors.size
            for i in 0...$game_party.actors.size
              actor = $game_party.actors[i]
              actor_x = i * 160 + 4
              draw_actor_name(actor, actor_x, 0)
              draw_LegACy_bar(actor, actor_x - 4, 46, 'hp', 120)
              draw_LegACy_bar(actor, actor_x - 4, 76, 'sp', 120)
              if @level_up_flags[i]
                self.contents.font.color = normal_color
                self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
              else
                draw_actor_state(actor, actor_x, 96)
              end
            end
          end
        end
        
        #==============================================================================
        # ** Scene_Load
        #------------------------------------------------------------------------------
        #  This class performs load screen processing.
        #==============================================================================
        class Scene_Load
          #--------------------------------------------------------------------------
          # * Object Initialization
          #     help_text : text string shown in the help window
          #--------------------------------------------------------------------------
          def initialize
            $game_temp = Game_Temp.new
            $game_temp.last_file_index = 0
            latest_time = Time.at(0)
            for i in 0..LegACy::SAVE_NUMBER
              filename = "Save#{i + 1}.rxdata"
              if FileTest.exist?(filename)
                file = File.open(filename, "r")
                if file.mtime > latest_time
                  latest_time = file.mtime
                  $game_temp.last_file_index = i
                end
                file.close
              end
            end
          end
          #--------------------------------------------------------------------------
          # * Main Processing
          #--------------------------------------------------------------------------
          def main
            @help_window = Window_Help.new
            @help_window.set_text("Select a file to load.")
            @file_window = Window_File.new
            @file_window.y = 64
            @file_window.height = 416
            @file_window.active = true
            @status_window = Window_FileStatus.new(@file_window)
            @status_window.x = 320
            @status_window.y = 64
            @status_window.height = 416
            Graphics.transition
            loop do
              Graphics.update
              Input.update
              update
              if $scene != self
                break
              end
            end
            Graphics.freeze
            @help_window.dispose
            @file_window.dispose
            @status_window.dispose
          end
          #--------------------------------------------------------------------------
          # * Frame Update
          #--------------------------------------------------------------------------
          def update
            @help_window.update
            @file_window.update
            @status_window.update
            # If C button was pressed
            if Input.trigger?(Input::C)
              unless FileTest.exist?(filename)
                $game_system.se_play($data_system.buzzer_se)
                return
              end
              $game_system.se_play($data_system.load_se)
              file = File.open(filename, "rb")
              read_save_data(file)
              file.close
              $game_system.bgm_play($game_system.playing_bgm)
              $game_system.bgs_play($game_system.playing_bgs)
              $game_map.update
              $scene = Scene_Map.new
              $game_temp.last_file_index = @file_index
              return
            end
            # If B button was pressed
            if Input.trigger?(Input::B)
              $game_system.se_play($data_system.cancel_se)
              $scene = Scene_Title.new
              return
            end
          end
          #--------------------------------------------------------------------------
          # * Read Save Data
          #     file : file object for reading (opened)
          #--------------------------------------------------------------------------
          def read_save_data(file)
            # Read character data for drawing save file
            characters = Marshal.load(file)
            # Read frame count for measuring play time
            Graphics.frame_count = Marshal.load(file)
            # Read each type of game object
            $game_system        = Marshal.load(file)
            $game_switches      = Marshal.load(file)
            $game_variables     = Marshal.load(file)
            $game_self_switches = Marshal.load(file)
            $game_screen        = Marshal.load(file)
            $game_actors        = Marshal.load(file)
            $game_party         = Marshal.load(file)
            $game_troop         = Marshal.load(file)
            $game_map           = Marshal.load(file)
            $game_player        = Marshal.load(file)
            # If magic number is different from when saving
            # (if editing was added with editor)
            if $game_system.magic_number != $data_system.magic_number
              # Load map
              $game_map.setup($game_map.map_id)
              $game_player.center($game_player.x, $game_player.y)
            end
            # Refresh party members
            $game_party.refresh
          end
        end
        #--------------------------------------------------------------------------
        # ? return the selected file's name
        #--------------------------------------------------------------------------
        def filename
          return "Save#{@file_window.index + 1}.rxdata"
        end    
      end
    
    Để có thể hiển thị Icon bạn cần có những Icon sau .Hãy lưu lại trong thư mục Graphics/Icons đấy nhé :
    [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]
    [​IMG][​IMG][​IMG][​IMG][​IMG][​IMG]
    #Lưu ý:Đây là bài ngộ lấy bên nước ngoài về cho anh em#
    Để khỏi thắc mắc về việc đưa Item vào các chuyên mục chia nhỏ trong phần Item của Menu như (Recovery ,Weapon , Armor ...)Nay xin đưa lên cùng với bài post cho tiện việc tra cứu .
    Bây giờ hãy vô phần Database và tạo thêm 6 thuộc tính mới vào ô Element (Góc bên duới phía bên trái )
    Tạo thuộc tính sau :
    ::17 #Recorvery
    ::18 #Weaponry
    ::19 #Armor
    ::20 #Accessories
    ::21 #Key Items - Event
    ::22 #Miscellanous Items
    Sau khi tạo thuộc tính thì ta vào các Item ở phần Item Weapon và Armor mà xếp theo đúng nhóm .Các bạn có thể làm 1 Item ở trong nhiều nhóm khác nhau .
    Để dễ hiểu tui sẽ làm 1 vd:
    Sau khi tạo xong 6 thuốc tính nếu trên tui vào phần Item của Database và chọn "001 :Potion" và tui check vào ô thuộc tính (Elêment ) "::17" khi đó thì Potion sẽ có thuộc tính 17 của Recovery nên có thể xuất hiện trong phần Recover của Menu
     
  4. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Khung ẩn thì tui hông nói nhưng ông kiếm được cái ngôi sao 6 cánh nói về thuộc tính hông ??Mà quả thật nó đẹp lắm chứ bộ
     
  5. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Tiếp tục là script .Nếu bạn nào đã từng chơi các Game online nhập vai như Mu ,Ragnarok ,Võ lâm truyền kì vân vân và vân vân .Thì chắc hẳn các bạn đã quá quen thuộc đối với cách tăng Point sau khi lvl up .Và đó kông còn là điều mới lạ nữa trong rpg .Hãy chép Script này bên trên Main và hãy thưởng thức nó:
    Mã:
    #--Res Text
    #=====================================================
    # Drago del fato's Level Up Point Spend System
    # ---------------------------------------------
    # Written by Drago del Fato
    # Version 2.4
    # Just insert a new script above main and call it whatever you want.
    #=====================================================
    
    #--Res Text
    PSPEND_LVUPTEXT = "Skill Points available"
    PSPEND_SPTEXT = "Skill Points"
    PSPEND_ANSWERS = ["Use","Dont Use Now"]
    PSPEND_HELP_TEXT = ["Change Strength...","Change Agility...",
    "Change Dexterity...","Change Inteligence...","Change Maximum Health Points...",
    "Change Maximum Skill Points...","Reset all Values to Normal...","Finnish Editing...."]
    PSPEND_B1 = "Reset"
    PSPEND_B2 = "Done!"
    LVUP_TEXT = "(Lv Up!)"
    DESC_TEXT = "LEFT - Decrease, RIGHT - Increase,C - Confirm,B - Exit"
    
    #-- Other Res
    SPADD = 8
    
    AGILITY_ADD = 1
    DEXTERITY_ADD = 1
    INTELIGENCE_ADD = 1
    STRENGTH_ADD = 1
    HP_ADD = 4
    SP_ADD = 3
    
    
    
    #-- If you aren't experienced scripter then don't change lines below!!!
    
    #--Global Variables
    $PSPEND_POINTS = []
    $PSPEND_ACTORS = []
    $PSPEND_ADD = [1,1,1,1,1,1]
    $PSPEND_ATTR = [1,1,1,1,1,1]
    $PSPEND_RET = 0
    
    #== Part One - Class for Setting and Getting Attributes from Actors
    
    class PSPEND_GET_SET_ACTOR_ATRIBUTTES
    def initialize(type)
    if !$BTEST
    case type
    when 0
    return
    when 1
    get_attributes
    when 2
    set_attributes
    end
    end
    end
    
    def get_attributes(actorid)
    @actor = $game_actors[actorid]
    $PSPEND_ATTR[1] = @actor.str
    $PSPEND_ATTR[2] = @actor.agi
    $PSPEND_ATTR[3] = @actor.dex
    $PSPEND_ATTR[4] = @actor.int
    $PSPEND_ATTR[5] = @actor.maxhp
    $PSPEND_ATTR[6] = @actor.maxsp
    end
    
    def set_attributes(actorid)
    @actor = $game_actors[actorid]
    @actor.str = $PSPEND_ATTR[1]
    @actor.agi = $PSPEND_ATTR[2]
    @actor.dex = $PSPEND_ATTR[3]
    @actor.int = $PSPEND_ATTR[4]
    @actor.maxhp = $PSPEND_ATTR[5]
    @actor.maxsp = $PSPEND_ATTR[6]
    end
    
    end
    
    #-- End of Part One
    
    #-- Part Two - Disabling actor attributes so that they have same attributes at the next level!
    
    class Game_Actor
    
    def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
    $actor_attr.get_attributes(@actor_id)
    @level += 1
    $actor_attr.set_attributes(@actor_id)
    $PSPEND_POINTS[@actor_id - 1] += SPADD
    $PSPEND_ACTORS[@actor_id - 1] = true
    for j in $data_classes[@class_id].learnings
    if j.level == @level
    learn_skill(j.skill_id)
    end
    end
    end
    while @exp < @exp_list[@level]
    $actor_attr.get_attributes(@actor_id)
    @level -= 1
    $actor_attr.set_attributes(@actor_id)
    $PSPEND_ACTORS[@actor_id - 1] = false
    end
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
    end
    
    def level=(level)
    if level < self.level
    $actor_attr.get_attributes(@actor_id)
    level = [[level, $data_actors[@actor_id].final_level].min, 1].max
    $actor_attr.set_attributes(@actor_id)
    $PSPEND_ACTORS[@actor_id - 1] = false
    self.exp = @exp_list[level]
    return
    end
    $actor_attr.get_attributes(@actor_id)
    level = [[level, $data_actors[@actor_id].final_level].min, 1].max
    $actor_attr.set_attributes(@actor_id)
    $PSPEND_POINTS[@actor_id - 1] += SPADD
    $PSPEND_ACTORS[@actor_id - 1] = true
    self.exp = @exp_list[level]
    return
    end
    end
    
    #-- End of Part Two
    
    #-- Part Three - Telling Scene Title that it's time to go to shop (just kidding...).
    # Changing the code so that some other variables will be added...
    
    class Scene_Title
    
    def command_new_game
    $game_system.se_play($data_system.decision_se)
    
    Audio.bgm_stop
    
    Graphics.frame_count = 0
    $game_temp = Game_Temp.new
    $game_system = Game_System.new
    $game_switches = Game_Switches.new
    $game_variables = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen = Game_Screen.new
    $game_actors = Game_Actors.new
    $game_party = Game_Party.new
    $game_troop = Game_Troop.new
    $game_map = Game_Map.new
    $game_player = Game_Player.new
    #edit
    $actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
    for i in 0..$data_actors.size - 2
    $PSPEND_ACTORS.push(false)
    $PSPEND_POINTS.push(0)
    end
    #end edit
    $game_party.setup_starting_members
    $game_map.setup($data_system.start_map_id)
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    
    
    $game_map.autoplay
    $game_map.update
    $scene = Scene_Map.new
    end
    
    def battle_test
    
    
    $data_actors = load_data("Data/BT_Actors.rxdata")
    $data_classes = load_data("Data/BT_Classes.rxdata")
    $data_skills = load_data("Data/BT_Skills.rxdata")
    $data_items = load_data("Data/BT_Items.rxdata")
    $data_weapons = load_data("Data/BT_Weapons.rxdata")
    $data_armors = load_data("Data/BT_Armors.rxdata")
    $data_enemies = load_data("Data/BT_Enemies.rxdata")
    $data_troops = load_data("Data/BT_Troops.rxdata")
    $data_states = load_data("Data/BT_States.rxdata")
    $data_animations = load_data("Data/BT_Animations.rxdata")
    $data_tilesets = load_data("Data/BT_Tilesets.rxdata")
    $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
    $data_system = load_data("Data/BT_System.rxdata")
    
    Graphics.frame_count = 0
    
    
    $game_temp = Game_Temp.new
    $game_system = Game_System.new
    $game_switches = Game_Switches.new
    $game_variables = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen = Game_Screen.new
    $game_actors = Game_Actors.new
    $game_party = Game_Party.new
    $game_troop = Game_Troop.new
    $game_map = Game_Map.new
    $game_player = Game_Player.new
    #edit
    $actor_attr = PSPEND_GET_SET_ACTOR_ATRIBUTTES.new(0)
    for i in 0..$data_actors.size - 2
    $PSPEND_ACTORS.push(false)
    $PSPEND_POINTS.push(0)
    end
    #end edit
    $game_party.setup_battle_test_members
    $game_temp.battle_troop_id = $data_system.test_troop_id
    $game_temp.battle_can_escape = true
    $game_map.battleback_name = $data_system.battleback_name
    
    
    $game_system.se_play($data_system.battle_start_se)
    $game_system.bgm_play($game_system.battle_bgm)
    
    $scene = Scene_Battle.new
    end
    end
    
    #End of Part Three
    
    #Mid Part - Adding Draw Actor Battler
    
    class Window_Base < Window
    
    def draw_actor_battler(actor, x, y)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    cw =bitmap.width
    ch = bitmap.height
    src_rect = Rect.new(0, 0, cw,ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
    end
    
    def draw_actor_name(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 120, 32, actor.name)
    cx = self.contents.text_size(actor.name).width
    if $PSPEND_ACTORS[actor.id - 1]
    self.contents.font.color = crisis_color
    self.contents.draw_text(x + cx, y, 90, 32, " " + LVUP_TEXT)
    end
    self.contents.font.color = normal_color
    end
    
    end
    
    #End of Mid Part
    
    #Part Four - The Hard one! Making Custom Windows
    
    class PSPEND_CUSTOM_WINDOW < Window_Selectable
    
    def initialize(winactorid)
    super(0, 64, 640, 480 - 64)
    commands = [1,2,3,4,5,6,7,8]
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32,height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    @actor = $game_actors[winactorid + 1]
    @y = 10
    $PSPEND_RET = $PSPEND_POINTS[@actor.id - 1]
    refresh(true)
    self.index = 0
    end
    
    def refresh(ret = false)
    self.contents.clear
    @y = 10
    if ret
    $PSPEND_ADD[1] = @actor.str
    $PSPEND_ADD[2] = @actor.agi
    $PSPEND_ADD[3] = @actor.dex
    $PSPEND_ADD[4] = @actor.int
    $PSPEND_ADD[5] = @actor.maxhp
    $PSPEND_ADD[6] = @actor.maxsp
    $PSPEND_POINTS[@actor.id - 1] = $PSPEND_RET
    ret = false
    end
    draw_actor_battler(@actor,20 + 100,@y + 200)
    draw_actor_name(@actor,20 + 32,@y + 220)
    cx = self.contents.text_size(PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s).width
    self.contents.draw_text(52,@y + 252,cx,32,PSPEND_SPTEXT + $PSPEND_POINTS[@actor.id - 1].to_s)
    cx = self.contents.text_size(DESC_TEXT).width
    self.contents.draw_text(52,self.height - 32 - 40,cx,32,DESC_TEXT)
    @y += 150
    @x = 260
    
    for i in 0...@item_max
    draw_item(i, normal_color)
    end
    end
    
    def draw_item(index, color)
    if $PSPEND_POINTS[@actor.id - 1] <= 0
    self.contents.font.color = disabled_color
    else
    self.contents.font.color = color
    end
    rect = Rect.new(@x, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    case index
    when 0
    self.contents.draw_text(rect, $data_system.words.str)
    cx = self.contents.text_size(@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s).width
    self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.str.to_s + " > " + $PSPEND_ADD[1].to_s)
    when 1
    self.contents.draw_text(rect, $data_system.words.agi )
    cx = self.contents.text_size(@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s).width
    self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.agi.to_s + " > " + $PSPEND_ADD[2].to_s)
    when 2
    self.contents.draw_text(rect, $data_system.words.dex )
    cx = self.contents.text_size( @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s).width
    self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.dex.to_s + " > " + $PSPEND_ADD[3].to_s)
    
    when 3
    self.contents.draw_text(rect, $data_system.words.int )
    cx = self.contents.text_size(@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s).width
    self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.int.to_s + " > " + $PSPEND_ADD[4].to_s)
    
    when 4
    self.contents.draw_text(rect, $data_system.words.hp )
    cx = self.contents.text_size( @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s).width
    self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 , @actor.maxhp.to_s + " > " + $PSPEND_ADD[5].to_s)
    
    when 5
    self.contents.draw_text(rect, $data_system.words.sp )
    cx = self.contents.text_size(@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s).width
    self.contents.draw_text(self.width - 32 - cx,32 * index,cx ,32 ,@actor.maxsp.to_s + " > " + $PSPEND_ADD[6].to_s)
    
    when 6
    self.contents.font.color = color
    self.contents.draw_text(rect,PSPEND_B1)
    when 7
    self.contents.font.color = color
    self.contents.draw_text(rect,PSPEND_B2)
    end
    end
    
    def disable_item(index)
    draw_item(index, disabled_color)
    end
    
    def update_cursor_rect
    
    if @index < 0
    self.cursor_rect.empty
    return
    end
    
    row = @index / @column_max
    
    if row < self.top_row
    self.top_row = row
    end
    
    if row > self.top_row + (self.page_row_max - 1)
    self.top_row = row - (self.page_row_max - 1)
    end
    
    cursor_width = self.width / @column_max - 32
    
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 32 - self.oy
    
    self.cursor_rect.set(@x - 10, y, self.width - @x - 17, 32)
    end
    end
    
    #End of Part Four
    
    #Part Five - Making Scene_Status to show level up window when character
    #get's a new level
    
    class Scene_Status
    def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
    end
    
    def main
    @actor = $game_party.actors[@actor_index]
    $ACTORD = @actor
    @status_window = Window_Status.new(@actor)
    Graphics.transition
    if $PSPEND_ACTORS[@actor.id - 1]
    @h = Window_Help.new
    @h.set_text(PSPEND_LVUPTEXT)
    @h.y = 100
    @h.z = 9997
    @c = Window_Command.new(140,PSPEND_ANSWERS)
    @c.y = 170
    @c.x = 200
    @c.z = 9998
    loop do
    Graphics.update
    Input.update
    update_pspend_lvup_win
    
    if $scene != self
    break
    end
    end
    Graphics.freeze
    @h.z = 0
    @c.z = 1
    @status_window.z = 2
    @status_window.dispose
    @h.dispose
    @c.dispose
    return
    end
    loop do
    Graphics.update
    Input.update
    update
    if $scene != self
    break
    end
    end
    @status_window.dispose
    end
    
    def update_pspend_lvup_win
    @c.update
    if Input.trigger?(Input::B)
    $game_system.se_play($data_system.cancel_se)
    $PSPEND_ACTORS[@actor.id - 1] = false
    $scene = Scene_Menu.new
    return
    end
    if Input.trigger?(Input::C)
    case @c.index
    when 0
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_PSPEND_Main_Screen.new(@actor.id - 1)
    return
    when 1
    $game_system.se_play($data_system.cancel_se)
    $PSPEND_ACTORS[@actor.id - 1] = false
    $scene = Scene_Menu.new
    return
    end
    end
    end
    end
    
    #End of Part Five
    
    #Part Six - Hell is coming...AAAAAAAAH!
    
    class Scene_PSPEND_Main_Screen
    def initialize(actor_id_index)
    @actor_ind = actor_id_index
    main
    end
    
    def main
    @help = Window_Help.new
    @spend = PSPEND_CUSTOM_WINDOW.new(@actor_ind)
    @spend.y = 64
    @spend.z = 99998
    @help.z = 99998
    Graphics.transition
    loop do
    Graphics.update
    Input.update
    update_spend_help_win
    if $scene != self
    break
    end
    end
    Graphics.freeze
    @spend.dispose
    @help.dispose
    end
    
    def update_spend_help_win
    @spend.update
    @help.update
    @help.set_text(PSPEND_HELP_TEXT[@spend.index])
    if Input.trigger?(Input::B)
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Menu.new
    $PSPEND_POINTS[@actor_ind] = $PSPEND_RET
    $PSPEND_ACTORS[@actor_ind] = false
    return
    end
    if Input.repeat?(Input::RIGHT)
    unless $PSPEND_POINTS[@actor_ind] > 0
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $game_system.se_play($data_system.cursor_se)
    $PSPEND_POINTS[@actor_ind] -= 1
    case @spend.index
    when 0
    $PSPEND_ADD[1] += STRENGTH_ADD
    when 1
    $PSPEND_ADD[2] += AGILITY_ADD
    when 2
    $PSPEND_ADD[3] += DEXTERITY_ADD
    when 3
    $PSPEND_ADD[4] += INTELIGENCE_ADD
    when 4
    $PSPEND_ADD[5] += HP_ADD
    when 5
    $PSPEND_ADD[6] += SP_ADD
    when 6
    $PSPEND_POINTS[@actor_ind] += 1
    when 7
    $PSPEND_POINTS[@actor_ind] += 1
    end
    @spend.refresh
    return
    end
    
    
    if Input.repeat?(Input::LEFT)
    unless $PSPEND_POINTS[@actor_ind] < $PSPEND_RET
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $game_system.se_play($data_system.cursor_se)
    case @spend.index
    when 0
    if $PSPEND_ADD[1] <= $ACTORD.str
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $PSPEND_ADD[1] -= STRENGTH_ADD
    when 1
    if $PSPEND_ADD[2] <= $ACTORD.agi
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $PSPEND_ADD[2] -= AGILITY_ADD
    when 2
    if $PSPEND_ADD[3] <= $ACTORD.dex
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $PSPEND_ADD[3] -= DEXTERITY_ADD
    when 3
    if $PSPEND_ADD[4] <= $ACTORD.int
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $PSPEND_ADD[4] -= INTELIGENCE_ADD
    when 4
    if $PSPEND_ADD[5] <= $ACTORD.maxhp
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $PSPEND_ADD[5] -= HP_ADD
    when 5
    if $PSPEND_ADD[6] <= $ACTORD.maxsp
    $game_system.se_play($data_system.buzzer_se)
    return
    end
    $PSPEND_ADD[6] -= SP_ADD
    when 6
    $PSPEND_POINTS[@actor_ind] -= 1
    when 7
    $PSPEND_POINTS[@actor_ind] -= 1
    end
    $PSPEND_POINTS[@actor_ind] += 1
    @spend.refresh
    
    return
    end
    
    
    if Input.trigger?(Input::C)
    case @spend.index
    when 6
    @spend.refresh(true)
    when 7
    $ACTORD.str = $PSPEND_ADD[1]
    $ACTORD.agi = $PSPEND_ADD[2]
    $ACTORD.dex = $PSPEND_ADD[3]
    $ACTORD.int = $PSPEND_ADD[4]
    $ACTORD.maxhp = $PSPEND_ADD[5]
    $ACTORD.maxsp = $PSPEND_ADD[6]
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_Menu.new
    $PSPEND_ACTORS[@actor_ind] = false
    return
    end
    end
    end
    end
    
    #End of Part Six - Yipee!!! I made it!
    
    #Part Seven - Save Load part!
    
    class Scene_Save < Scene_File
    
    def write_save_data(file)
    
    characters = []
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    characters.push([actor.character_name, actor.character_hue])
    end
    
    Marshal.dump(characters, file)
    Marshal.dump(Graphics.frame_count, file)
    
    $game_system.save_count += 1
    $game_system.magic_number = $data_system.magic_number
    
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
    Marshal.dump($PSPEND_POINTS,file)
    Marshal.dump($PSPEND_ACTORS,file)
    Marshal.dump($actor_attr,file)
    end
    end
    
    # -- And now for the load screen
    
    class Scene_Load < Scene_File
    
    def read_save_data(file)
    
    characters = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    
    $game_system = Marshal.load(file)
    $game_switches = Marshal.load(file)
    $game_variables = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen = Marshal.load(file)
    $game_actors = Marshal.load(file)
    $game_party = Marshal.load(file)
    $game_troop = Marshal.load(file)
    $game_map = Marshal.load(file)
    $game_player = Marshal.load(file)
    $PSPEND_POINTS = Marshal.load(file)
    $PSPEND_ACTORS = Marshal.load(file)
    $actor_attr = Marshal.load(file)
    
    if $game_system.magic_number != $data_system.magic_number
    $game_map.setup($game_map.map_id)
    $game_player.center($game_player.x, $game_player.y)
    end
    
    $game_party.refresh
    end
    end
    
    #-- END OF SAVE AND LOAD SCREEN
    
    #-- END OF THE SCRIPT
    
    #=======================
    # Written by Drago del fato
    #=======================
    
    #Lưu ý:Đây là script của ngộ lấy bên nước ngoài vè chia sẽ cho anh em#
    #Anh Ken thông cảm cái này em hông có Screenhot#
     
  6. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Nhưng cái trên chỉ là tăng Point theo ý mình >Còn đây là script có thể hiển thị Point sau khi lvl up .Chép cái này lên trên Main và bên dưới Scene_Battle 4
    Mã:
    #================================================
    # Level Up Box
    #================================================
    #Version 3
    #By Akxiv
    #==============================================================================
    #Make Scene Battle
    #==============================================================================
    class Scene_Battle
    LEVEL_UP_SE = "" # Soundeffect for Level UP
    LEVEL_UP_ME = "Audio/ME/007-Fanfare01" # Audio Sound for Level UP
    end
    class Window_SkillLearning < Window_Base
    SKILLLEARN_SE = "Audio/SE/106-Heal02" # Soundeffect if Skill learning
    end
    #==============================================================================
    # Window_LevelUpWindow
    #------------------------------------------------------------------------------
    #==============================================================================
    class Window_LevelUpWindow < Window_Base
    #--------------------------------------------------------------------------
    def initialize(x, y, actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
    # super(x, y, 160, 192)
    super(x-x, y-64, 160, 192+64)
    
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
    self.back_opacity = 160
    refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
    end
    #--------------------------------------------------------------------------
    def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.font.size = 20
    self.contents.font.name = "Arial"
    self.contents.draw_text( 20, 0, 160, 24, "LEVEL UP!!")
    self.contents.font.size = 20
    self.contents.font.name = "Arial"
    self.contents.draw_text( 0, 28+64, 160, 24, $data_system.words.hp)
    self.contents.draw_text( 0, 50+64, 160, 24, $data_system.words.sp)
    self.contents.font.size = 20
    self.contents.font.name = "Arial"
    self.contents.draw_text( 0, 0+64, 80, 24, "Level")
    self.contents.draw_text( 0, 72+64, 80, 24, $data_system.words.str[0,3])
    self.contents.draw_text( 0, 94+64, 80, 24, $data_system.words.dex[0,3])
    self.contents.draw_text( 0, 116+64, 80, 24, $data_system.words.agi[0,3])
    self.contents.draw_text( 0, 138+64, 80, 24, $data_system.words.int[0,3])
    self.contents.draw_text(76, 0+64, 128, 24, "to")
    self.contents.draw_text(76, 28+64, 128, 24, "to")
    self.contents.draw_text(76, 50+64, 128, 24, "to")
    self.contents.draw_text(76, 72+64, 128, 24, "to")
    self.contents.draw_text(76, 94+64, 128, 24, "to")
    self.contents.draw_text(76, 116+64, 128, 24, "to")
    self.contents.draw_text(76, 138+64, 128, 24, "to")
    self.contents.font.size = 20
    self.contents.font.color = normal_color
    self.contents.draw_text( 0, 0+64, 72, 24, "" + (last_lv).to_s, 2)
    self.contents.draw_text( 0, 28+64, 72, 24, "" + up_hp.to_s, 2)
    self.contents.draw_text( 0, 50+64, 72, 24, "" + up_sp.to_s, 2)
    self.contents.draw_text( 0, 72+64, 72, 24, "" + up_str.to_s, 2)
    self.contents.draw_text( 0, 94+64, 72, 24, "" + up_dex.to_s, 2)
    self.contents.draw_text( 0, 116+64, 72, 24, "" + up_agi.to_s, 2)
    self.contents.draw_text( 0, 138+64, 72, 24, "" + up_int.to_s, 2)
    self.contents.font.size = 20
    self.contents.font.name = "Arial"
    self.contents.draw_text( 0, 0+64, 128, 24, actor.level.to_s, 2)
    self.contents.draw_text( 0, 26+64, 128, 24, actor.maxhp.to_s, 2)
    self.contents.draw_text( -40, 26, 128, 24, actor.name, 2)
    self.contents.draw_text( 0, 48+64, 128, 24, actor.maxsp.to_s, 2)
    self.contents.draw_text( 0, 70+64, 128, 24, actor.str.to_s, 2)
    self.contents.draw_text( 0, 92+64, 128, 24, actor.dex.to_s, 2)
    self.contents.draw_text( 0, 114+64, 128, 24, actor.agi.to_s, 2)
    self.contents.draw_text( 0, 136+64, 128, 24, actor.int.to_s, 2)
    end
    end
    #==============================================================================
    # ¡ Window_SkillLearning
    #==============================================================================
    class Window_SkillLearning < Window_Base
    #--------------------------------------------------------------------------
    attr_reader :learned 
    #--------------------------------------------------------------------------
    
    def initialize(class_id, last_lv, now_lv)
    super(160, 64-32, 320, 64)
    
    self.contents = Bitmap.new(width - 32, height - 28) 
    self.visible = false
    self.back_opacity = 160
    @learned = false
    refresh(class_id, last_lv, now_lv)
    end
    #--------------------------------------------------------------------------
    
    def refresh(class_id, last_lv, now_lv)
    for i in 0...$data_classes[class_id].learnings.size
    learn_lv = $data_classes[class_id].learnings[i].level
    if learn_lv > last_lv and learn_lv <= now_lv
    @learned = true
    if SKILLLEARN_SE != "" #SE for Skilllearning
    Audio.se_play(SKILLLEARN_SE)
    end
    skill_name = $data_skills[$data_classes[class_id].learnings[i].skill_id].name
    self.contents.clear
    self.contents.font.name = "Arial"
    self.contents.draw_text(0,0,448,32, skill_name + " learned !!") #Skillname and then your text (here is for example Cut learned !!)
    self.visible = true
    loop do
    Graphics.update
    Input.update
    update
    if @learned == false
    break
    end
    end
    end
    end
    end
    #--------------------------------------------------------------------------
    def update
    if Input.trigger?(Input::C)
    @learned = false
    self.visible = false
    end
    end
    end
    #==============================================================================
    # Window_BattleStatus
    #==============================================================================
    class Window_BattleStatus < Window_Base
    #--------------------------------------------------------------------------
    attr_accessor :level_up_flags # LEVEL UP!
    end
    #==============================================================================
    # Scene_Battle
    #==============================================================================
    class Scene_Battle
    #--------------------------------------------------------------------------
    alias xrxs_bp10_start_phase5 start_phase5
    def start_phase5
    xrxs_bp10_start_phase5
    @exp_gained = battle_exp
    for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
    if actor.cant_get_exp? == false
    last_level = actor.level
    actor.exp -= @exp_gained
    if actor.level < last_level
    @status_window.level_up_flags[i] = false
    end
    end
    end
    @exp_gain_actor = -1
    @result_window.visible = true
    end
    #--------------------------------------------------------------------------
    alias xrxs_bp10_update_phase5 update_phase5
    def update_phase5
    @level_up_phase_done = false if @level_up_phase_done != true
    if Input.trigger?(Input::C)
    @levelup_window.visible = false if @levelup_window != nil
    @status_window.level_up_flags[@exp_gain_actor] = false
    @level_up_phase_done = phase5_next_levelup
    end
    if @level_up_phase_done
    if @phase5_wait_count < 2
    @result_window.opacity = 0
    @result_window.back_opacity = 0
    @result_window.contents_opacity = 0
    end
    xrxs_bp10_update_phase5
    battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
    end
    end
    #--------------------------------------------------------------------------
    def phase5_next_levelup
    begin
    @exp_gain_actor += 1 
    if @exp_gain_actor >= $game_party.actors.size
    return true
    end
    actor = $game_party.actors[@exp_gain_actor]
    if actor.cant_get_exp? == false
    last_level = actor.level
    last_maxhp = actor.maxhp
    last_maxsp = actor.maxsp
    last_str = actor.str
    last_dex = actor.dex
    last_agi = actor.agi
    last_int = actor.int
    actor.exp += @exp_gained
    if actor.level > last_level
    @status_window.level_up(@exp_gain_actor)
    @result_window.visible = false
    if LEVEL_UP_SE != ""
    Audio.se_play(LEVEL_UP_SE)
    end
    if LEVEL_UP_ME != ""
    Audio.me_stop
    Audio.me_play(LEVEL_UP_ME)
    end
    actors_size = [$game_party.actors.size, 4].max
    x_shift = 160 + (640 - 160*actors_size)/(actors_size - 1)
    x = x_shift * @exp_gain_actor
    y = 128
    @levelup_window = Window_LevelUpWindow.new(x, y, actor, last_level,
    last_maxhp, last_maxsp, last_str,
    last_dex, last_agi, last_int)
    @levelup_window.visible = true
    @status_window.refresh
    @skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level)
    @phase5_wait_count = 40
    return false
    end
    end
    end until false
    end
    
    def battle_exp
    bexp = 0
    for enemy in $game_troop.enemies
    unless enemy.hidden
    bexp += enemy.exp
    end
    end
    return bexp
    end
    
    end
    Còn đây là Screenhot
     
  7. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Lâu quá mà chẳng ai post script nên chán post cái này cho anh em chơi .Nếu ai đã từng chơi qua FF X thì không thể bỏ qua phần này .Đây là script có cấu trúc của Sphere System :
    Hêre script :
    Mã:
    #==============================================================================
    # Sphere Grid System
    #==============================================================================
    # SephirothSpawn
    # Version 1
    # 1.20.06
    #==============================================================================
    
    #------------------------------------------------------------------------------
    # * SDK Log Script
    #------------------------------------------------------------------------------
    SDK.log('Sphere Grid System', 'SephirothSpawn', 1, '1.21.06')
    
    #------------------------------------------------------------------------------
    # * Begin SDK Enable Test
    #------------------------------------------------------------------------------
    
    if SDK.state('Sphere Grid System') == true
    
    #==============================================================================
    # ** Sphere Grid Sytem
    #==============================================================================
    
    module Sphere_Grid_System
      #--------------------------------------------------------------------------
      # * Constants
      #     sphere_type :[character_name, character_hue, direction, pattern]
      #--------------------------------------------------------------------------
      # When Spheres Locks
        HP_SPHERE_GRAPHIC_ON = ['178-Switch01', 150, 4, 0]
        SP_SPHERE_GRAPHIC_ON = ['178-Switch01', 210, 4, 0]
        STR_SPHERE_GRAPHIC_ON = ['178-Switch01', 30, 4, 0]
        DEX_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 1]
        AGI_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 0]
        INT_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 2]
        ABILITIY_SPHERE_GRAPHIC_ON = ['178-Switch01', 0, 4, 3]
        LOCKA_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
        LOCKB_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
        LOCKC_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
        LOCKD_GRAPHIC_ON = ['183-Rock02', 0, 4, 0]
      # When Spheres Unlocked
        HP_SPHERE_GRAPHIC_OFF = ['178-Switch01', 150, 8, 0]
        SP_SPHERE_GRAPHIC_OFF = ['178-Switch01', 210, 8, 0]
        STR_SPHERE_GRAPHIC_OFF = ['178-Switch01', 30, 8, 0]
        DEX_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 1]
        AGI_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 0]
        INT_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 2]
        ABILITIY_SPHERE_GRAPHIC_OFF = ['178-Switch01', 0, 8, 3]
        LOCKA_GRAPHIC_OFF = ['', 0, 8, 0]
        LOCKB_GRAPHIC_OFF = ['', 0, 8, 0]
        LOCKC_GRAPHIC_OFF = ['', 0, 8, 0]
        LOCKD_GRAPHIC_OFF = ['', 0, 8, 0]
    end
    
    #==============================================================================
    # ** Game_Temp
    #==============================================================================
    
    class Game_Temp
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :spheregrid_return_map_id
      attr_accessor :spheregrid_return_map_coordinates
      attr_accessor :spheregrid_return_actor_graphic
      attr_accessor :spheregrid_map_id
    end
    
    #==============================================================================
    # ** Game_Actor
    #==============================================================================
    
    class Game_Actor < Game_Battler
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :sphere_grid_event_list
      attr_accessor :sphere_grid_skills
      attr_accessor :sphere_grid_position
      attr_accessor :character_name
      attr_accessor :character_hue
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias seph_spheregridsystem_gameactor_init initialize
      alias seph_spheregridsystem_gameactor_skills skills
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(actor_id)
        # Orginal Initialization Method
        seph_spheregridsystem_gameactor_init(actor_id)
        # Sets Skill Grid Events List
        @sphere_grid_event_list = {}
        # Sets Skill Grid Skills
        @sphere_grid_skills = []
        # Sets Skill Grid Position
        @sphere_grid_position = [2, 1]
      end
      #--------------------------------------------------------------------------
      # * Gets Skills
      #--------------------------------------------------------------------------
      def skills
        # Adds Skill Grid Skills
        for id in @sphere_grid_skills
          learn_skill(id)
        end
        # Orginal Skills Method
        seph_spheregridsystem_gameactor_skills
      end
    end
    
    
    #==============================================================================
    # ** Game_Party
    #==============================================================================
    
    class Game_Party
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :sphere_grid_hp_spheres
      attr_accessor :sphere_grid_sp_spheres
      attr_accessor :sphere_grid_str_spheres
      attr_accessor :sphere_grid_dex_spheres
      attr_accessor :sphere_grid_agi_spheres
      attr_accessor :sphere_grid_int_spheres
      attr_accessor :sphere_grid_ability_spheres
      attr_accessor :sphere_grid_level_a_locks
      attr_accessor :sphere_grid_level_b_locks
      attr_accessor :sphere_grid_level_c_locks
      attr_accessor :sphere_grid_level_d_locks
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias seph_spheregridsystem_gameparty_init initialize
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        # Orginal Initialization Method
        seph_spheregridsystem_gameparty_init
        # Sets Skill Grid Spheres
        @sphere_grid_hp_spheres = 0
        @sphere_grid_sp_spheres = 0
        @sphere_grid_str_spheres = 0
        @sphere_grid_dex_spheres = 0
        @sphere_grid_agi_spheres = 0
        @sphere_grid_int_spheres = 0
        @sphere_grid_ability_spheres = 0
        @sphere_grid_level_a_locks = 0
        @sphere_grid_level_b_locks = 0
        @sphere_grid_level_c_locks = 0
        @sphere_grid_level_d_locks = 0
      end
    end
    
    #==============================================================================
    # ** Game_Map
    #==============================================================================
    
    class Game_Map
      #--------------------------------------------------------------------------
      # * Get RPG::Map
      #--------------------------------------------------------------------------
      def map
        return @map
      end
    end
    
    #==============================================================================
    # ** Game_Event
    #==============================================================================
    
    class Game_Event < Game_Character
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor :character_name
      attr_accessor :character_hue
      attr_accessor :direction
      attr_accessor :pattern
      attr_accessor :through
    end
    
    #==============================================================================
    # ** Game_Player
    #==============================================================================
    
    class Game_Player
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_accessor   :character_name
      attr_accessor   :character_hue
    end
    
    #==============================================================================
    # ** Scene_Title
    #==============================================================================
    
    class Scene_Title
      #--------------------------------------------------------------------------
      # * Alias Listings
      #--------------------------------------------------------------------------
      alias seph_spheregridsystem_scenetitle_commandnewgame command_new_game
      #--------------------------------------------------------------------------
      # * Command: New Game
      #--------------------------------------------------------------------------
      def command_new_game
        # Orignal Command: New Game
        seph_spheregridsystem_scenetitle_commandnewgame
        # Collects Map Data
        mapinfo = load_data("Data/MapInfos.rxdata")
        mapinfo.each {|map_id, map|
          # Finds Sphere Grid Map
          if map.name == 'Sphere Grid'
            # Collects Sphere Grid Map Data
            @skill_map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
            # Sets Sphere Grid Map Id
            $game_temp.spheregrid_map_id = map_id
          end }
        # Sphere Grid Events (For each actor access)
        grid_events = {}
        # Collects Events
        for event in @skill_map.events.values
          if event.name == 'Skill Grid Event'
            grid_events[event.id] = false
          end
        end
        # Sets All Actors Grid Event List
        for i in 1...$data_actors.size
          $game_actors[i].sphere_grid_event_list = grid_events.dup
        end
      end
    end
    
    #==============================================================================
    # ** Window_SkillGridSpheres
    #==============================================================================
    
    class Window_SkillGridSpheres < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(400, 236, 236, 240)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.back_opacity = 125
        refresh
        @stat_flag = false
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        # Draws Sphere Heading
        self.contents.font.size, self.contents.font.color = 22, system_color
        self.contents.draw_text(4, 0, contents.width - 8, 32, 'Collected Spheres', 1)
        # Draws Sphere Totals
        self.contents.font.size, self.contents.font.color = 16, normal_color
        sphere_names = ['Hp', 'Sp', 'Strength', 'Dexterity', 'Agility', 
          'Intellect', 'Ability'].collect! {|x| x + ' Spheres'}
        sphere_names << ['a', 'b', 'c', 'd'].collect! {|x| "Grid Locks Level #{x.upcase}"}
        sphere_totals = ['hp', 'sp', 'str', 'dex', 'agi', 'int', 'ability'].collect! {|x|
          eval "$game_party.sphere_grid_#{x}_spheres"}
        sphere_totals << ['a', 'b', 'c', 'd'].collect! {|x| eval "$game_party.sphere_grid_level_#{x}_locks"}
        sphere_totals.flatten!
        for i in 0...sphere_names.flatten!.size
          self.contents.draw_text(8, 32 + i * 16, contents.width - 16, 16, sphere_names[i])
          self.contents.draw_text(8, 32 + i * 16, contents.width - 16, 16, sphere_totals[i].to_s, 2)
        end
      end
      #--------------------------------------------------------------------------
      # * Set Required Sphere
      #--------------------------------------------------------------------------
      def set_required_sphere(sphere)
        # Sets Stat Flag
        @stat_flag = true
        # Collects Change Parameters
        case sphere
        when 'Hp'
          y, sphere, total = 32, 'Hp Sphere', $game_party.sphere_grid_hp_spheres
        when 'Sp'
          y, sphere, total = 48, 'Sp Sphere', $game_party.sphere_grid_sp_spheres
        when 'Str'
          y, sphere, total = 64, 'Strength Sphere', $game_party.sphere_grid_str_spheres
        when 'Dex'
          y, sphere, total = 80, 'Dexterity Sphere', $game_party.sphere_grid_dex_spheres
        when 'Agi'
          y, sphere, total = 96, 'Agility Sphere', $game_party.sphere_grid_agi_spheres
        when 'Int'
          y, sphere, total = 112, 'Intellect Sphere', $game_party.sphere_grid_int_spheres
        when 'Ability'
          y, sphere, total = 128, 'Ability Sphere', $game_party.sphere_grid_ability_spheres
        when 'LockA'
          y, sphere, total = 144, 'Grid Locks Level A', $game_party.sphere_grid_level_a_locks
        when 'LockB'
          y, sphere, total = 160, 'Grid Locks Level B', $game_party.sphere_grid_level_b_locks
        when 'LockC'
          y, sphere, total = 176, 'Grid Locks Level C', $game_party.sphere_grid_level_c_locks
        when 'LockD'
          y, sphere, total = 192, 'Grid Locks Level D', $game_party.sphere_grid_level_d_locks
        end
        # Clear Contents
        self.contents.fill_rect(0, y, contents.width, 16, Color.new(0, 0, 0, 0))
        # Redraws Spheres
        self.contents.font.color = total > 0 ? Color.new(0, 200, 0) : Color.new(200, 0, 0)
        self.contents.draw_text(8, y, contents.width - 16, 16, sphere)
        self.contents.draw_text(8, y, contents.width - 16, 16, (total - 1).to_s, 2)
      end
      #--------------------------------------------------------------------------
      # * Reset Contents
      #--------------------------------------------------------------------------
      def reset_contents
        if @stat_flag
          @stat_flag = false
          refresh
        end
      end
    end
    
    #==============================================================================
    # ** Window_SkillGridStatus
    #==============================================================================
    
    class Window_SkillGridStatus < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(actor_index)
        super(4, 68, 236, 112)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.back_opacity = 125
        @actor = $game_party.actors[actor_index]
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        # Collects Skill Grid Totals
        skills, stats, locks = 0, 0, 0
        unlocked_skills, unlocked_stats, unlocked_locks = 0, 0, 0
        for event in $game_map.events.values
          if event.list[0].code == 108
            if event.list[0].parameters[0].include?('Skill')
              skills += 1
              if @actor.sphere_grid_event_list[event.id]
                unlocked_skills += 1
              end
            elsif event.list[0].parameters[0].dup.sub!(/\d/, '')
              stats += 1
              if @actor.sphere_grid_event_list[event.id]
                unlocked_stats += 1
              end
            elsif event.list[0].parameters[0].include?('Lock')
              locks += 1
              if @actor.sphere_grid_event_list[event.id]
                unlocked_locks += 1
              end
            end
          end
        end
        # Draws Sphere Totals Headings
        self.contents.font.size, self.contents.font.color = 22, system_color
        self.contents.draw_text(0, 0, contents.width, 32, "Grid Totals For #{@actor.name}", 1)
        # Draws Skill Totals
        self.contents.font.size, self.contents.font.color = 16, unlocked_skills == 
          skills ? Color.new(0, 255, 0) : normal_color
        self.contents.draw_text(8, 32, contents.width - 16, 16, 'Skill Spheres Unlocked')
        self.contents.draw_text(8, 32, contents.width - 16, 16, "#{unlocked_skills} / #{skills}", 2)
        # Draws Stat Totals
        self.contents.font.size, self.contents.font.color = 16, unlocked_stats == 
          stats ? Color.new(0, 255, 0) : normal_color
        self.contents.draw_text(8, 48, contents.width - 16, 16, 'Stat Spheres Unlocked')
        self.contents.draw_text(8, 48, contents.width - 16, 16, "#{unlocked_stats} / #{stats}", 2)
        # Draws Lock Totals
        self.contents.font.size, self.contents.font.color = 16, unlocked_locks == 
          locks ? Color.new(0, 255, 0) : normal_color
        self.contents.draw_text(8, 64, contents.width - 16, 16, 'Grid Locks Unlocked')
        self.contents.draw_text(8, 64, contents.width - 16, 16, "#{unlocked_locks} / #{locks}", 2)
      end
    end
    
    #==============================================================================
    # ** Window_SkillGridActorStatus
    #==============================================================================
    
    class Window_SkillGridActorStatus < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(actor_index)
        super(4, 332, 392, 144)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.back_opacity = 125
        @actor = $game_party.actors[actor_index]
        @page = 1
        refresh
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        @page == 1 ? draw_status : draw_skills
      end
      #--------------------------------------------------------------------------
      # * Draw Status
      #--------------------------------------------------------------------------
      def draw_status
        # Draws Actor Heading
        self.contents.font.size, self.contents.font.color = 22, system_color
        self.contents.draw_text(0, 0, contents.width, 32, @actor.name + ' Stastics')
        # Draws Stats
        stat_words = ['hp', 'sp', 'str', 'dex', 'agi', 'int', 'atk', 'pdef' , 'mdef'].collect! {|x|
          eval "$data_system.words.#{x}"} << 'Evasion'
        stat_amounts = ["#{@actor.hp} / #{@actor.maxhp}", "#{@actor.sp} / #{@actor.maxsp}"]
        stat_amounts << ['str', 'dex' , 'agi', 'int', 'atk' , 'pdef' , 'mdef', 'eva'].collect! {|x|
          eval "@actor.#{x}"}
        self.contents.font.size, self.contents.font.color = 16, normal_color
        for i in 0...stat_amounts.flatten!.size
          x, y = (i % 2) * contents.width / 2 + 8, 32 + 16 * (i / 2)
          self.contents.draw_text(x, y, contents.width / 2 - 16, 16, stat_words[i])
          self.contents.draw_text(x, y, contents.width / 2 - 16, 16, stat_amounts[i].to_s, 2)
        end
      end
      #--------------------------------------------------------------------------
      # * Draw Skills
      #--------------------------------------------------------------------------
      def draw_skills
        # Draws Actor Heading
        self.contents.font.size, self.contents.font.color = 22, system_color
        self.contents.draw_text(0, 0, contents.width, 32, @actor.name + ' Skills')
        # Draws Skill
        self.contents.font.size, self.contents.font.color = 16, normal_color
        for i in 0...@actor.sphere_grid_skills.size
          x, y = (i % 3) * contents.width / 3, 32 + 16 * (i / 3)
          skill_name = $data_skills[@actor.sphere_grid_skills[i]].name
          self.contents.draw_text(x + 4, y, contents.width / 3 - 8, 16, skill_name)
        end
      end
      #--------------------------------------------------------------------------
      # * Next Page
      #--------------------------------------------------------------------------
      def next_page
        @page = @page == 1 ? 2 : 1
        refresh
      end
    end
    
    #==============================================================================
    # ** Scene_SphereGrid
    #==============================================================================
    
    class Scene_SphereGrid
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize(actor_index, setup_return_id = false)
        # Actor Index from Game Party
        @actor_index = actor_index
        # Sets Actor
        @actor = $game_party.actors[@actor_index]
        # Sets Return Coordinates
        if setup_return_id
          $game_temp.spheregrid_return_map_id = $game_map.map_id
          $game_temp.spheregrid_return_map_coordinates = [$game_player.x, $game_player.y]
          actor = $game_party.actors[0]
          $game_temp.spheregrid_return_actor_graphic = [actor.character_name, actor.character_hue]
        end
        # Changes Character Graphic
        $game_player.character_name = @actor.character_name
        $game_player.character_hue = @actor.character_hue
        # Moves to Skill Map
        $game_map.setup($game_temp.spheregrid_map_id)
        coordinates = @actor.sphere_grid_position
        $game_player.moveto(coordinates[0], coordinates[1])
        # Update Events
        update_events
      end
      #--------------------------------------------------------------------------
      # * Main Processing
      #--------------------------------------------------------------------------
      def main
        # Make sprite set
        @spriteset = Spriteset_Map.new
        # Make message window
        @message_window = Window_Message.new
        # Make Help Window
        @help_window = Window_Help.new
          @help_window.back_opacity = 125
        # Make Spheres Window
        @sphere_totals = Window_SkillGridSpheres.new
        # Make Actor Status Window
        @actor_status = Window_SkillGridActorStatus.new(@actor_index)
        # Make Grid Stats Window
        @grid_status = Window_SkillGridStatus.new(@actor_index)
        # Conformation Window
        @confim_window = Window_Command.new(100, ['Yes', 'No'])
          @confim_window.x, @confim_window.y = 270, 192
          @confim_window.active = @confim_window.visible = false
          @confim_window.back_opacity = 125
        # Advancement Parameters
        @parameters = []
        # Transition run
        Graphics.transition(40, "Graphics/Transitions/#{$data_system.battle_transition}")
        # Main loop
        while $scene == self
          # Update game screen
          Graphics.update
          # Update input information
          Input.update
          # Frame update
          update
        end
        # Prepare for transition
        Graphics.freeze
        # Dispose of sprite set
        @spriteset.dispose
        # Dispose of windows
        @message_window.dispose
        @help_window.dispose
        @sphere_totals.dispose
        @actor_status.dispose
        @grid_status.dispose
        @confim_window.dispose
        # Resets Map Information
        if $scene.is_a?(Scene_Menu)
          $game_map.setup($game_temp.spheregrid_return_map_id)
          $game_player.moveto($game_temp.spheregrid_return_map_coordinates[0],
            $game_temp.spheregrid_return_map_coordinates[1])
          $game_player.character_name = $game_temp.spheregrid_return_actor_graphic[0]
          $game_player.character_hue = $game_temp.spheregrid_return_actor_graphic[1]
        end
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        # If A button was pressed
        if Input.trigger?(Input::A)
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          # Moves to Menu Scene
          @actor_status.next_page
        end
        # If X button was pressed
        if Input.trigger?(Input::X)
          # Play cursor SE
          $game_system.se_play($data_system.cursor_se)
          # Toggle Sphere Totals Window
          @sphere_totals.visible = @sphere_totals.visible ? false : true
        end
        # If Y button was pressed
        if Input.trigger?(Input::Y)
          # Play cursor SE
          $game_system.se_play($data_system.cursor_se)
          # Toggle Sphere Totals Window
          @actor_status.visible = @actor_status.visible ? false : true
        end
        # If Z button was pressed
        if Input.trigger?(Input::Z)
          # Play cursor SE
          $game_system.se_play($data_system.cursor_se)
          # Toggle Sphere Totals Window
          @grid_status.visible = @grid_status.visible ? false : true
        end
        # Conformation Method
        if @confim_window.active
          update_confirm
          return
        end
        # Clears Help Window Text
        @help_window.set_text('', 1)
        # Loop
        loop do
          # Update map, interpreter, and player order
          # (this update order is important for when conditions are fulfilled 
          # to run any event, and the player isn't provided the opportunity to
          # move in an instant)
          $game_map.update
          $game_system.map_interpreter.update
          $game_player.update
          # Update system (timer), screen
          $game_system.update
          $game_screen.update
          # Abort loop if player isn't place moving
          unless $game_temp.player_transferring
            break
          end
          # Run place move
          transfer_player
          # Abort loop if transition processing
          if $game_temp.transition_processing
            break
          end
        end
        # Update sprite set
        @spriteset.update
        # Update message window
        @message_window.update
        # If showing message window
        if $game_temp.message_window_showing
          return
        end
        # Clears Learning Variables
        event_id, unlocked, parameters = nil, false, nil
        # Checks Each Event
        for event in $game_map.events.values
          # If Player is In Range
          if check_range(event, $game_player)
            # Sets Event Id Flag
            event_id = event.id
            # If Event Unlocked
            if @actor.sphere_grid_event_list[event_id]
              # Sets Help Window Text to Unlocked
              @help_window.set_text('Grid Unlocked', 1)
              # Sets unlocked Flag
              unlocked = true
            else
              # Sets Help Window Text to Skill Grid Type
              if event.list[0].code == 108
                # Gets Stat
                stat = event.list[0].parameters[0]
                # Skill Learning
                if stat.include?('Skill')
                  for i in 1...$data_skills.size
                    if stat.include?($data_skills[i].name)
                      parameters = ["Learn Skill #{$data_skills[i].name}", i]
                    end
                  end
                # Stat Learning
                elsif stat.dup.sub!(/(\d+)/, '')
                  # Gets Value
                  c = $1
                  # Gets Parameter Type
                  stat.dup.sub!(/(\w+)/, '')
                  b = $1
                  parameters = ["Increase #{b} by #{c}", b, c]
                # Grid Lock
                elsif stat.include?('Lock')
                  parameters = ["Grid #{stat}"]
                end
                # Draws Help Text
                @help_window.set_text((parameters.nil? ? event.list[0].parameters[0] : parameters[0]), 1)
              end
            end
          end
        end
        # Updates Sphere Totals Window
        if parameters.nil?
          @sphere_totals.reset_contents
        else
          @sphere_totals.set_required_sphere(parameters.size == 2 ? 'Ability' : 
            parameters.size == 3 ? parameters[1] : parameters[0].delete!('Grid '))
        end
        # If B button was pressed
        if Input.trigger?(Input::B)
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          # Changes Actors Skill Grid Coordinates
          @actor.sphere_grid_position = [$game_player.x, $game_player.y]
          # Moves to Menu Scene
          $scene = Scene_Menu.new
        end
        # If C button was pressed
        if Input.trigger?(Input::C)
          return if parameters.nil?
          # Learn Skills
          if parameters.size == 2
            # Checks to Make Sure Enough Ability Spheres
            if $game_party.sphere_grid_ability_spheres < 1
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Sets Parameters
            @parameters = ["Are you sure you want to #{parameters[0]}?", 
              parameters[1], event_id]
            # Makes Conformation Window Active
            @confim_window.index = 0
            @confim_window.active = @confim_window.visible = true
            return
          # Increase Stats
          elsif parameters.size == 3
            # Checks for Spheres
            case parameters[1]
            when 'Hp'
              check = $game_party.sphere_grid_hp_spheres
            when 'Sp'
              check = $game_party.sphere_grid_sp_spheres
            when 'Str'
              check = $game_party.sphere_grid_str_spheres
            when 'Dex'
              check = $game_party.sphere_grid_dex_spheres
            when 'Agi'
              check = $game_party.sphere_grid_agi_spheres
            when 'Int'
              check = $game_party.sphere_grid_int_spheres
            end
            if check < 1
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Sets Parameters
            @parameters = ["Are you sure you want to #{parameters[0]}?", 
              parameters[1], parameters[2].to_i, event_id]
            # Makes Conformation Window Active
            @confim_window.index = 0
            @confim_window.active = @confim_window.visible = true
            return
          # Grid Locks
          elsif parameters.size == 1
            # Help Text
            text = 'Are you sure you want to '
            # Checks Lock Amounts
            case parameters[0]
            when 'LockA'
              check = $game_party.sphere_grid_level_a_locks
              text += 'Unlock Grid Lock A'
            when 'LockB'
              check = $game_party.sphere_grid_level_b_locks
              text += 'Unlock Grid Lock B'
            when 'LockC'
              check = $game_party.sphere_grid_level_c_locks
              text += 'Unlock Grid Lock C'
            when 'LockD'
              check = $game_party.sphere_grid_level_d_locks
              text += 'Unlock Grid Lock D'
            end
            if check < 1
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Sets Parameters
            @parameters = [text, event_id]
            # Makes Conformation Window Active
            @confim_window.index = 0
            @confim_window.active = @confim_window.visible = true
            return
          end
        end
        # If L button was pressed
        if Input.trigger?(Input::L)
          # Play cursor SE
          $game_system.se_play($data_system.cursor_se)
          # To previous actor
          @actor_index += $game_party.actors.size - 1
          @actor_index %= $game_party.actors.size
          # Changes Actors Skill Grid Coordinates
          @actor.sphere_grid_position = [$game_player.x, $game_player.y]
          # Moves to New Actor
          $scene = Scene_SphereGrid.new(@actor_index)
        end
        # If R button was pressed
        if Input.trigger?(Input::R)
          # Play cursor SE
          $game_system.se_play($data_system.cursor_se)
          # To next actor
          @actor_index += 1
          @actor_index %= $game_party.actors.size
          # Changes Actors Skill Grid Coordinates
          @actor.sphere_grid_position = [$game_player.x, $game_player.y]
          # Moves to New Actor
          $scene = Scene_SphereGrid.new(@actor_index)
        end
      end
      #--------------------------------------------------------------------------
      # * Frame Update : Conformation
      #--------------------------------------------------------------------------
      def update_confirm
        # Updates Confirm Window
        @confim_window.update
        # Sets Help Window
        @help_window.set_text(@parameters[0])
        # If B button was pressed
        if Input.trigger?(Input::B)
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          # Turns off Confirm Window
          @confim_window.visible = @confim_window.active = false
        end
        # If C button was pressed
        if Input.trigger?(Input::C)
          if @confim_window.index == 1
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Turns off Confirm Window
            @confim_window.visible = @confim_window.active = false
          else
            # Skill Learning
            if @parameters.size == 3
              # Lowers Abilitiy Spheres
              $game_party.sphere_grid_ability_spheres -= 1
              # Turns Off Grid Event For Actor
              @actor.sphere_grid_event_list[@parameters[2]] = true
              # Learns Skill
              @actor.sphere_grid_skills << @parameters[1]
              # Refreshes Total Window
              @sphere_totals.refresh
              # Refreshs Skills Window
              @actor_status.refresh
              # Refreshes Grid Status Window
              @grid_status.refresh
              # Turns off Confirm Window
              @confim_window.visible = @confim_window.active = false
              # Gets Event ID
              event_id = @parameters[2]
            elsif @parameters.size == 4
              case @parameters[1]
              when 'Hp'
                # Lowers Spheres
                $game_party.sphere_grid_hp_spheres -= 1
                # Raises Stat
                @actor.maxhp += @parameters[2]
              when 'Sp'
                # Lowers Spheres
                $game_party.sphere_grid_sp_spheres -= 1
                # Raises Stat
                @actor.maxsp += @parameters[2]
              when 'Str'
                # Lowers Spheres
                $game_party.sphere_grid_str_spheres -= 1
                # Raises Stat
                @actor.str += @parameters[2]
              when 'Dex'
                # Lowers Spheres
                $game_party.sphere_grid_dex_spheres -= 1
                # Raises Stat
                @actor.dex += @parameters[2]
              when 'Agi'
                # Lowers Spheres
                $game_party.sphere_grid_agi_spheres -= 1
                # Raises Stat
                @actor.agi += @parameters[2]
              when 'Int'
                # Lowers Spheres
                $game_party.sphere_grid_int_spheres -= 1
                # Raises Stat
                @actor.int += @parameters[2]
              end
              # Turns Off Grid Event For Actor
              @actor.sphere_grid_event_list[@parameters[3]] = true
              # Refreshes Total Window
              @sphere_totals.refresh
              # Refreshs Skills Window
              @actor_status.refresh
              # Refreshes Grid Status Window
              @grid_status.refresh
              # Turns off Confirm Window
              @confim_window.visible = @confim_window.active = false
              # Gets Event ID
              event_id = @parameters[3]
            elsif @parameters.size == 2
              # Lowers Lock Spheres
              case @parameters[0].reverse[0, 1]
              when 'A'
                $game_map.events[@parameters[1]].character_name = 
                  Sphere_Grid_System::LOCKA_GRAPHIC_OFF[0]
                $game_party.sphere_grid_level_a_locks -= 1
              when 'B'
                $game_map.events[@parameters[1]].character_name = 
                  Sphere_Grid_System::LOCKB_GRAPHIC_OFF[0]
                $game_party.sphere_grid_level_b_locks -= 1
              when 'C'
                $game_map.events[@parameters[1]].character_name = 
                  Sphere_Grid_System::LOCKC_GRAPHIC_OFF[0]
                $game_party.sphere_grid_level_c_locks -= 1
              when 'D'
                $game_map.events[@parameters[1]].character_name = 
                  Sphere_Grid_System::LOCKD_GRAPHIC_OFF[0]
                $game_party.sphere_grid_level_d_locks -= 1
              end
              # Turns Off Grid Event For Actor
              @actor.sphere_grid_event_list[@parameters[1]] = true
              # Changes Events Graphic
              $game_map.events[@parameters[1]].character_name = ''
              # Refreshes Total Window
              @sphere_totals.refresh
              # Refreshs Skills Window
              @actor_status.refresh
              # Refreshes Grid Status Window
              @grid_status.refresh
              # Turns off Confirm Window
              @confim_window.visible = @confim_window.active = false
              # Gets Event ID
              event_id = @parameters[1]
            end
            # Updates Events
            $game_map.events[event_id].direction = 8
            $game_map.events[event_id].through = true
          end
        end
      end
      #--------------------------------------------------------------------------
      # * Check Range
      #--------------------------------------------------------------------------
      def check_range(element, object, range = 1)
        x = (element.x - object.x) * (element.x - object.x)
        y = (element.y - object.y) * (element.y - object.y)
        r = x + y
        return r <= (range * range)
      end
      #--------------------------------------------------------------------------
      # * Update Events
      #--------------------------------------------------------------------------
      def update_events
        # Sets Event Graphics
        for event in $game_map.events.values
          if @actor.sphere_grid_event_list.has_key?(event.id)
            if event.list[0].code == 108
              stat = event.list[0].parameters[0]
              # Grid Locks
              if stat.include?('Lock')
                unless @actor.sphere_grid_event_list[event.id]
                  case stat.reverse[0, 1]
                  when 'A'
                    graphic_parameters = Sphere_Grid_System::LOCKA_GRAPHIC_ON
                  when 'B'
                    graphic_parameters = Sphere_Grid_System::LOCKB_GRAPHIC_ON
                  when 'C'
                    graphic_parameters = Sphere_Grid_System::LOCKC_GRAPHIC_ON
                  when 'D'
                    graphic_parameters = Sphere_Grid_System::LOCKD_GRAPHIC_ON
                  end
                else
                  case stat.reverse[0, 1]
                  when 'A'
                    graphic_parameters = Sphere_Grid_System::LOCKA_GRAPHIC_OFF
                  when 'B'
                    graphic_parameters = Sphere_Grid_System::LOCKB_GRAPHIC_OFF
                  when 'C'
                    graphic_parameters = Sphere_Grid_System::LOCKC_GRAPHIC_OFF
                  when 'D'
                    graphic_parameters = Sphere_Grid_System::LOCKD_GRAPHIC_OFF
                  end
                end
              # Skill Sphere
              elsif stat.include?('Skill')
                unless @actor.sphere_grid_event_list[event.id]
                  graphic_parameters = Sphere_Grid_System::ABILITIY_SPHERE_GRAPHIC_ON
                else
                  graphic_parameters = Sphere_Grid_System::ABILITIY_SPHERE_GRAPHIC_OFF
                end
              # Stat Spheres
              elsif stat.dup.sub!(/(\d+)/, '')
                stat.dup.sub(/(\w+)/, '')
                unless @actor.sphere_grid_event_list[event.id]
                  case $1
                  when 'Hp'
                    graphic_parameters = Sphere_Grid_System::HP_SPHERE_GRAPHIC_ON
                  when 'Sp'
                    graphic_parameters = Sphere_Grid_System::SP_SPHERE_GRAPHIC_ON
                  when 'Str'
                    graphic_parameters = Sphere_Grid_System::STR_SPHERE_GRAPHIC_ON
                  when 'Dex'
                    graphic_parameters = Sphere_Grid_System::DEX_SPHERE_GRAPHIC_ON
                  when 'Agi'
                    graphic_parameters = Sphere_Grid_System::AGI_SPHERE_GRAPHIC_ON
                  when 'Int'
                    graphic_parameters = Sphere_Grid_System::INT_SPHERE_GRAPHIC_ON
                  end
                else
                  case $1
                  when 'Hp'
                    graphic_parameters = Sphere_Grid_System::HP_SPHERE_GRAPHIC_OFF
                  when 'Sp'
                    graphic_parameters = Sphere_Grid_System::SP_SPHERE_GRAPHIC_OFF
                  when 'Str'
                    graphic_parameters = Sphere_Grid_System::STR_SPHERE_GRAPHIC_OFF
                  when 'Dex'
                    graphic_parameters = Sphere_Grid_System::DEX_SPHERE_GRAPHIC_OFF
                  when 'Agi'
                    graphic_parameters = Sphere_Grid_System::AGI_SPHERE_GRAPHIC_OFF
                  when 'Int'
                    graphic_parameters = Sphere_Grid_System::INT_SPHERE_GRAPHIC_OFF
                  end
                end
              end
              # Changes event graphics
              event.character_hue = graphic_parameters[1]
              event.direction = graphic_parameters[2]
              event.pattern = graphic_parameters[3]
              event.character_name = graphic_parameters[0]
              event.through = @actor.sphere_grid_event_list[event.id]
            end
          end
        end
      end
    end
    
    #--------------------------------------------------------------------------
    # * End SDK Enable Test
    #--------------------------------------------------------------------------
    end
    và đây là cách để gọi Sphere System "$scene = Scene_SphereGrid.new(0, true)" nhưng để có thể gọi được Sphere System thì trước hết phải có Map ten là "Sphere Grid"
    Tóm lại chỉ cần Demo là hiểu :
    Your Download-Link:
    http://www.uploading.com/?get=3HFLIOIL
    Hèm sau khi down cái Demo về thì chép cái script wa Script Editor của mình là việc trước tiên .Thứ 2 chép cái Tileset có trong phần Graphic của Demo vào phần Graphic Tileset và Import nó thế là xong .Việc còn lại là vô các phần Event mà nghiên cứu lệnh .Ai không hiểu chỗ nào cứ hỏi tui xin trả lời :D
     
  8. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Đây đáp ứng yêu cầu "đại ca" Mozzila ."Em" xin úp cho mấy vị cái ring Menu này >Chỉ cần chép cái này vào bên trên phần Main là có thể dùng được :D
    Tiện ích hơn mấy cái script cua rtui nhiều (Mỗi lần lấy về một mớ là coi như nó đụng nhau hoài T_T)
    Khỏi vòng vo tam quốc đây script đây :
    Mã:
    #------------------------------------------------------------------------------
    #  Ring_Menu
    #------------------------------------------------------------------------------
    #  By:  XRXS, Dubealex, and Hypershadow180
    #------------------------------------------------------------------------------
    class Scene_Menu
    #------------------------------------------------------------------------------
    #  Initialize
    #------------------------------------------------------------------------------
      def initialize(menu_index = 0)
        @menu_index = menu_index
        $location_text=[]
        $gold_text=[]
        $window_size=[]
        $ring_menu_text=[]
        $chara_select=[]
        @window_opacity=[]
        @chara_select=[]
        @window_position=[]
        $location_text[0]="Tahoma" # Font Type
        $location_text[1]=24 # Font Size
        $location_text[2]=0 # Location Title Color
        $location_text[4]=0 # Map Name Color
        $location_text[3]="Location:" # Text
        $gold_text[0]="Tahoma" # Font Type
        $gold_text[1]=24 # Font Size
        $gold_text[2]=0 # Gold Title Color
        $gold_text[3]=0 # Gold Color
        $gold_text[4]="Gold" # Text
        @window_opacity[0]=255 # Border Opacity
        @window_opacity[1]=130 # Background Opacity
        $window_location_skin="001-Blue01" # Location Windowskin
        $window_gold_skin="001-Blue01" # Gold Windowskin
        @window_position[0]=0 # X Axis Position
        @window_position[1]=0 # Location Y Axis Position
        @window_position[2]=384 # Gold Y Axis Position
        $window_size[0]=160 # Length
        $window_size[1]=96 # Height
        $ring_menu_text[0]="Tahoma" # Font Type
        $ring_menu_text[7]=0 # Font Color
        $ring_menu_text[8]=24 # Font Size
        $ring_menu_text[1]="Items"
        $ring_menu_text[2]="Skills"
        $ring_menu_text[3]="Equip"
        $ring_menu_text[4]="Stats"
        $ring_menu_text[5]="Save"
        $ring_menu_text[6]="Quit"
        @chara_select[0]=408 # X Axis Position
        @chara_select[1]=0 # Y Axis Position
        $chara_select[0]="Tahoma" # Font Type
        $chara_select[1]=0 # Font Color
        $chara_select[5]=24 # Font Size
        $chara_select[2]=255 # Border Opacity
        $chara_select[3]=130 # Background Opacity
        $chara_select[4]="001-Blue01" # Windowskin
      end
    #------------------------------------------------------------------------------
    #  Main
    #------------------------------------------------------------------------------
      def main
        @window_location = Window_Location.new
        @window_location.x = @window_position[0]
        @window_location.y = @window_position[1]
        @window_location.opacity = @window_opacity[0]
        @window_location.back_opacity = @window_opacity[1]
        @window_gold = Window_MenuGold.new
        @window_gold.x = @window_position[0]
        @window_gold.y = @window_position[2]
        @window_gold.opacity = @window_opacity[0]
        @window_gold.back_opacity = @window_opacity[1]
        @spriteset = Spriteset_Map.new
        px = $game_player.screen_x - 15
        py = $game_player.screen_y - 24
        @command_window = Window_RingMenu.new(px,py)
        @command_window.index = @menu_index
        if $game_party.actors.size == 0
          @command_window.disable_item(0)
          @command_window.disable_item(1)
          @command_window.disable_item(2)
          @command_window.disable_item(3)
        end
        @command_window.z = 100
        if $game_system.save_disabled
          @command_window.disable_item(4)
        end
        @status_window = Window_RingMenuStatus.new
        @status_window.x = @chara_select[0]
        @status_window.y = @chara_select[1]
        @status_window.z = 200
        @status_window.opacity=$chara_select[2]
        @status_window.back_opacity=$chara_select[3]
        @status_window.visible = false
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
          if $scene != self
            break
          end
        end
        Graphics.freeze
        @spriteset.dispose
        @window_location.dispose
        @window_gold.dispose
        @command_window.dispose
        @status_window.dispose
      end
    #------------------------------------------------------------------------------
    #  Update
    #------------------------------------------------------------------------------
      def update
        @window_location.update
        @window_gold.update
        @command_window.update
        @status_window.update
        if @command_window.active
          update_command
          return
        end
        if @status_window.active
          update_status
          return
        end
      end
    #------------------------------------------------------------------------------
    #  Update Comman
    #------------------------------------------------------------------------------
      def update_command
        if Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          $scene = Scene_Map.new
          return
        end
        if Input.trigger?(Input::C)
          if $game_party.actors.size == 0 and @command_window.index < 4
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        case @command_window.index
        when 0
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Item.new
        when 1
          $game_system.se_play($data_system.decision_se)
          @command_window.active = false
          @status_window.active = true
          @status_window.visible = true
          @status_window.index = 0
        when 2
          $game_system.se_play($data_system.decision_se)
          @command_window.active = false
          @status_window.active = true
          @status_window.visible = true
          @status_window.index = 0
        when 3
          $game_system.se_play($data_system.decision_se)
          @command_window.active = false
          @status_window.active = true
          @status_window.visible = true
          @status_window.index = 0
        when 4
          if $game_system.save_disabled
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Save.new
        when 5
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_End.new
        end
        return
      end
      return if @command_window.animation?
        if Input.press?(Input::UP) or  Input.press?(Input::LEFT)
          $game_system.se_play($data_system.cursor_se)
          @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
          return
        end
        if Input.press?(Input::DOWN) or  Input.press?(Input::RIGHT)
          $game_system.se_play($data_system.cursor_se)
          @command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
          return
        end
      end
    #------------------------------------------------------------------------------
    #  Update Status
    #------------------------------------------------------------------------------
      def update_status
        if Input.trigger?(Input::B)
          $game_system.se_play($data_system.cancel_se)
          @command_window.active = true
          @status_window.active = false
          @status_window.visible = false
          @status_window.index = -1
          return
        end
        if Input.trigger?(Input::C)
        case @command_window.index
        when 1
          if $game_party.actors[@status_window.index].restriction >= 2
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Skill.new(@status_window.index)
        when 2
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Equip.new(@status_window.index)
        when 3
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_Status.new(@status_window.index)
          end
          return
        end
      end
    end
    #------------------------------------------------------------------------------
    #  Window_RingMenu
    #------------------------------------------------------------------------------
    class Window_RingMenu < Window_Base
      STARTUP_FRAMES = 20 
      MOVING_FRAMES = 5   
      RING_R = 64        
      ICON_ITEM   = RPG::Cache.icon("034-Item03")
      ICON_SKILL  = RPG::Cache.icon("044-Skill01") 
      ICON_EQUIP  = RPG::Cache.icon("001-Weapon01") 
      ICON_STATUS = RPG::Cache.icon("050-Skill07") 
      ICON_SAVE   = RPG::Cache.icon("038-Item07") 
      ICON_EXIT   = RPG::Cache.icon("046-Skill03") 
      ICON_DISABLE= RPG::Cache.icon("") 
      SE_STARTUP = "056-Right02" 
      MODE_START = 1 
      MODE_WAIT  = 2 
      MODE_MOVER = 3 
      MODE_MOVEL = 4 
      attr_accessor :index
    #------------------------------------------------------------------------------
    #  Initialize
    #------------------------------------------------------------------------------
      def initialize( center_x, center_y )
        super(0, 0, 640, 480)
        self.contents = Bitmap.new(width-32, height-32)
        self.contents.font.name = $ring_menu_text[0]
        self.contents.font.color = text_color($ring_menu_text[7]) 
        self.contents.font.size = $ring_menu_text[8]
        self.opacity = 0
        self.back_opacity = 0
        s1 = $ring_menu_text[1]
        s2 = $ring_menu_text[2]
        s3 = $ring_menu_text[3]
        s4 = $ring_menu_text[4]
        s5 = $ring_menu_text[5]
        s6 = $ring_menu_text[6]
        @commands = [ s1, s2, s3, s4, s5, s6 ]
        @item_max = 6
        @index = 0
        @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
        @disabled = [ false, false, false, false, false, false ]
        @cx = center_x - 16
        @cy = center_y - 16
        setup_move_start
        refresh
      end
    #------------------------------------------------------------------------------
    #  Update
    #------------------------------------------------------------------------------
      def update
        super
        refresh
      end
    #------------------------------------------------------------------------------
    #  Refresh
    #------------------------------------------------------------------------------
      def refresh
        self.contents.clear
        case @mode
        when MODE_START
          refresh_start
        when MODE_WAIT
          refresh_wait
        when MODE_MOVER
          refresh_move(1)
        when MODE_MOVEL
          refresh_move(0)
        end
        rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
        self.contents.draw_text(rect, @commands[@index],1)
      end
    #------------------------------------------------------------------------------
    #  Refresh Start
    #------------------------------------------------------------------------------
      def refresh_start
        d1 = 2.0 * Math::PI / @item_max
        d2 = 1.0 * Math::PI / STARTUP_FRAMES
        r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
        for i in 0...@item_max
          j = i - @index
          d = d1 * j + d2 * @steps
          x = @cx + ( r * Math.sin( d ) ).to_i
          y = @cy - ( r * Math.cos( d ) ).to_i
          draw_item(x, y, i)
        end
        @steps -= 1
        if @steps < 1
          @mode = MODE_WAIT
        end
      end
    #------------------------------------------------------------------------------
    #  Refresh Wait
    #------------------------------------------------------------------------------
      def refresh_wait
        d = 2.0 * Math::PI / @item_max
        for i in 0...@item_max
          j = i - @index
          x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
          y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
          draw_item(x, y, i)
        end
      end
    #------------------------------------------------------------------------------
    #  Refresh Move
    #------------------------------------------------------------------------------
      def refresh_move( mode )
        d1 = 2.0 * Math::PI / @item_max
        d2 = d1 / MOVING_FRAMES
        d2 *= -1 if mode != 0
        for i in 0...@item_max
          j = i - @index
          d = d1 * j + d2 * @steps
          x = @cx + ( RING_R * Math.sin( d ) ).to_i
          y = @cy - ( RING_R * Math.cos( d ) ).to_i
          draw_item(x, y, i)
        end
        @steps -= 1
        if @steps < 1
          @mode = MODE_WAIT
        end
      end
    #------------------------------------------------------------------------------
    #  Draw Item
    #------------------------------------------------------------------------------
      def draw_item(x, y, i)
        rect = Rect.new(0, 0, @items[i].width, @items[i].height)
        if @index == i
          self.contents.blt( x, y, @items[i], rect )
          if @disabled[@index]
            self.contents.blt( x, y, ICON_DISABLE, rect )
          end
        else
          self.contents.blt( x, y, @items[i], rect, 128 )
          if @disabled[@index]
            self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
          end
        end
      end
    #------------------------------------------------------------------------------
    #  Disable Item
    #------------------------------------------------------------------------------
      def disable_item(index)
        @disabled[index] = true
      end
    #------------------------------------------------------------------------------
    #  Setup Move Start
    #------------------------------------------------------------------------------
      def setup_move_start
        @mode = MODE_START
        @steps = STARTUP_FRAMES
        if  SE_STARTUP != nil and SE_STARTUP != ""
          Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
        end
      end
    #------------------------------------------------------------------------------
    #  Setup Move Move
    #------------------------------------------------------------------------------
      def setup_move_move(mode)
        if mode == MODE_MOVER
          @index -= 1
          @index = @items.size - 1 if @index < 0
        elsif mode == MODE_MOVEL
          @index += 1
          @index = 0 if @index >= @items.size
        else
          return
        end
        @mode = mode
        @steps = MOVING_FRAMES
      end
    #------------------------------------------------------------------------------
    #  Animation
    #------------------------------------------------------------------------------
      def animation?
        return @mode != MODE_WAIT
      end
    end
    #------------------------------------------------------------------------------
    #  Window_RingMenuStatus
    #------------------------------------------------------------------------------
    class Window_RingMenuStatus < Window_Selectable
    #------------------------------------------------------------------------------
    #  Initialize
    #------------------------------------------------------------------------------
      def initialize
        super(204, 64, 232, 352)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.size = $chara_select[5]
        refresh
        self.active = false
        self.index = -1
      end
    #------------------------------------------------------------------------------
    #  Refresh
    #------------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.windowskin = RPG::Cache.windowskin($chara_select[4]) 
        self.contents.font.name = $chara_select[0]
        self.contents.font.color = text_color($chara_select[1]) 
        @item_max = $game_party.actors.size
        for i in 0...$game_party.actors.size
          x = 80
          y = 80 * i
          actor = $game_party.actors[i]
          draw_actor_graphic(actor, x - 60, y + 65)
          draw_actor_name(actor, x, y + 2)
          draw_actor_hp(actor, x - 40, y + 26)
          draw_actor_sp(actor, x - 40, y + 50)
        end
      end
    #------------------------------------------------------------------------------
    #  Update Cursor Rect
    #------------------------------------------------------------------------------
      def update_cursor_rect
        if @index < 0
          self.cursor_rect.empty
        else
          self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
        end
      end
    end
    #------------------------------------------------------------------------------
    #  Game_Map
    #------------------------------------------------------------------------------
    class Game_Map
    #------------------------------------------------------------------------------
    #  Name
    #------------------------------------------------------------------------------
      def name
        $map_infos[@map_id]
      end
    end
    #------------------------------------------------------------------------------
    #  Scene_Title
    #------------------------------------------------------------------------------
    class Scene_Title
      $map_infos = load_data("Data/MapInfos.rxdata")
      for key in $map_infos.keys
        $map_infos[key] = $map_infos[key].name
      end
    end
    #------------------------------------------------------------------------------
    #  Window_Location
    #------------------------------------------------------------------------------
    class Window_Location < Window_Base 
    #------------------------------------------------------------------------------
    #  Initialize
    #------------------------------------------------------------------------------
      def initialize 
        super(0, 0, $window_size[0], $window_size[1]) 
        self.contents = Bitmap.new(width - 32, height - 32) 
        self.contents.font.name = $location_text[0]
        self.contents.font.size = $location_text[1]
        refresh 
      end 
    #------------------------------------------------------------------------------
    #  Refresh
    #------------------------------------------------------------------------------
      def refresh 
        self.contents.clear 
        self.windowskin = RPG::Cache.windowskin($window_location_skin) 
        self.contents.font.color = text_color($location_text[2]) 
        self.contents.draw_text(4, 0, 120, 32, $location_text[3]) 
        self.contents.font.color = text_color($location_text[4]) 
        self.contents.draw_text(4, 32, 120, 32, $game_map.name, 2) 
      end 
    end 
    #------------------------------------------------------------------------------
    #  Window_MenuGold
    #------------------------------------------------------------------------------
    class Window_MenuGold < Window_Base
    #------------------------------------------------------------------------------
    #  Initialize
    #------------------------------------------------------------------------------
      def initialize
        super(0, 0, $window_size[0], $window_size[1])
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $gold_text[0]
        self.contents.font.size = $gold_text[1]
        refresh
      end
    #------------------------------------------------------------------------------
    #  Refresh
    #------------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.windowskin = RPG::Cache.windowskin($window_gold_skin) 
        self.contents.font.color = text_color($gold_text[2]) 
        self.contents.draw_text(4, 0, 120, 32, $gold_text[4]) 
        self.contents.font.color = text_color($gold_text[3]) 
        self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s, 2)
      end
    end
    Và thêm 1 cái nữa đó là screenhot:
    Screenhot
    Screenhot
    Và tiện thể về cái vấn đề về Font gì gì đó (Mỗi scripter có một cách gọi Font khác nhau nên tui có bí quyết này đem lên cho mọi người :D)
    Đó là Chép đè cái dòng này vào dòng Fontface ,fonttype hay defaultfontface
    cái dòng này
    Mã:
    $defaultfonttype = $fontface = $fontname = Font.default_name = "Tên Font của bạn" #(Có dấu ". " vd :".VnArial")
    và chép đè cái dòng fontsize bằng cái này
    Mã:
    $defaultfontsize = $fontsize = Font.default_size = "Số" #(Không có dấu " " .Vd: $defaultfontsize = $fontsize = Font.default_size = [COLOR="Red"]20[/COLOR])
     
  9. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Còn cả cái này nữa .Everybody plays cheat and makes cheat for your own .Cái này quá xá luôn .Vừa dùng cheat vừa tạo được cheat mới sướng chứ nhưng cái này dành cho những người có chút cơ bản về script thì mới có thể tạo cheat dễ dàng còn không các bạn có thể hỏi mọi người trên đây về cheat theo ý tưởng của bạn
    Đây là script : (Chép lên trên Main)
    Mã:
    #==============================================================================
    # Cheats Input Script - v1.2 - by BudsieBuds
    #------------------------------------------------------------------------------
    #  NOTE: Start editing at line 68 and stop editing at '# STOP EDITING \\'.
    #==============================================================================
    
    
    #==============================================================================
    # ** Scene_Cheats
    #------------------------------------------------------------------------------
    #  by BudsieBuds
    #==============================================================================
    
    class Scene_Cheats
      #--------------------------------------------------------------------------
      # * Main Processing
      #--------------------------------------------------------------------------
      def main
        # Make windows
        @edit_window = Window_CheatsEdit.new
        @input_window = Window_CheatsInput.new
        # Execute transition
        Graphics.transition
        # Main loop
        loop do
          # Update game screen
          Graphics.update
          # Update input information
          Input.update
          # Frame update
          update
          # Abort loop if screen is changed
          if $scene != self
            break
          end
        end
        # Prepare for transition
        Graphics.freeze
        # Dispose of windows
        @edit_window.dispose
        @input_window.dispose
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        # Update windows
        @edit_window.update
        @input_window.update
        # If B button was pressed
        if Input.repeat?(Input::B)
          # If cursor position is at 0
          if @edit_window.index == 0
            return
          end
          # Play cancel SE
          $game_system.se_play($data_system.cancel_se)
          # Delete text
          @edit_window.back
          return
        end
        # If C button was pressed
        if Input.trigger?(Input::C)
          # If cursor position is at [OK]
          if @input_window.character == nil
            @cheat_word = @edit_window.cheat.downcase
    
    =begin
    # START EDITING //
    
    ===============================================================================
    
       The cheat that you have to input:
         elsif @cheat_word == "Put the cheat you want to use here."
    
    -------------------------------------------------------------------------------
    
       For item(s):
         $game_party.gain_item(Item ID, How many)
    
       For gold:
         $game_party.gain_gold(How many)
    
       For weapon(s):
         $game_party.gain_weapon(Weapon ID, How many)
    
       For armor(s):
         $game_party.gain_armor(Armor ID, How many)
    
       For skill(s):
         $game_party.actors[Actor ID].learn_skill(Skill ID)
    
       For adding (an) actor(s):
         $game_party.add_actor(id)
    
    -------------------------------------------------------------------------------
    
       This is the verification sound
         $game_system.se_play($data_system.decision_se)
    
    -------------------------------------------------------------------------------
    
        Your cheat can have a maximum of 17 letters.
        The first cheat has to start with 'if'.
        The cheates coming after that have to start with 'elsif'.
    
    ===============================================================================
    =end
    
      if @cheat_word == "money"
        $game_party.gain_gold(500)
        $game_system.se_play($data_system.decision_se)
    
      elsif @cheat_word == "needmoreequip"
        $game_party.gain_weapon(1, 1)
        $game_party.gain_armor(1, 1)
        $game_system.se_play($data_system.decision_se)
    
      elsif @cheat_word == "items"
        for i in 1...$data_items.size
          $game_party.gain_item(i, 10)
          $game_system.se_play($data_system.decision_se)
        end
    
      elsif @cheat_word == "helpplease"
        $game_party.add_actor(2)
        $game_system.se_play($data_system.decision_se)
    
    # STOP EDITING \\
    
              else
                # Play buzzer SE
                $game_system.se_play($data_system.buzzer_se)
              end
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
          # If text character is empty
          if @input_window.character == ""
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Add text character
          @edit_window.add(@input_window.character)
          return
        end
      end
    end
    
    
    #==============================================================================
    # ** Window_Base
    #------------------------------------------------------------------------------
    #  by BudsieBuds
    #==============================================================================
    
    class Window_Base < Window
      #--------------------------------------------------------------------------
      # * Draw Graphic
      #     icon  : icon
      #     x     : draw spot x-coordinate
      #     y     : draw spot y-coordinate
      #--------------------------------------------------------------------------
      def draw_icon_graphic(icon, x, y)
        bitmap = RPG::Cache.icon(icon)
        cw = bitmap.width
        ch = bitmap.height
        src_rect = Rect.new(0, 0, cw, ch)
        self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
      end
    end
    
    
    #==============================================================================
    # ** Window_CheatsEdit
    #------------------------------------------------------------------------------
    #  by BudsieBuds
    #==============================================================================
    
    class Window_CheatsEdit < Window_Base
      #--------------------------------------------------------------------------
      # * Public Instance Variables
      #--------------------------------------------------------------------------
      attr_reader   :cheat                    # cheat
      attr_reader   :index                    # cursor position
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 640, 128)
        self.contents = Bitmap.new(width - 32, height - 32)
        @max_char = 17
        @index = 0
        @cheat = ""
        refresh
        update_cursor_rect
      end
      #--------------------------------------------------------------------------
      # * Add Character
      #     character : text character to be added
      #--------------------------------------------------------------------------
      def add(character)
        if @index < @max_char and character != ""
          @cheat += character
          @index += 1
          refresh
          update_cursor_rect
        end
      end
      #--------------------------------------------------------------------------
      # * Delete Character
      #--------------------------------------------------------------------------
      def back
        if @index > 0
          # Delete 1 text character
          name_array = @cheat.split(//)
          @cheat = ""
          for i in 0...name_array.size-1
            @cheat += name_array[i]
          end
          @index -= 1
          refresh
          update_cursor_rect
        end
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        # Draw cheat
        name_array = @cheat.split(//)
        for i in 0...@max_char
          c = name_array[i]
          if c == nil
            c = "_"
          end
          x = (i + 1) * 32
          self.contents.draw_text(x, 32, 28, 32, c, 1)
        end
        # Draw graphic
        draw_icon_graphic("cheat", 16, 60)
      end
      #--------------------------------------------------------------------------
      # * Cursor Rectangle Update
      #--------------------------------------------------------------------------
      def update_cursor_rect
        x = (@index + 1) * 32
        self.cursor_rect.set(x, 32, 28, 32)
      end
    #--------------------------------------------------------------------------
    # * Frame Update
    #--------------------------------------------------------------------------
      def update
        super
        update_cursor_rect
      end
    end
    
    
    #==============================================================================
    # ** Window_CheatsInput
    #------------------------------------------------------------------------------
    #  by BudsieBuds
    #==============================================================================
    
    class Window_CheatsInput < Window_Base
      CHARACTER_TABLE =
      [
        "A","B","C","D","E",
        "F","G","H","I","J",
        "K","L","M","N","O",
        "P","Q","R","S","T",
        "U","V","W","X","Y",
        "Z"," "," "," "," ",
        "+","-","*","/","!",
        "1","2","3","4","5",
        "" ,"" ,"" ,"" ,"" ,
        "a","b","c","d","e",
        "f","g","h","i","j",
        "k","l","m","n","o",
        "p","q","r","s","t",
        "u","v","w","x","y",
        "z"," "," "," "," ",
        "#","$","%","&","@",
        "6","7","8","9","0",
        "" ,"" ,"" ,"" ,"" ,
      ]
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 128, 640, 352)
        self.contents = Bitmap.new(width - 32, height - 32)
        @index = 0
        refresh
        update_cursor_rect
      end
      #--------------------------------------------------------------------------
      # * Text Character Acquisition
      #--------------------------------------------------------------------------
      def character
        return CHARACTER_TABLE[@index]
      end
      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        for i in 0...90
          x = 140 + i / 5 / 9 * 180 + i % 5 * 32
          y = i / 5 % 9 * 32
          self.contents.draw_text(x, y, 32, 32, CHARACTER_TABLE[i], 1)
        end
        self.contents.draw_text(428, 9 * 32, 48, 32, "OK", 1)
      end
      #--------------------------------------------------------------------------
      # * Cursor Rectangle Update
      #--------------------------------------------------------------------------
      def update_cursor_rect
        # If cursor is positioned on [OK]
        if @index >= 90
          self.cursor_rect.set(428, 9 * 32, 48, 32)
        # If cursor is positioned on anything other than [OK]
        else
          x = 140 + @index / 5 / 9 * 180 + @index % 5 * 32
          y = @index / 5 % 9 * 32
          self.cursor_rect.set(x, y, 32, 32)
        end
      end
      #--------------------------------------------------------------------------
      # * Frame Update
      #--------------------------------------------------------------------------
      def update
        super
        # If cursor is positioned on [OK]
        if @index >= 90
          # Cursor down
          if Input.trigger?(Input::DOWN)
            $game_system.se_play($data_system.cursor_se)
            @index -= 90
          end
          # Cursor up
          if Input.repeat?(Input::UP)
            $game_system.se_play($data_system.cursor_se)
            @index -= 90 - 40
          end
        # If cursor is positioned on anything other than [OK]
        else
          # If right directional button is pushed
          if Input.repeat?(Input::RIGHT)
            # If directional button pressed down is not a repeat, or
            # cursor is not positioned on the right edge
            if Input.trigger?(Input::RIGHT) or
               @index / 45 < 3 or @index % 5 < 4
              # Move cursor to right
              $game_system.se_play($data_system.cursor_se)
              if @index % 5 < 4
                @index += 1
              else
                @index += 45 - 4
              end
              if @index >= 90
                @index -= 90
              end
            end
          end
          # If left directional button is pushed
          if Input.repeat?(Input::LEFT)
            # If directional button pressed down is not a repeat, or
            # cursor is not positioned on the left edge
            if Input.trigger?(Input::LEFT) or
               @index / 45 > 0 or @index % 5 > 0
              # Move cursor to left
              $game_system.se_play($data_system.cursor_se)
              if @index % 5 > 0
                @index -= 1
              else
                @index -= 45 - 4
              end
              if @index < 0
                @index += 90
              end
            end
          end
          # If down directional button is pushed
          if Input.repeat?(Input::DOWN)
            # Move cursor down
            $game_system.se_play($data_system.cursor_se)
            if @index % 45 < 40
              @index += 5
            else
              @index += 90 - 40
            end
          end
          # If up directional button is pushed
          if Input.repeat?(Input::UP)
            # If directional button pressed down is not a repeat, or
            # cursor is not positioned on the upper edge
            if Input.trigger?(Input::UP) or @index % 45 >= 5
              # Move cursor up
              $game_system.se_play($data_system.cursor_se)
              if @index % 45 >= 5
                @index -= 5
              else
                @index += 90
              end
            end
          end
          # If L or R button was pressed
          if Input.repeat?(Input::L) or Input.repeat?(Input::R)
            # Move capital / small
            $game_system.se_play($data_system.cursor_se)
            if @index < 45
              @index += 45
            else
              @index -= 45
            end
          end
        end
        update_cursor_rect
      end
    end
    Và đây là Demo chơi thử rồi biết DEMO Mà này vô Demo nhớ gặp thằng Hề mà nói chuyện nó sẽ nói Cheat cho .Và nếu muốn tạo thì bạn hãy vô Script Editor và tim dòng thứ 128 .Khi đó bạn thêm từ khóa
    Mã:
    elsif @cheat_word == "......" #(Mã cheat của bạn và nhớ là có dấu " " đấy nhế )
    Còn nếu muốn tạo cheat theo ý mình thì ý kiến sau hen !!
    À mà trong cái script đó có hướng dẫn cơ bản đó .Tui chép ra lại cho mọi người thấy
    Mã:
    # START EDITING //
    
    ===============================================================================
    
       The cheat that you have to input:
         elsif @cheat_word == "Put the cheat you want to use here."
    
    -------------------------------------------------------------------------------
    
       For item(s):
         $game_party.gain_item(Item ID, How many)
    
       For gold:
         $game_party.gain_gold(How many)
    
       For weapon(s):
         $game_party.gain_weapon(Weapon ID, How many)
    
       For armor(s):
         $game_party.gain_armor(Armor ID, How many)
    
       For skill(s):
         $game_party.actors[Actor ID].learn_skill(Skill ID)
    
       For adding (an) actor(s):
         $game_party.add_actor(id)
    
    -------------------------------------------------------------------------------
    
       This is the verification sound
         $game_system.se_play($data_system.decision_se)
    
    -------------------------------------------------------------------------------
    
        Your cheat can have a maximum of 17 letters.
        The first cheat has to start with 'if'.
        The cheates coming after that have to start with 'elsif'.
    
    ===============================================================================
     
  10. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Sao không thấy mấy bài còn lại đâu hết rồi anh Ken .Thôi cứ tiếp tục post tiếp .Sau đây là Menu dạng FF X-2 cái này coi bộ cũng nặng cân lắm đây .
    Hêre Script :
    Mã:
    #=========================================================
    # This is the ffx-2 Custom Menu System by Catchm.
    # It is a long script and includes many alterations and images attached to it.
    # These images can be edited, and the script can be edited, you are free to do so
    # credit to Catchm is the only thing needed.
    # this is to be copied into a new script in the script editor
    #
    # Have fun with the script!
    #=========================================================
    
    class Bitmap
    def draw_text_shadow_rect(rect, text, align = 0)
      self.font.size -= 2
      old_col = self.font.color.clone
      # Dark shadow
      self.font.color = Color.new(0,0,0, 255)
      draw_text(Rect.new(rect.x+1, rect.y+1, rect.width,
        rect.height), text, align)
      # Small outline
      self.font.color = Color.new(96,96,96,96)
      draw_text(Rect.new(rect.x+1, rect.y, rect.width,
        rect.height), text, align)
      draw_text(Rect.new(rect.x-1, rect.y, rect.width,
        rect.height), text, align)
      draw_text(Rect.new(rect.x, rect.y-1, rect.width,
        rect.height), text, align)
      draw_text(Rect.new(rect.x, rect.y+1, rect.width,
        rect.height), text, align)
      # Normal text
      self.font.color = old_col
      draw_text(rect, text, align)
      self.font.size += 2
    end
    def draw_text_shadow(x, y, wid, hei, text, align = 0)
      self.font.size -= 2
      old_col = self.font.color.clone
      # Dark shadow
      self.font.color = Color.new(0,0,0, 255)
      draw_text(x+1,y+1,wid,hei,text, align)
      # Small outline
      self.font.color = Color.new(96,96,96,96)
      draw_text(x+1,y,wid,hei,text, align)
      draw_text(x+2,y,wid,hei,text, align)
      draw_text(x+2,y,wid,hei,text, align)
      draw_text(x,y-1,wid,hei,text, align)
      draw_text(x,y+1,wid,hei,text, align)
      draw_text(x,y+2,wid,hei,text, align)
      # Normal
      self.font.color = old_col
      draw_text(x,y,wid,hei,text, align)
      self.font.size += 2
    end
    def draw_text_outline(x, y, wid, hei, text, align = 0)
      self.font.color = Color.new(0, 0, 0, 255)
        draw_text(x + 1,y + 1,wid,hei,text, align)
        draw_text(x + 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y + 1,wid,hei,text, align)
       self.font.color = Color.new(255, 255, 255, 255)
        draw_text(x,y,wid,hei,text, align)
      end
    def draw_text_outline2(x, y, wid, hei, text, align = 0)
      self.font.color = Color.new(0, 0, 0, 255)
        draw_text(x + 1,y + 1,wid,hei,text, align)
        draw_text(x + 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y + 1,wid,hei,text, align)
       self.font.color = Color.new(255, 255, 255, 200)
        draw_text(x,y,wid,hei,text, align)
      end
      def draw_text_outline3(x, y, wid, hei, text, align = 0)
      self.font.color = Color.new(0, 0, 0, 255)
        draw_text(x + 1,y + 1,wid,hei,text, align)
        draw_text(x + 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y + 1,wid,hei,text, align)
       self.font.color = Color.new(192, 224, 255, 255)
        draw_text(x,y,wid,hei,text, align)
      end
      def draw_text_outline4(x, y, wid, hei, text, align = 0)
      self.font.color = Color.new(0, 0, 0, 190)
        draw_text(x + 1,y + 1,wid,hei,text, align)
        draw_text(x + 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y - 1,wid,hei,text, align)
        draw_text(x - 1,y + 1,wid,hei,text, align)
       self.font.color = Color.new(255, 255, 255, 255)
        draw_text(x,y,wid,hei,text, align)
      end
    end
    class Window_Base < Window
      #=====================================
      # Gradient Bars , thanks to Acedent Prone
      def draw_normal_barz(x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
       if type == "horizontal"
         width = length
         height = thick
         self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))
         self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
         w = width * e1 / e2
         for i in 0..height
         r = c1.red + (c2.red - c1.red)   * (height -i)/height  + 0   * i/height
         g = c1.green + (c2.green - c1.green) * (height -i)/height  + 0 * i/height
         b = c1.blue + (c2.blue - c1.blue)  * (height -i)/height  + 0 * i/height
         a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height  + 255 * i/height
         self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
       end
     elsif type == "vertical"
       width = thick
       height = length
         self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
         self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
       h = height * e1 / e2
       for i in 0..width
         r = c1.red + (c2.red - c1.red)   * (width -i)/width  + 0   * i/width
         g = c1.green + (c2.green - c1.green) * (width -i)/width  + 0 * i/width
         b = c1.blue + (c2.blue - c1.blue)  * (width -i)/width  + 0 * i/width
         a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width  + 255 * i/width
         self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
       end
     end
    end
    def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
       if type == "horizontal"
         width = length
         height = thick
         self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 255))
         self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
         w = width * e1 / e2
         for i in 0..height
         r = c1.red + (c2.red - c1.red)   * (height -i)/height  + 0   * i/height
         g = c1.green + (c2.green - c1.green) * (height -i)/height  + 0 * i/height
         b = c1.blue + (c2.blue - c1.blue)  * (height -i)/height  + 0 * i/height
         a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height  + 255 * i/height
         self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
       end
     elsif type == "vertical"
       width = thick
       height = length
         self.contents.fill_rect(x-1, y - 1, width+3, height + 2, Color.new(255, 255, 255, 255))
         self.contents.fill_rect(x, y, width+1, height , Color.new(0, 0, 0, 255))
       h = height * e1 / e2
       for i in 0..width
         r = c1.red + (c2.red - c1.red)   * (width -i)/width  + 0   * i/width
         g = c1.green + (c2.green - c1.green) * (width -i)/width  + 0 * i/width
         b = c1.blue + (c2.blue - c1.blue)  * (width -i)/width  + 0 * i/width
         a = c1.alpha + (c2.alpha - c1.alpha)* (width -i)/width  + 255 * i/width
         self.contents.fill_rect(x+i, y, 1, h, Color.new(r, g, b, a))
       end
     end
    end
      #=====================================
      # New definitions
      def draw_battlegraphic(actor, x, y)
      bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
      cw = bitmap.width
      ch = bitmap.height
      src_rect = Rect.new(0, 0, cw, ch)
      self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
    end
    #======================================
        def draw_actor_statuswindow(actor, x, y)
         bitmap = RPG::Cache.picture(actor.character_name, actor.character_hue)
        cw = bitmap.width / 4
        ch = bitmap.height / 4
        src_rect = Rect.new(0, 0, cw, ch)
        self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
      end
      #=====================================
      def draw_actor_face(actor, x, y)
      face = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
      fw = face.width
      fh = face.height
      src_rect = Rect.new(0, 0, fw, fh)
      self.contents.blt(x - fw / 23, y - fh, face, src_rect)
    end
      #=====================================
      def draw_actor_name2(actor, x, y)
        self.contents.font.name = $fontface
        self.contents.font.color = outline_color
        self.contents.draw_text(x - 1, y - 1, 120, 32, actor.name)
        self.contents.draw_text(x + 1, y - 1, 120, 32, actor.name)
        self.contents.draw_text(x + 1, y + 1, 120, 32, actor.name)
        self.contents.draw_text(x - 1, y + 1, 120, 32, actor.name)
        self.contents.font.color = normal_color
        self.contents.draw_text(x, y, 120, 32, actor.name)
      end
      #=====================================
      def draw_actor_level2(actor, x, y)
        self.contents.font.name = $fontface
        self.contents.font.color = outline_color
        self.contents.draw_text(x - 1, y - 1, 32, 32, "Lv")
        self.contents.draw_text(x - 1, y + 1, 32, 32, "Lv")
        self.contents.draw_text(x + 1, y - 1, 32, 32, "Lv")
        self.contents.draw_text(x + 1, y + 1, 32, 32, "Lv")
        self.contents.font.color = Color.new(254, 230, 159, 255)
        self.contents.draw_text(x, y, 32, 32, "Lv")
        self.contents.font.color = outline_color
        self.contents.draw_text(x + 31, y + 1, 24, 32, actor.level.to_s, 2)
        self.contents.draw_text(x + 31, y - 1, 24, 32, actor.level.to_s, 2)
        self.contents.draw_text(x + 33, y + 1, 24, 32, actor.level.to_s, 2)
        self.contents.draw_text(x + 33, y - 1, 24, 32, actor.level.to_s, 2)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
      end
      #=====================================
      def draw_actor_class2(actor, x, y)
        self.contents.font.name = "Black Chancery"
        self.contents.font.color = outline_color
        self.contents.draw_text(x + 1, y + 1, 236, 32, actor.class_name)
        self.contents.draw_text(x + 1, y - 1, 236, 32, actor.class_name)
        self.contents.draw_text(x - 1, y + 1, 236, 32, actor.class_name)
        self.contents.draw_text(x - 1, y - 1, 236, 32, actor.class_name)
        self.contents.font.color = Color.new(238, 139, 254, 255)
        self.contents.draw_text(x, y, 236, 32, actor.class_name)
      end
      #======================================
      def draw_actor_hp2(actor, x, y, width = 144)
        self.contents.font.name = "Tahoma"
        # 文字列 "HP" を描画
        self.contents.font.size = 24
        self.contents.font.color = outline_color
        self.contents.draw_text(x + 1, y + 1, 32, 32, $data_system.words.hp)
        self.contents.draw_text(x + 1, y - 1, 32, 32, $data_system.words.hp)
        self.contents.draw_text(x - 1, y - 1, 32, 32, $data_system.words.hp)
        self.contents.draw_text(x - 1, y + 1, 32, 32, $data_system.words.hp)
        self.contents.font.color = Color.new(254, 238, 189, 255)
        self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
        # MaxHP を描画するスペースがあるか計算
        if width - 32 >= 108
          hp_x = x + width - 108
          flag = true
        elsif width - 32 >= 48
          hp_x = x + width - 48
          flag = false
        end
        # HP を描画
           self.contents.font.name = $fontface
           self.contents.font.size = $fontsize
           self.contents.font.color = outline_color
           self.contents.draw_text(hp_x - 1, y - 1, 48, 32, actor.hp.to_s, 2)
           self.contents.draw_text(hp_x - 1, y + 1, 48, 32, actor.hp.to_s, 2)
           self.contents.draw_text(hp_x + 1, y + 1, 48, 32, actor.hp.to_s, 2)
           self.contents.draw_text(hp_x + 1, y - 1, 48, 32, actor.hp.to_s, 2)
        self.contents.font.color = actor.hp == 0 ? knockout_color :
          actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
        self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
        # MaxHP を描画
        if flag
          self.contents.font.color = outline_color
          self.contents.draw_text(hp_x + 60 - 1, y - 1, 48, 32, actor.maxhp.to_s)
          self.contents.draw_text(hp_x + 60 - 1, y + 1, 48, 32, actor.maxhp.to_s)
          self.contents.draw_text(hp_x + 60 + 1, y - 1, 48, 32, actor.maxhp.to_s)
          self.contents.draw_text(hp_x + 60 + 1, y + 1, 48, 32, actor.maxhp.to_s)
          self.contents.draw_text(hp_x + 48 - 1, y - 1, 12, 32, "/", 1)
          self.contents.draw_text(hp_x + 48 + 1, y + 1, 12, 32, "/", 1)
          self.contents.draw_text(hp_x + 48 - 1, y + 1, 12, 32, "/", 1)
          self.contents.draw_text(hp_x + 48 + 1, y - 1, 12, 32, "/", 1)
          self.contents.font.color = normal_color
          self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
          self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
        end
      end
      #============================================
      def draw_actor_sp2(actor, x, y, width = 144)
        self.contents.font.name = "Tahoma"
        # 文字列 "SP" を描画
        self.contents.font.size = 24
        self.contents.font.color = outline_color
        self.contents.draw_text(x + 1, y + 1, 32, 32, $data_system.words.sp)
        self.contents.draw_text(x + 1, y - 1, 32, 32, $data_system.words.sp)
        self.contents.draw_text(x - 1, y - 1, 32, 32, $data_system.words.sp)
        self.contents.draw_text(x - 1, y + 1, 32, 32, $data_system.words.sp)
        self.contents.font.color = Color.new(74, 230, 51, 225)
        self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
        # MaxSP を描画するスペースがあるか計算
        if width - 32 >= 108
          sp_x = x + width - 108
          flag = true
        elsif width - 32 >= 48
          sp_x = x + width - 48
          flag = false
        end
        # SP を描画
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.contents.font.color = outline_color
        self.contents.draw_text(sp_x - 1, y - 1, 48, 32, actor.sp.to_s, 2)
        self.contents.draw_text(sp_x - 1, y + 1, 48, 32, actor.sp.to_s, 2)
        self.contents.draw_text(sp_x + 1, y - 1, 48, 32, actor.sp.to_s, 2)
        self.contents.draw_text(sp_x + 1, y + 1, 48, 32, actor.sp.to_s, 2)
        self.contents.font.color = actor.sp == 0 ? knockout_color :
          actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
        self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
        # MaxSP を描画
        if flag
          self.contents.font.color = outline_color
          self.contents.draw_text(sp_x + 60 - 1, y - 1, 48, 32, actor.maxsp.to_s)
          self.contents.draw_text(sp_x + 60 - 1, y + 1, 48, 32, actor.maxsp.to_s)
          self.contents.draw_text(sp_x + 60 + 1, y + 1, 48, 32, actor.maxsp.to_s)
          self.contents.draw_text(sp_x + 60 + 1, y - 1, 48, 32, actor.maxsp.to_s)
          self.contents.draw_text(sp_x + 48 - 1, y - 1, 12, 32, "/", 1)
          self.contents.draw_text(sp_x + 48 - 1, y - 1, 12, 32, "/", 1)
          self.contents.draw_text(sp_x + 48 + 1, y + 1, 12, 32, "/", 1)
          self.contents.draw_text(sp_x + 48 + 1, y + 1, 12, 32, "/", 1)
          self.contents.font.color = normal_color
          self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
          self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
        end
      end
      #=========================================
      def draw_actor_state2(actor, x, y, width = 120)
        self.contents.font.name = $fontface
        text = make_battler_state_text(actor, width, true)
        self.contents.font.color = outline_color
        self.contents.draw_text(x - 1, y - 1, width, 32, text)
        self.contents.draw_text(x - 1, y + 1, width, 32, text)
        self.contents.draw_text(x + 1, y + 1, width, 32, text)
        self.contents.draw_text(x + 1, y - 1, width, 32, text)
        self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
        self.contents.draw_text(x, y, width, 32, text)
      end
        #=====================================
      def draw_actor_parameter2(actor, x, y, type)
        case type
        when 0
          parameter_name = $data_system.words.atk
          parameter_value = actor.atk
        when 1
          parameter_name = $data_system.words.pdef
          parameter_value = actor.pdef
        when 2
          parameter_name = "Magic Def"
          parameter_value = actor.mdef
        when 3
          parameter_name = $data_system.words.str
          parameter_value = actor.str
        when 4
          parameter_name = $data_system.words.dex
          parameter_value = actor.dex
        when 5
          parameter_name = $data_system.words.agi
          parameter_value = actor.agi
        when 6
          parameter_name = $data_system.words.int
          parameter_value = actor.int
        end
        self.contents.font.color = system_color
        self.contents.draw_text_outline(x, y, 120, 32, parameter_name)
        self.contents.font.color = normal_color
        self.contents.draw_text_outline(x + 130, y, 36, 32, parameter_value.to_s, 2)
      end
      #=========================================
      def draw_item_name2(item, x, y)
        if item == nil
           self.contents.draw_text_outline(x + 28, y, 212, 32, "EMPTY")
          return
        end
        bitmap = RPG::Cache.icon(item.icon_name)
        self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
        self.contents.draw_text_outline(x + 28, y, 212, 32, item.name)
      end
       # New colour for outlining text - Black
      def outline_color
       return Color.new(0, 0, 0, 255)
     end
      end
      #==============================================================================
    # ■ Window_Selectable
    #------------------------------------------------------------------------------
    #  カーソルの移動やスクロールの機能を持つウィンドウクラスです。
    #==============================================================================
    
    class Window_Itemselectable < Window_Base
      #--------------------------------------------------------------------------
      # ● 公開インスタンス変数
      #--------------------------------------------------------------------------
      attr_reader   :index                    # カーソル位置
      attr_reader   :help_window              # ヘルプウィンドウ
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     x      : ウィンドウの X 座標
      #     y      : ウィンドウの Y 座標
      #     width  : ウィンドウの幅
      #     height : ウィンドウの高さ
      #--------------------------------------------------------------------------
      def initialize(x, y, width, height)
        super(x, y, width, height)
        @item_max = 1
        @column_max = 1
        @index = -1
      end
      #--------------------------------------------------------------------------
      # ● カーソル位置の設定
      #     index : 新しいカーソル位置
      #--------------------------------------------------------------------------
      def index=(index)
        @index = index
        # ヘルプテキストを更新 (update_help は継承先で定義される)
        if self.active and @help_window != nil
          update_help
        end
        # カーソルの矩形を更新
        update_cursor_rect
      end
      #--------------------------------------------------------------------------
      # ● 行数の取得
      #--------------------------------------------------------------------------
      def row_max
        # 項目数と列数から行数を算出
        return (@item_max + @column_max - 1) / @column_max
      end
      #--------------------------------------------------------------------------
      # ● 先頭の行の取得
      #--------------------------------------------------------------------------
      def top_row
        # ウィンドウ内容の転送元 Y 座標を、1 行の高さ 32 で割る
        return self.oy / 32
      end
      #--------------------------------------------------------------------------
      # ● 先頭の行の設定
      #     row : 先頭に表示する行
      #--------------------------------------------------------------------------
      def top_row=(row)
        # row が 0 未満の場合は 0 に修正
        if row < 0
          row = 0
        end
        # row が row_max - 1 超の場合は row_max - 1 に修正
        if row > row_max - 1
          row = row_max - 1
        end
        # row に 1 行の高さ 32 を掛け、ウィンドウ内容の転送元 Y 座標とする
        self.oy = row * 32
      end
      #--------------------------------------------------------------------------
      # ● 1 ページに表示できる行数の取得
      #--------------------------------------------------------------------------
      def page_row_max
        # ウィンドウの高さから、フレームの高さ 32 を引き、1 行の高さ 32 で割る
        return (self.height - 32) / 32
      end
      #--------------------------------------------------------------------------
      # ● 1 ページに表示できる項目数の取得
      #--------------------------------------------------------------------------
      def page_item_max
        # 行数 page_row_max に 列数 @column_max を掛ける
        return page_row_max * @column_max
      end
      #--------------------------------------------------------------------------
      # ● ヘルプウィンドウの設定
      #     help_window : 新しいヘルプウィンドウ
      #--------------------------------------------------------------------------
      def help_window=(help_window)
        @help_window = help_window
        # ヘルプテキストを更新 (update_help は継承先で定義される)
        if self.active and @help_window != nil
          update_help
        end
      end
      #--------------------------------------------------------------------------
      # ● カーソルの矩形更新
      #--------------------------------------------------------------------------
      def update_cursor_rect
        # カーソル位置が 0 未満の場合
        if @index < 0
          self.cursor_rect.empty
          return
        end
        # 現在の行を取得
        row = @index / @column_max
        # 現在の行が、表示されている先頭の行より前の場合
        if row < self.top_row
          # 現在の行が先頭になるようにスクロール
          self.top_row = row
        end
        # 現在の行が、表示されている最後尾の行より後ろの場合
        if row > self.top_row + (self.page_row_max - 1)
          # 現在の行が最後尾になるようにスクロール
          self.top_row = row - (self.page_row_max - 1)
        end
        # カーソルの幅を計算
        cursor_width = self.width / @column_max - 32
        # カーソルの座標を計算
        x = @index % @column_max * (cursor_width + 6) + 10
        y = @index / @column_max * 32 - self.oy
        # カーソルの矩形を更新
        self.cursor_rect.set(x, y, cursor_width, 32)
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        super
        # カーソルの移動が可能な状態の場合
        if self.active and @item_max > 0 and @index >= 0
          # 方向ボタンの下が押された場合
          if Input.repeat?(Input::DOWN)
            # 列数が 1 かつ 方向ボタンの下の押下状態がリピートでない場合か、
            # またはカーソル位置が(項目数 - 列数)より前の場合
            if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
               @index < @item_max - @column_max
              # カーソルを下に移動
              $game_system.se_play($data_system.cursor_se)
              @index = (@index + @column_max) % @item_max
            end
          end
          # 方向ボタンの上が押された場合
          if Input.repeat?(Input::UP)
            # 列数が 1 かつ 方向ボタンの上の押下状態がリピートでない場合か、
            # またはカーソル位置が列数より後ろの場合
            if (@column_max == 1 and Input.trigger?(Input::UP)) or
               @index >= @column_max
              # カーソルを上に移動
              $game_system.se_play($data_system.cursor_se)
              @index = (@index - @column_max + @item_max) % @item_max
            end
          end
          # 方向ボタンの右が押された場合
          if Input.repeat?(Input::RIGHT)
            # 列数が 2 以上で、カーソル位置が(項目数 - 1)より前の場合
            if @column_max >= 2 and @index < @item_max - 1
              # カーソルを右に移動
              $game_system.se_play($data_system.cursor_se)
              @index += 1
            end
          end
          # 方向ボタンの左が押された場合
          if Input.repeat?(Input::LEFT)
            # 列数が 2 以上で、カーソル位置が 0 より後ろの場合
            if @column_max >= 2 and @index > 0
              # カーソルを左に移動
              $game_system.se_play($data_system.cursor_se)
              @index -= 1
            end
          end
          # R ボタンが押された場合
          if Input.repeat?(Input::R)
            # 表示されている最後尾の行が、データ上の最後の行よりも前の場合
            if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
              # カーソルを 1 ページ後ろに移動
              $game_system.se_play($data_system.cursor_se)
              @index = [@index + self.page_item_max, @item_max - 1].min
              self.top_row += self.page_row_max
            end
          end
          # L ボタンが押された場合
          if Input.repeat?(Input::L)
            # 表示されている先頭の行が 0 より後ろの場合
            if self.top_row > 0
              # カーソルを 1 ページ前に移動
              $game_system.se_play($data_system.cursor_se)
              @index = [@index - self.page_item_max, 0].max
              self.top_row -= self.page_row_max
            end
          end
        end
        # ヘルプテキストを更新 (update_help は継承先で定義される)
        if self.active and @help_window != nil
          update_help
        end
        # カーソルの矩形を更新
        update_cursor_rect
      end
    end
    #==============================================================================
    # ■ Window_Menuselectable
    #------------------------------------------------------------------------------
    #  カーソルの移動やスクロールの機能を持つウィンドウクラスです。
    #==============================================================================
    
    class Window_Menuselectable < Window_Base
      #--------------------------------------------------------------------------
      # ● 公開インスタンス変数
      #--------------------------------------------------------------------------
      attr_reader   :index                    # カーソル位置
      attr_reader   :help_window              # ヘルプウィンドウ
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     x      : ウィンドウの X 座標
      #     y      : ウィンドウの Y 座標
      #     width  : ウィンドウの幅
      #     height : ウィンドウの高さ
      #--------------------------------------------------------------------------
      def initialize(x, y, width, height)
        super(x, y, width, height)
        @item_max = 1
        @column_max = 1
        @index = -1
      end
      #--------------------------------------------------------------------------
      # ● カーソル位置の設定
      #     index : 新しいカーソル位置
      #--------------------------------------------------------------------------
      def index=(index)
        @index = index
        # ヘルプテキストを更新 (update_help は継承先で定義される)
        if self.active and @help_window != nil
          update_help
        end
        # カーソルの矩形を更新
        update_cursor_rect
      end
      #--------------------------------------------------------------------------
      # ● 行数の取得
      #--------------------------------------------------------------------------
      def row_max
        # 項目数と列数から行数を算出
        return (@item_max + @column_max - 1) / @column_max
      end
      #--------------------------------------------------------------------------
      # ● 先頭の行の取得
      #--------------------------------------------------------------------------
      def top_row
        # ウィンドウ内容の転送元 Y 座標を、1 行の高さ 32 で割る
        return self.oy / 32
      end
      #--------------------------------------------------------------------------
      # ● 先頭の行の設定
      #     row : 先頭に表示する行
      #--------------------------------------------------------------------------
      def top_row=(row)
        # row が 0 未満の場合は 0 に修正
        if row < 0
          row = 0
        end
        # row が row_max - 1 超の場合は row_max - 1 に修正
        if row > row_max - 1
          row = row_max - 1
        end
        # row に 1 行の高さ 32 を掛け、ウィンドウ内容の転送元 Y 座標とする
        self.oy = row * 32
      end
      #--------------------------------------------------------------------------
      # ● 1 ページに表示できる行数の取得
      #--------------------------------------------------------------------------
      def page_row_max
        # ウィンドウの高さから、フレームの高さ 32 を引き、1 行の高さ 32 で割る
        return (self.height - 32) / 32
      end
      #--------------------------------------------------------------------------
      # ● 1 ページに表示できる項目数の取得
      #--------------------------------------------------------------------------
      def page_item_max
        # 行数 page_row_max に 列数 @column_max を掛ける
        return page_row_max * @column_max
      end
      #--------------------------------------------------------------------------
      # ● ヘルプウィンドウの設定
      #     help_window : 新しいヘルプウィンドウ
      #--------------------------------------------------------------------------
      def help_window=(help_window)
        @help_window = help_window
        # ヘルプテキストを更新 (update_help は継承先で定義される)
        if self.active and @help_window != nil
          update_help
        end
      end
      #--------------------------------------------------------------------------
      # ● カーソルの矩形更新
      #--------------------------------------------------------------------------
      def update_cursor_rect
        # カーソル位置が 0 未満の場合
        if @index < 0
          self.cursor_rect.empty
          return
        end
        # 現在の行を取得
        row = @index / @column_max
        # 現在の行が、表示されている先頭の行より前の場合
        if row < self.top_row
          # 現在の行が先頭になるようにスクロール
          self.top_row = row
        end
        # 現在の行が、表示されている最後尾の行より後ろの場合
        if row > self.top_row + (self.page_row_max - 1)
          # 現在の行が最後尾になるようにスクロール
          self.top_row = row - (self.page_row_max - 1)
        end
        # カーソルの幅を計算
        cursor_width = self.width / @column_max - 32
        # カーソルの座標を計算
        x = @index % @column_max * (cursor_width + 32)
        y = @index / @column_max * 40 - self.oy
        # カーソルの矩形を更
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        super
        # カーソルの移動が可能な状態の場合
        if self.active and @item_max > 0 and @index >= 0
          # 方向ボタンの下が押された場合
          if Input.repeat?(Input::DOWN)
            # 列数が 1 かつ 方向ボタンの下の押下状態がリピートでない場合か、
            # またはカーソル位置が(項目数 - 列数)より前の場合
            if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
               @index < @item_max - @column_max
              # カーソルを下に移動
              $game_system.se_play($data_system.cursor_se)
              @index = (@index + @column_max) % @item_max
            end
          end
          # 方向ボタンの上が押された場合
          if Input.repeat?(Input::UP)
            # 列数が 1 かつ 方向ボタンの上の押下状態がリピートでない場合か、
            # またはカーソル位置が列数より後ろの場合
            if (@column_max == 1 and Input.trigger?(Input::UP)) or
               @index >= @column_max
              # カーソルを上に移動
              $game_system.se_play($data_system.cursor_se)
              @index = (@index - @column_max + @item_max) % @item_max
            end
          end
          # 方向ボタンの右が押された場合
          if Input.repeat?(Input::RIGHT)
            # 列数が 2 以上で、カーソル位置が(項目数 - 1)より前の場合
            if @column_max >= 2 and @index < @item_max - 1
              # カーソルを右に移動
              $game_system.se_play($data_system.cursor_se)
              @index += 1
            end
          end
          # 方向ボタンの左が押された場合
          if Input.repeat?(Input::LEFT)
            # 列数が 2 以上で、カーソル位置が 0 より後ろの場合
            if @column_max >= 2 and @index > 0
              # カーソルを左に移動
              $game_system.se_play($data_system.cursor_se)
              @index -= 1
            end
          end
          # R ボタンが押された場合
          if Input.repeat?(Input::R)
            # 表示されている最後尾の行が、データ上の最後の行よりも前の場合
            if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
              # カーソルを 1 ページ後ろに移動
              $game_system.se_play($data_system.cursor_se)
              @index = [@index + self.page_item_max, @item_max - 1].min
              self.top_row += self.page_row_max
            end
          end
          # L ボタンが押された場合
          if Input.repeat?(Input::L)
            # 表示されている先頭の行が 0 より後ろの場合
            if self.top_row > 0
              # カーソルを 1 ページ前に移動
              $game_system.se_play($data_system.cursor_se)
              @index = [@index - self.page_item_max, 0].max
              self.top_row -= self.page_row_max
            end
          end
        end
        # ヘルプテキストを更新 (update_help は継承先で定義される)
        if self.active and @help_window != nil
          update_help
        end
        # カーソルの矩形を更新
        update_cursor_rect
      end
    end
    #==============================================================================
    # ■ Window_Menucommand
    #------------------------------------------------------------------------------
    #  一般的なコマンド選択を行うウィンドウです。
    #==============================================================================
    
    class Window_Menucommand < Window_Menuselectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     width    : ウィンドウの幅
      #     commands : コマンド文字列の配列
      #--------------------------------------------------------------------------
      def initialize(width, commands)
        # コマンドの個数からウィンドウの高さを算出
        super(0, 0, width, commands.size * 32 + 32)
        @item_max = commands.size
        @commands = commands
        self.contents = Bitmap.new(width - 32, @item_max * 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        refresh
        self.index = 0
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        for i in 0...@item_max
          draw_item(i, normal_color)
        end
      end
      #--------------------------------------------------------------------------
      # ● 項目の描画
      #     index : 項目番号
      #     color : 文字色
      #--------------------------------------------------------------------------
      def draw_item(index, color)
        self.contents.font.color = color
        rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
        self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
        self.contents.draw_text(rect, @commands[index])
      end
      #--------------------------------------------------------------------------
      # ● 項目の無効化
      #     index : 項目番号
      #--------------------------------------------------------------------------
      def disable_item(index)
        draw_item(index, disabled_color)
      end
    end
    #==============================================================================
    # ■ Window_Help
    #------------------------------------------------------------------------------
    #  スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
    #==============================================================================
    
    class Window_Menuhelp < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, - 77, 640, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = 18
        self.opacity = 0
      end
      #--------------------------------------------------------------------------
      # ● テキスト設定
      #     text  : ウィンドウに表示する文字列
      #     align : アラインメント (0..左揃え、1..中央揃え、2..右揃え)
      #--------------------------------------------------------------------------
      def set_text(text, align = 0)
        # テキストとアラインメントの少なくとも一方が前回と違っている場合
        if text != @text or align != @align
          # テキストを再描画
          self.contents.clear
          self.contents.font.color = normal_color
          self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
          @text = text
          @align = align
          @actor = nil
        end
        self.visible = true
      end
      #--------------------------------------------------------------------------
      # ● アクター設定
      #     actor : ステータスを表示するアクター
      #--------------------------------------------------------------------------
      def set_actor(actor)
        if actor != @actor
          self.contents.clear
          draw_actor_name(actor, 4, 0)
          draw_actor_state(actor, 140, 0)
          draw_actor_hp(actor, 284, 0)
          draw_actor_sp(actor, 460, 0)
          @actor = actor
          @text = nil
          self.visible = true
        end
      end
      #--------------------------------------------------------------------------
      # ● エネミー設定
      #     enemy : 名前とステートを表示するエネミー
      #--------------------------------------------------------------------------
      def set_enemy(enemy)
        text = enemy.name
        state_text = make_battler_state_text(enemy, 112, false)
        if state_text != ""
          text += "  " + state_text
        end
        set_text(text, 1)
      end
    end
    #==============================================================================
    # ■ Window_Gold
    #------------------------------------------------------------------------------
    #  ゴールドを表示するウィンドウです。
    #==============================================================================
    
    class Window_Gold < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 200, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = 21
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        cx = contents.text_size("Gold").width
        self.contents.font.color = outline_color
        self.contents.draw_text(81, - 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
        self.contents.draw_text(81, 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
        self.contents.draw_text(79, 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
        self.contents.draw_text(79, - 1, 120-cx-2, 32, $game_party.gold.to_s, 2)
        self.contents.font.color = normal_color
        self.contents.draw_text(80, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
        self.contents.font.color = outline_color
        self.contents.draw_text(- 1, - 1, cx, 32, "Gold", 2)
        self.contents.draw_text(1, 1, cx, 32, "Gold", 2)
        self.contents.draw_text(- 1, 1, cx, 32, "Gold", 2)
        self.contents.draw_text(1, - 1, cx, 32, "Gold", 2)
        self.contents.font.color = Color.new(254, 230, 159, 255)
        self.contents.draw_text(0, 0, cx, 32, "Gold", 2)
      end
    end
    #==============================================================================
    # ■ Window_PlayTime
    #------------------------------------------------------------------------------
    #  メニュー画面でプレイ時間を表示するウィンドウです。
    #==============================================================================
    
    class Window_PlayTime < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 200, 70)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = 21
        self.opacity = 0
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.contents.font.color = outline_color
        self.contents.draw_text(1, - 1, 120, 32, "Play Time")
        self.contents.draw_text(1, 1, 120, 32, "Play Time")
        self.contents.draw_text(-1, - 1, 120, 32, "Play Time")
        self.contents.draw_text(-1, 1, 120, 32, "Play Time")
        self.contents.font.color =  Color.new(254, 230, 159, 255)
        self.contents.draw_text(0, 0, 120, 32, "Play Time")
        @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.font.color = outline_color
        self.contents.draw_text(39, - 1, 120, 32, text, 2)
        self.contents.draw_text(39, 1, 120, 32, text, 2)
        self.contents.draw_text(41, 1, 120, 32, text, 2)
        self.contents.draw_text(41, -1, 120, 32, text, 2)
        self.contents.font.color = normal_color
        self.contents.draw_text(40, 0, 120, 32, text, 2)
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        super
        if Graphics.frame_count / Graphics.frame_rate != @total_sec
          refresh
        end
      end
    end
    #==============================================================================
    # ■ Window_MenuStatus
    #------------------------------------------------------------------------------
    #  メニュー画面でパーティメンバーのステータスを表示するウィンドウです。
    #==============================================================================
    
    class Window_MenuStatus < Window_Selectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 480, 430)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        refresh
        self.active = false
        self.index = -1
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        @item_max = $game_party.actors.size
        for i in 0...$game_party.actors.size
          x = 100 - i * 18
          y = i * 100
          actor = $game_party.actors[i]
          draw_actor_face(actor, x - 40, y + 80)
          draw_actor_name2(actor, x + 50, y)
          draw_actor_class2(actor, x + 50, y + 50)
          draw_actor_level2(actor, x + 50, y + 25)
          draw_actor_state2(actor, x + 155, y + 50)
          draw_actor_hp2(actor, x + 140, y )
          draw_actor_sp2(actor, x + 140, y + 25)
          draw_actor_barz(actor, x + 140, y + 25, "horizontal", 130, 1, actor.hp, actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
          draw_actor_barz(actor, x + 140, y + 50, "horizontal", 130, 1, actor.sp, actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
        end
      end
      #--------------------------------------------------------------------------
      # ● カーソルの矩形更新
      #--------------------------------------------------------------------------
      def update_cursor_rect
          self.cursor_rect.empty
     end
    end
    #==============================================================================
    # ■ Window_Item
    #------------------------------------------------------------------------------
    #  アイテム画面、バトル画面で、所持アイテムの一覧を表示するウィンドウです。
    #==============================================================================
    
    class Window_Menuitem < Window_Itemselectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, 500, 640, 380)
        @column_max = 2
        refresh
        self.index = 0
        self.opacity = 0
        # 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
        if $game_temp.in_battle
          self.y = 64
          self.height = 256
          self.back_opacity = 160
        end
      end
      #--------------------------------------------------------------------------
      # ● アイテムの取得
      #--------------------------------------------------------------------------
      def item
        return @data[self.index]
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        if self.contents != nil
          self.contents.dispose
          self.contents = nil
        end
        @data = []
        # アイテムを追加
        for i in 1...$data_items.size
          if $game_party.item_number(i) > 0
            @data.push($data_items[i])
          end
        end
        # 戦闘中以外なら武器と防具も追加
        unless $game_temp.in_battle
          for i in 1...$data_weapons.size
            if $game_party.weapon_number(i) > 0
              @data.push($data_weapons[i])
            end
          end
          for i in 1...$data_armors.size
            if $game_party.armor_number(i) > 0
              @data.push($data_armors[i])
            end
          end
        end
        # 項目数が 0 でなければビットマップを作成し、全項目を描画
        @item_max = @data.size
        if @item_max > 0
          self.contents = Bitmap.new(width - 32, row_max * 32)
          self.contents.font.name = $fontface
          self.contents.font.size = $fontsize
          for i in 0...@item_max
            draw_item(i)
          end
        end
      end
      #--------------------------------------------------------------------------
      # ● 項目の描画
      #     index : 項目番号
      #--------------------------------------------------------------------------
      def draw_item(index)
        item = @data[index]
        case item
        when RPG::Item
          number = $game_party.item_number(item.id)
        when RPG::Weapon
          number = $game_party.weapon_number(item.id)
        when RPG::Armor
          number = $game_party.armor_number(item.id)
        end
        if item.is_a?(RPG::Item) and
           $game_party.item_can_use?(item.id)
          self.contents.font.color = normal_color
        else
          self.contents.font.color = Color.new(255, 255, 255, 200)
        end
        x = 4 + index % 2 * (270 + 25) + 12
        y = index / 2 * 32
        rect = Rect.new(x, y, self.width / @column_max - 32, 32)
        self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
        bitmap = RPG::Cache.icon(item.icon_name)
        opacity = self.contents.font.color == normal_color ? 255 : 128
        self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
        if item.is_a?(RPG::Item) and
           $game_party.item_can_use?(item.id)
        self.contents.draw_text_outline(x + 28, y, 212, 32, item.name, 0)
        self.contents.draw_text_outline(x + 240, y, 16, 32, ":", 1)
        self.contents.draw_text_outline(x + 256, y, 24, 32, number.to_s, 2)
        else
        self.contents.draw_text_outline2(x + 28, y, 212, 32, item.name, 0)
        self.contents.draw_text_outline2(x + 240, y, 16, 32, ":", 1)
        self.contents.draw_text_outline2(x + 256, y, 24, 32, number.to_s, 2)
        end
      end
      #--------------------------------------------------------------------------
      # ● ヘルプテキスト更新
      #--------------------------------------------------------------------------
      def update_help
        @help_window.set_text(self.item == nil ? "" : self.item.description)
      end
    end
    #==============================================================================
    # ■ Window_Menuskill
    #------------------------------------------------------------------------------
    #
    #==============================================================================
    
    class Window_Menuskill < Window_Itemselectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(- 3, 531, 640, 352)
        @actor = actor
        @column_max = 2
        refresh
        self.index = 0
        # 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
        if $game_temp.in_battle
          self.y = 64
          self.height = 256
          self.back_opacity = 160
        end
      end
      #--------------------------------------------------------------------------
      # ● スキルの取得
      #--------------------------------------------------------------------------
      def skill
        return @data[self.index]
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        if self.contents != nil
          self.contents.dispose
          self.contents = nil
        end
        @data = []
        for i in 0...@actor.skills.size
          skill = $data_skills[@actor.skills[i]]
          if skill != nil
            @data.push(skill)
          end
        end
        # 項目数が 0 でなければビットマップを作成し、全項目を描画
        @item_max = @data.size
        if @item_max > 0
          self.contents = Bitmap.new(width - 32, row_max * 32)
          self.contents.font.name = $fontface
          self.contents.font.size = $fontsize
          for i in 0...@item_max
            draw_item(i)
          end
        end
      end
      #--------------------------------------------------------------------------
      # ● 項目の描画
      #     index : 項目番号
      #--------------------------------------------------------------------------
      def draw_item(index)
        skill = @data[index]
        if @actor.skill_can_use?(skill.id)
          self.contents.font.color = normal_color
        else
          self.contents.font.color = Color.new(255, 255, 255, 200)
        end
        x = 4 + index % 2 * (270 + 25) + 12
        y = index / 2 * 32
        rect = Rect.new(x, y, self.width / @column_max - 32, 32)
        self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
        bitmap = RPG::Cache.icon(skill.icon_name)
        opacity = self.contents.font.color == normal_color ? 255 : 128
        self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
         if @actor.skill_can_use?(skill.id)
        self.contents.draw_text_outline(x + 28, y, 204, 32, skill.name, 0)
        self.contents.draw_text_outline(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
        else
        self.contents.draw_text_outline2(x + 28, y, 204, 32, skill.name, 0)
        self.contents.draw_text_outline2(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
        end
      end
      #--------------------------------------------------------------------------
      # ● ヘルプテキスト更新
      #--------------------------------------------------------------------------
      def update_help
        @help_window.set_text(self.skill == nil ? "" : self.skill.description)
      end
    end
    #==============================================================================
    # ■ Window_SkillStatus
    #------------------------------------------------------------------------------
    #  スキル画面で、スキル使用者のステータスを表示するウィンドウです。
    #==============================================================================
    
    class Window_SkillStatus < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(630, 35, 410, 109)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.opacity = 0
        @actor = actor
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        x = 100
        y = 0
          draw_actor_face(@actor, x - 40, y + 80)
          draw_actor_name2(@actor, x + 50, y)
          draw_actor_class2(@actor, x + 50, y + 50)
          draw_actor_level2(@actor, x + 50, y + 25)
          draw_actor_state2(@actor, x + 155, y + 50)
          draw_actor_hp2(@actor, x + 140, y )
          draw_actor_sp2(@actor, x + 140, y + 25)
          draw_actor_barz(@actor, x + 140, y + 25, "horizontal", 130, 1, @actor.hp, @actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
          draw_actor_barz(@actor, x + 140, y + 50, "horizontal", 130, 1, @actor.sp, @actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
      end
    end
    #==============================================================================
    # ■ Window_Target
    #------------------------------------------------------------------------------
    #  アイテム画面とスキル画面で、使用対象のアクターを選択するウィンドウです。
    #==============================================================================
    
    class Window_Target < Window_Selectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 336, 480)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.z += 10
        @item_max = $game_party.actors.size
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        for i in 0...$game_party.actors.size
          x = 4
          y = i * 116
          actor = $game_party.actors[i]
          draw_actor_name2(actor, x, y)
          draw_actor_class2(actor, x + 144, y)
          draw_actor_level2(actor, x + 8, y + 32)
          draw_actor_state2(actor, x + 8, y + 64)
          draw_actor_hp2(actor, x + 152, y + 32)
          draw_actor_sp2(actor, x + 152, y + 64)
          draw_actor_barz(actor, x + 152, y + 57, "horizontal", 130, 1, actor.hp, actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
          draw_actor_barz(actor, x + 152, y + 89, "horizontal", 130, 1, actor.sp, actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
        end
      end
      #--------------------------------------------------------------------------
      # ● カーソルの矩形更新
      #--------------------------------------------------------------------------
      def update_cursor_rect
        # カーソル位置 -1 は全選択、-2 以下は単独選択 (使用者自身)
        if @index <= -2
          self.cursor_rect.set(0, (@index + 10) * 116, self.width - 32, 96)
        elsif @index == -1
          self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
        else
          self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
        end
      end
    end
    #==============================================================================
    # ■ Window_EquipRight
    #------------------------------------------------------------------------------
    #  装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
    #==============================================================================
    
    class Window_EquipRight < Window_Menuselectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(- 100, 125, 200, 350)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.opacity = 0
        @actor = actor
        refresh
        self.index = 0
      end
      #--------------------------------------------------------------------------
      # ● アイテムの取得
      #--------------------------------------------------------------------------
      def item
        return @data[self.index]
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        @data = []
        @data.push($data_weapons[@actor.weapon_id])
        @data.push($data_armors[@actor.armor1_id])
        @data.push($data_armors[@actor.armor2_id])
        @data.push($data_armors[@actor.armor3_id])
        @data.push($data_armors[@actor.armor4_id])
        @item_max = @data.size
        draw_item_name2(@data[0], 0, 68 * 0)
        draw_item_name2(@data[1], 0, 68 * 1)
        draw_item_name2(@data[2], 0, 68 * 2)
        draw_item_name2(@data[3], 0, 68 * 3)
        draw_item_name2(@data[4], 0, 68 * 4 - 2)
      end
      #--------------------------------------------------------------------------
      # ● ヘルプテキスト更新
      #--------------------------------------------------------------------------
      def update_help
        @help_window.set_text(self.item == nil ? "" : self.item.description)
      end
    end
    #==============================================================================
    # ■ Window_EquipItem
    #------------------------------------------------------------------------------
    #  装備画面で、装備変更の候補となるアイテムの一覧を表示するウィンドウです。
    #==============================================================================
    
    class Window_EquipItem < Window_Selectable
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor      : アクター
      #     equip_type : 装備部位 (0~3)
      #--------------------------------------------------------------------------
      def initialize(actor, equip_type)
        super(233, 573, 413, 224)
        @actor = actor
        @equip_type = equip_type
        @column_max = 2
        refresh
        self.active = false
        self.index = -1
        self.opacity = 0
      end
      #--------------------------------------------------------------------------
      # ● アイテムの取得
      #--------------------------------------------------------------------------
      def item
        return @data[self.index]
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        if self.contents != nil
          self.contents.dispose
          self.contents = nil
        end
        @data = []
        # 装備可能な武器を追加
        if @equip_type == 0
          weapon_set = $data_classes[@actor.class_id].weapon_set
          for i in 1...$data_weapons.size
            if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
              @data.push($data_weapons[i])
            end
          end
        end
        # 装備可能な防具を追加
        if @equip_type != 0
          armor_set = $data_classes[@actor.class_id].armor_set
          for i in 1...$data_armors.size
            if $game_party.armor_number(i) > 0 and armor_set.include?(i)
              if $data_armors[i].kind == @equip_type-1
                @data.push($data_armors[i])
              end
            end
          end
        end
        # 空白を追加
        @data.push(nil)
        # ビットマップを作成し、全項目を描画
        @item_max = @data.size
        self.contents = Bitmap.new(width - 32, row_max * 32)
        self.contents.font.name = $fontface
        self.contents.font.size = 22
        for i in 0...@item_max-1
          draw_item(i)
        end
      end
      #--------------------------------------------------------------------------
      # ● 項目の描画
      #     index : 項目番号
      #--------------------------------------------------------------------------
      def draw_item(index)
        item = @data[index]
        x = 4 + index % 2 * (176 + 16)
        y = index / 2 * 32
        case item
        when RPG::Weapon
          number = $game_party.weapon_number(item.id)
        when RPG::Armor
          number = $game_party.armor_number(item.id)
        end
        bitmap = RPG::Cache.icon(item.icon_name)
        self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
        self.contents.font.color = normal_color
        self.contents.draw_text_shadow(x + 28, y, 212, 32, item.name, 0)
        self.contents.draw_text_shadow(x + 140, y, 16, 32, ":", 1)
        self.contents.draw_text_shadow(x + 156, y, 24, 32, number.to_s, 2)
      end
      #--------------------------------------------------------------------------
        def update_cursor_rect
        # カーソル位置が 0 未満の場合
        if @index < 0
          self.cursor_rect.empty
          return
        end
        # 現在の行を取得
        row = @index / @column_max
        # 現在の行が、表示されている先頭の行より前の場合
        if row < self.top_row
          # 現在の行が先頭になるようにスクロール
          self.top_row = row
        end
        # 現在の行が、表示されている最後尾の行より後ろの場合
        if row > self.top_row + (self.page_row_max - 1)
          # 現在の行が最後尾になるようにスクロール
          self.top_row = row - (self.page_row_max - 1)
        end
        # カーソルの幅を計算
        cursor_width = self.width / @column_max - 32
        # カーソルの座標を計算
        x = @index % @column_max * (cursor_width + 16)
        y = @index / @column_max * 32 - self.oy
        # カーソルの矩形を更新
        self.cursor_rect.set(x + 2, y, cursor_width + 15, 32)
      end
      # ● ヘルプテキスト更新
      #--------------------------------------------------------------------------
      def update_help
        @help_window.set_text(self.item == nil ? "" : self.item.description)
      end
    end
    #==============================================================================
    # ■ Window_Status
    #------------------------------------------------------------------------------
    #  ステータス画面で表示する、フル仕様のステータスウィンドウです。
    #==============================================================================
    
    class Window_Status < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(0, 0, 418, 133)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        @actor = actor
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        draw_actor_face(@actor, 0, 90)
        draw_actor_name2(@actor, 90, 0)
        draw_actor_class2(@actor, 250, 0)
        draw_actor_level2(@actor, 90, 32)
        draw_actor_state2(@actor, 90, 64)
        draw_actor_hp2(@actor, 210, 32, 172)
        draw_actor_sp2(@actor, 210, 64, 172)
        draw_actor_barz(@actor, 210, 57, "horizontal", 158, 1, @actor.hp, @actor.maxhp, Color.new(254, 238, 189, 255), Color.new(182, 137, 2, 255))
        draw_actor_barz(@actor, 210, 89, "horizontal", 158, 1, @actor.sp, @actor.maxsp, Color.new(74, 230, 51, 225), Color.new(35, 150, 19, 225))
        end
      end
      #==============================================================================
    # ■ Window_Status2
    #------------------------------------------------------------------------------
    #  ステータス画面で表示する、フル仕様のステータスウィンドウです。
    #==============================================================================
    
    class Window_Status2 < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(0, 0, 418, 178)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        @actor = actor
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
              self.contents.font.size = 24
        draw_actor_parameter2(@actor, 0, 10, 0)
        draw_actor_parameter2(@actor, 0, 40, 1)
        draw_actor_parameter2(@actor, 0, 70, 2)
        draw_actor_parameter2(@actor, 0, 100, 3)
        draw_actor_parameter2(@actor, 190, 20, 4)
        draw_actor_parameter2(@actor, 190, 50, 5)
        draw_actor_parameter2(@actor, 190, 80, 6)
        draw_actor_barz(@actor, 0, 37, "horizontal", 168, 1, @actor.atk, 500, Color.new(242, 2, 6, 255), Color.new(253, 53, 56, 255))
        draw_actor_barz(@actor, 0, 67, "horizontal", 168, 1, @actor.pdef, 500, Color.new(228, 253, 48, 255), Color.new(238, 254, 124, 255))
        draw_actor_barz(@actor, 0, 97, "horizontal", 168, 1, @actor.mdef, 500, Color.new(229, 78, 253, 255), Color.new(237, 134, 254, 255))
        draw_actor_barz(@actor, 0, 127, "horizontal", 168, 1, @actor.str, 500, Color.new(254, 209, 154, 255), Color.new(253, 163, 53, 255))
        draw_actor_barz(@actor, 190, 47, "horizontal", 168, 1, @actor.dex, 500, Color.new(222, 222, 222, 255), Color.new(255, 255, 255, 255))
        draw_actor_barz(@actor, 190, 77, "horizontal", 168, 1, @actor.agi, 500, Color.new(8, 160, 253, 255), Color.new(119, 203, 254, 255))
        draw_actor_barz(@actor, 190, 107, "horizontal", 168, 1, @actor.int, 500, Color.new(33, 253, 86, 255), Color.new(124, 254, 155, 255))
            if @new_atk != nil
            draw_actor_barz(@actor, 0, 37, "horizontal", 168, 1, @new_atk, 500, Color.new(255, 0, 0, 255), Color.new(255, 0, 0, 255))
          end
            if @new_pdef != nil
            draw_actor_barz(@actor, 0, 67, "horizontal", 168, 1, @new_pdef, 500, Color.new(228, 253, 48, 255), Color.new(238, 254, 124, 255))
           end
            if @new_mdef != nil
            draw_actor_barz(@actor, 0, 97, "horizontal", 168, 1, @new_mdef, 500, Color.new(229, 78, 253, 255), Color.new(237, 134, 254, 255))
          end
           if  @new_str != nil
           draw_actor_barz(@actor, 0, 127, "horizontal", 168, 1, @new_str, 500, Color.new(254, 209, 154, 255), Color.new(253, 163, 53, 255))
          end
           if  @new_dex != nil
           draw_actor_barz(@actor, 190, 47, "horizontal", 168, 1, @new_dex, 500, Color.new(222, 222, 222, 255), Color.new(255, 255, 255, 255))
          end
           if  @new_agi != nil
           draw_actor_barz(@actor, 190, 77, "horizontal", 168, 1, @new_agi, 500, Color.new(8, 160, 253, 255), Color.new(119, 203, 254, 255))
         end
           if @new_int != nil
           draw_actor_barz(@actor, 190, 107, "horizontal", 168, 1, @new_int, 500, Color.new(33, 253, 86, 255), Color.new(124, 254, 155, 255))
        end
    end
        def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
        if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or
           @new_agi != new_agi or @new_int != new_int
          @new_atk = new_atk
          @new_pdef = new_pdef
          @new_mdef = new_mdef
          @new_str = new_str
          @new_dex = new_dex
          @new_agi = new_agi
          @new_int = new_int
          refresh
        end
      end
    end
    #==============================================================================
    # ■ Window_Status3
    #------------------------------------------------------------------------------
    #  ステータス画面で表示する、フル仕様のステータスウィンドウです。
    #==============================================================================
    
    class Window_Status3 < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(0, 0, 418, 229)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        @actor = actor
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.contents.font.size = 24
        self.contents.font.color = system_color
        self.contents.draw_text_outline3(150, 0, 96, 32, "Equipment")
        draw_item_name2($data_weapons[@actor.weapon_id], 15 + 16, 48)
        draw_item_name2($data_armors[@actor.armor1_id], 15 + 16, 86)
        draw_item_name2($data_armors[@actor.armor2_id], 15 + 16, 124)
        draw_item_name2($data_armors[@actor.armor3_id], 15 + 186, 68)
        draw_item_name2($data_armors[@actor.armor4_id], 15 + 186, 106)
          end
        end
        #==============================================================================
    # ■ Window_Status4
    #------------------------------------------------------------------------------
    #  ステータス画面で表示する、フル仕様のステータスウィンドウです。
    #==============================================================================
    
    class Window_Status4 < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(0, 0, 252, 100)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        @actor = actor
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        self.contents.font.size = 26
        self.contents.font.color = system_color
        self.contents.draw_text_outline3(10, 0, 80, 32, "EXP")
        self.contents.draw_text_outline3(10, 32, 80, 32, "NEXT")
        self.contents.font.color = normal_color
        self.contents.draw_text_outline(10 + 80, 0, 84, 32, @actor.exp_s, 2)
        self.contents.draw_text_outline(10 + 80, 32, 84, 32, @actor.next_rest_exp_s, 2)
          end
        end
        #==============================================================================
    # ■ Window_Status5
    #------------------------------------------------------------------------------
    #  ステータス画面で表示する、フル仕様のステータスウィンドウです。
    #==============================================================================
    
    class Window_Status5 < Window_Base
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor : アクター
      #--------------------------------------------------------------------------
      def initialize(actor)
        super(0, 0, 300, 380)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        @actor = actor
        refresh
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
           draw_battlegraphic(@actor, 100, 300)
          end
        end
        #==============================================================================
    # ■ Window_SaveFile
    #------------------------------------------------------------------------------
    #  セーブ画面およびロード画面で表示する、セーブファイルのウィンドウです。
    #==============================================================================
    
    class Window_SaveFile < Window_Base
      #--------------------------------------------------------------------------
      # ● 公開インスタンス変数
      #--------------------------------------------------------------------------
      attr_reader   :filename                 # ファイル名
      attr_reader   :selected                 # 選択状態
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     file_index : セーブファイルのインデックス (0~3)
      #     filename   : ファイル名
      #--------------------------------------------------------------------------
      def initialize(file_index, filename)
        super(0, 64 + file_index % 4 * 104, 640, 104)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        self.opacity = 0
        @file_index = file_index
        @filename = "Save#{@file_index + 1}.rxdata"
        @time_stamp = Time.at(0)
        @file_exist = FileTest.exist?(@filename)
        if @file_exist
          file = File.open(@filename, "r")
          @time_stamp = file.mtime
          @characters = Marshal.load(file)
          @frame_count = Marshal.load(file)
          @game_system = Marshal.load(file)
          @game_switches = Marshal.load(file)
          @game_variables = Marshal.load(file)
          @total_sec = @frame_count / Graphics.frame_rate
          file.close
        end
        refresh
        @selected = false
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        self.contents.clear
        # ファイル番号を描画
        self.contents.font.color = normal_color
        name = "File #{@file_index + 1}"
        self.contents.draw_text_outline(4, 0, 600, 32, name)
        @name_width = contents.text_size(name).width
        # セーブファイルが存在する場合
        if @file_exist
          # キャラクターを描画
          for i in 0...@characters.size
            bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
            cw = bitmap.rect.width / 4
            ch = bitmap.rect.height / 4
            src_rect = Rect.new(0, 0, cw, ch)
            x = 300 - @characters.size * 32 + i * 64 - cw / 2
            self.contents.blt(x, 68 - ch, bitmap, src_rect)
          end
          # プレイ時間を描画
          hour = @total_sec / 60 / 60
          min = @total_sec / 60 % 60
          sec = @total_sec % 60
          time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
          self.contents.font.color = normal_color
          self.contents.draw_text_outline(4, 8, 600, 32, time_string, 2)
          # タイムスタンプを描画
          self.contents.font.color = normal_color
          time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
          self.contents.draw_text_outline(4, 40, 600, 32, time_string, 2)
        end
      end
      #--------------------------------------------------------------------------
      # ● 選択状態の設定
      #     selected : 新しい選択状態 (true=選択 false=非選択)
      #--------------------------------------------------------------------------
      def selected=(selected)
        @selected = selected
        update_cursor_rect
      end
      #--------------------------------------------------------------------------
      # ● カーソルの矩形更新
      #--------------------------------------------------------------------------
      def update_cursor_rect
        if @selected
          self.cursor_rect.set(0, 0, @name_width + 8, 32)
        else
          self.cursor_rect.empty
        end
      end
    end
    #==============================================================================
    # ■ Window_Location
    #------------------------------------------------------------------------------
    #  メニュー画面で歩数を表示するウィンドウです。
    class Game_Map
    
    def name
     $map_infos[@map_id]
    end
    end
    
    class Scene_Title
    $map_infos = load_data("Data/MapInfos.rxdata")
    for key in $map_infos.keys
     $map_infos[key] = $map_infos[key].name
    end
    end
    
    
    #==============================================================================
    # ■ Window_Mapname
    #------------------------------------------------------------------------------
    #  メニュー画面でプレイ時間を表示するウィンドウです。
    #==============================================================================
    
    class Window_Mapname < Window_Base
    #--------------------------------------------------------------------------
    # ● オブジェクト初期化
    #--------------------------------------------------------------------------
    def initialize
     super(0, 0, 240, 96)
     self.contents = Bitmap.new(width - 52, height - 32)
     self.contents.font.name = $fontface
     self.contents.font.size = $fontsize
     self.opacity = 0
     refresh
    end
    #--------------------------------------------------------------------------
    # ● リフレッシュ
    #--------------------------------------------------------------------------
    def refresh
     self.contents.clear
     # Map Name
     #map = $game_map.name
     self.contents.font.color = system_color
     self.contents.font.size = 14
     self.contents.draw_text(4, 0, 220, 32, "Location")
      self.contents.font.size = $fontsize
     self.contents.font.color = normal_color
     self.contents.draw_text(110, 15, 80, 32, $game_map.name)
    end
    end
    #==================================================
    class Window_End < Window_Base
    
    def initialize
     super(0, 0, 240, 150)
     self.contents = Bitmap.new(width - 52, height - 32)
     self.contents.font.name = $fontface
     self.contents.font.size = 30
     self.opacity = 0
     refresh
    end
    #--------------------------------------------------------------------------
    # ● リフレッシュ
    #--------------------------------------------------------------------------
    def refresh
      self.contents.clear
      self.contents.draw_text_outline(24, 0, 240, 32, "To Title")
      self.contents.draw_text_outline(10, 45, 240, 32, "Shutdown")
      self.contents.draw_text_outline(25, 85, 240, 32, "Cancel")
    end
    #==========================================
    end
    #==============================================================================
    # ■ Scene_Menu
    #------------------------------------------------------------------------------
    #  メニュー画面の処理を行うクラスです。
    #==============================================================================
    
    class Scene_Menu
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     menu_index : コマンドのカーソル初期位置
      #--------------------------------------------------------------------------
      def initialize(menu_index = 0)
        @menu_index = menu_index
      end
      #--------------------------------------------------------------------------
      # ● メイン処理
      #--------------------------------------------------------------------------
      def main
        #========================================
        # This is setting up the background picture
        @background = Sprite.new
        @background.bitmap = RPG::Cache.picture("background")
        @background.x = 0
        @background.y = 0
        #========================================
        # This is setting up the command pictures for 'item' etc..
        @command1 = Sprite.new
        @command1.bitmap = RPG::Cache.picture("cmscommand1")
        @command1.x = 15
        @command1.y = 40
        @command1.z = 100
        #========================================
        @command2 = Sprite.new
        @command2.bitmap = RPG::Cache.picture("cmscommand2")
        @command2.x = 15
        @command2.y = 40
        @command2.z = 100
        #========================================
        @command3 = Sprite.new
        @command3.bitmap = RPG::Cache.picture("cmscommand3")
        @command3.x = 15
        @command3.y = 40
        @command3.z = 100
        #========================================
        @command4 = Sprite.new
        @command4.bitmap = RPG::Cache.picture("cmscommand4")
        @command4.x = 15
        @command4.y = 40
        @command4.z = 100
        #========================================
        @command5 = Sprite.new
        @command5.bitmap = RPG::Cache.picture("cmscommand5")
        @command5.x = 15
        @command5.y = 40
        @command5.z = 100
        #========================================
        @command6 = Sprite.new
        @command6.bitmap = RPG::Cache.picture("cmscommand6")
        @command6.x = 15
        @command6.y = 40
        @command6.z = 100
        #========================================
        # This setting up the shadows for the commands.
        @commands1 = Sprite.new
        @commands1.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands1.x = 20
        @commands1.y = 45
        @commands1.z = 1
        @commands1.opacity = 155
        @commands1.visible = false
        #========================================
        @commands2 = Sprite.new
        @commands2.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands2.x = 20
        @commands2.y = 45
        @commands2.z = 1
        @commands2.opacity = 155
        @commands2.visible = false
        #========================================
        @commands3 = Sprite.new
        @commands3.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands3.x = 20
        @commands3.y = 45
        @commands3.z = 1
        @commands3.opacity = 155
        @commands3.visible = false
        #========================================
        @commands4 = Sprite.new
        @commands4.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands4.x = 20
        @commands4.y = 45
        @commands4.z = 1
        @commands4.opacity = 155
        @commands4.visible = false
        #========================================
        @commands5 = Sprite.new
        @commands5.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands5.x = 20
        @commands5.y = 45
        @commands5.z = 1
        @commands5.opacity = 155
        @commands5.visible = false
        #========================================
        @commands6 = Sprite.new
        @commands6.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands6.x = 20
        @commands6.y = 45
        @commands6.z = 1
        @commands6.opacity = 155
        @commands6.visible = false
        #========================================
        # This is setting up the arrow cursor used in the command window..
        @arrow = Sprite.new
        @arrow.bitmap = RPG::Cache.picture("arrow4")
        @arrow.x = 0
        @arrow.y = 45
        @arrow.z = 1000
        #========================================
        # This is setting up the arrow for the status window
        @arrow_status = Sprite.new
        @arrow_status.bitmap = RPG::Cache.picture("arrow4")
        @arrow_status.x = 260
        @arrow_status.y = 37
        @arrow_status.z = 1000
        @arrow_status.visible = false
        #========================================
        # This is setting up the status windows, making them not visible for the moment..
        @status_window1 = Sprite.new
        @status_window1.bitmap = RPG::Cache.picture("status window 1")
        @status_window1.x = 693
        @status_window1.y = 7
        @status_window1.z = 100
        @status_window1.visible = false
        #========================================
        @status_window2 = Sprite.new
        @status_window2.bitmap = RPG::Cache.picture("status window 2")
        @status_window2.x = 676
        @status_window2.y = 106
        @status_window2.z = 100
        @status_window2.visible = false
        #========================================
        @status_window3 = Sprite.new
        @status_window3.bitmap = RPG::Cache.picture("status window 3")
        @status_window3.x = 659
        @status_window3.y = 206
        @status_window3.z = 100
        @status_window3.visible = false
        #========================================
        @status_window4 = Sprite.new
        @status_window4.bitmap = RPG::Cache.picture("status window 4")
        @status_window4.x = 640
        @status_window4.y = 306
        @status_window4.z = 100
        @status_window4.visible = false
        #========================================
        # The shadows are set up for the status windows..
        @status_windowshadow1 = Sprite.new
        @status_windowshadow1.bitmap = RPG::Cache.picture("blackwindow2")
        @status_windowshadow1.x = 697
        @status_windowshadow1.y = 13
        @status_windowshadow1.z = 1
        @status_windowshadow1.opacity = 155
        @status_windowshadow1.visible = false
        #========================================
        @status_windowshadow2 = Sprite.new
        @status_windowshadow2.bitmap = RPG::Cache.picture("blackwindow2")
        @status_windowshadow2.x = 681
        @status_windowshadow2.y = 112
        @status_windowshadow2.z = 1
        @status_windowshadow2.opacity = 155
        @status_windowshadow2.visible = false
        #========================================
        @status_windowshadow3 = Sprite.new
        @status_windowshadow3.bitmap = RPG::Cache.picture("blackwindow2")
        @status_windowshadow3.x = 664
        @status_windowshadow3.y = 212
        @status_windowshadow3.z = 1
        @status_windowshadow3.opacity = 155
        @status_windowshadow3.visible = false
        #========================================
        @status_windowshadow4 = Sprite.new
        @status_windowshadow4.bitmap = RPG::Cache.picture("blackwindow2")
        @status_windowshadow4.x = 645
        @status_windowshadow4.y = 312
        @status_windowshadow4.z = 1
        @status_windowshadow4.opacity = 155
        @status_windowshadow4.visible = false
        #========================================
        # Here, certain status window pictures are made visible depending on 
        # how many actors or players there are..
        if $game_party.actors.size == 1
          @status_window1.visible = true
          @status_windowshadow1.visible = true
        end
         if $game_party.actors.size == 2
           @status_window1.visible = true
           @status_windowshadow1.visible = true
           @status_window2.visible = true
           @status_windowshadow2.visible = true
         end
         if $game_party.actors.size == 3
           @status_window1.visible = true
           @status_windowshadow1.visible = true
           @status_window2.visible = true
           @status_windowshadow2.visible = true
           @status_window3.visible = true
           @status_windowshadow3.visible = true
         end
          if $game_party.actors.size == 4
           @status_window1.visible = true
           @status_windowshadow1.visible = true
           @status_window2.visible = true
           @status_windowshadow2.visible = true
           @status_window3.visible = true
           @status_windowshadow3.visible = true
           @status_window4.visible = true
           @status_windowshadow4.visible = true
         end
         #===========================================
         # The window displaying the gold, and playtime is set up...
         @playtimegoldpicture = Sprite.new
         @playtimegoldpicture.bitmap = RPG::Cache.picture("goldplaytimewindow")
         @playtimegoldpicture.x = 646
         @playtimegoldpicture.y = 404
         @playtimegoldpicture.z = 100
         #============================================
         # And its shadow
         @playtimegoldshadow = Sprite.new
         @playtimegoldshadow.bitmap = RPG::Cache.picture("goldplaytimeshadow")
         @playtimegoldshadow.x = 651
         @playtimegoldshadow.y = 409
         @playtimegoldshadow.z = 1
         @playtimegoldshadow.opacity = 155
         #============================================
         # Setting up the location window's bar....
         @location_bar = Sprite.new
         @location_bar.bitmap = RPG::Cache.picture("locationbar")
         @location_bar.x = 15
         @location_bar.y = 635
         #============================================
         # Setting up the actual window for the map, opacity - 0
         @location_window = Window_Mapname.new
         @location_window.x = 0
         @location_window.y = 609
         #============================================
         # Setting up a white bar below the location
         @location_white = Sprite.new
         @location_white.bitmap = RPG::Cache.picture("locationwhite")
         @location_white.x = - 8
         @location_white.y = 622
         @location_white.z = 120
         #============================================
         @playtime_window = Window_PlayTime.new
         @playtime_window.x = 645
         @playtime_window.y = 390
        # コマンドウィンドウを作成
        # Command window, opacity - 0 so it is invisible, and commands are set to ""
        # - nothing so no text shows, as there is pictures used instead..
        s1 = ""
        s2 = ""
        s3 = ""
        s4 = ""
        s5 = ""
        s6 = ""
        @command_window = Window_Menucommand.new(200, [s1, s2, s3, s4, s5, s6])
        @command_window.opacity = 0
        @command_window.index = @menu_index
        # パーティ人数が 0 人の場合
        if $game_party.actors.size == 0
          # アイテム、スキル、装備、ステータスを無効化
          @command_window.disable_item(0)
          @command_window.disable_item(1)
          @command_window.disable_item(2)
          @command_window.disable_item(3)
        end
        # セーブ禁止の場合
        if $game_system.save_disabled
          # セーブを無効にする
          @command_window.disable_item(4)
        end
        # ゴールドウィンドウを作成
        @gold_window = Window_Gold.new
        @gold_window.x = 645
        @gold_window.y = 415
        @gold_window.opacity = 0
        # ステータスウィンドウを作成
        @status_window = Window_MenuStatus.new
        @status_window.x = 630
        @status_window.y = - 6
        @status_window.opacity = 0
        @status_window.visible = true
        # トランジション実行
        Graphics.transition
        # メインループ
        loop do
          # ゲーム画面を更新
          Graphics.update
          # 入力情報を更新
          Input.update
          # フレーム更新
          update
          # 画面が切り替わったらループを中断
          if $scene != self
            break
          end
        end
        # トランジション準備
        Graphics.freeze
        # ウィンドウを解放
        @command_window.dispose
        @gold_window.dispose
        @status_window.dispose
        @background.dispose
        @command1.dispose
        @command2.dispose
        @command3.dispose
        @command4.dispose
        @command5.dispose
        @command6.dispose
        @commands1.dispose
        @commands2.dispose
        @commands3.dispose
        @commands4.dispose
        @commands5.dispose
        @commands6.dispose
        @arrow.dispose
        @status_window1.dispose
        @status_window2.dispose
        @status_window3.dispose
        @status_window4.dispose
        @status_windowshadow1.dispose
        @status_windowshadow2.dispose
        @status_windowshadow3.dispose
        @status_windowshadow4.dispose
        @playtimegoldpicture.dispose
        @playtimegoldshadow.dispose
        @location_bar.dispose
        @location_window.dispose
        @location_white.dispose
        @playtime_window.dispose
        @arrow_status.dispose
      end
      #--------------------------------------------------------------------------
      def delay(seconds)
      for i in 0...(seconds * 1)
        sleep 0.01
        Graphics.update
      end
    end
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        if @command2.y < 100
          @command2.y += 20
        end
        if @command3.y < 160
          @command3.y += 20
        end
        if @command4.y < 220
          @command4.y += 20
        end
        if @command5.y < 280
          @command5.y += 20
        end
        if @command6.y < 340
          @command6.y += 20
        end
        if @command6.y >= 340
         @commands1.visible = true
         @commands2.visible = true
         @commands3.visible = true
         @commands4.visible = true
         @commands5.visible = true
         @commands6.visible = true
         end
        if @status_window1.x > 293
         @status_window1.x -= 50
        end
        if @status_window2.x > 276
         @status_window2.x -= 50
        end
        if @status_window3.x > 259
         @status_window3.x -= 50
        end
        if @status_window4.x > 240
         @status_window4.x -= 50
        end
        if @status_windowshadow1.x > 297
          @status_windowshadow1.x -= 50
        end
        if @status_windowshadow2.x > 281
          @status_windowshadow2.x -= 50
        end
        if @status_windowshadow3.x > 264
          @status_windowshadow3.x -= 50
        end
        if @status_windowshadow4.x > 245
          @status_windowshadow4.x -= 50
        end
        if @status_window.x > 230
          @status_window.x -= 50
          end
        if @playtimegoldpicture.x > 446
         @playtimegoldpicture.x -= 25
        end
        if @playtimegoldshadow.x > 451
         @playtimegoldshadow.x -= 25
       end
       if @playtime_window.x > 445
         @playtime_window.x -= 25
       end
       if @gold_window.x > 445
         @gold_window.x -= 25
       end
       if @location_bar.y > 435
         @location_bar.y -= 25
       end
       if @location_window.y > 409
         @location_window.y -= 25
       end
       if @location_white.y > 422
         @location_white.y -= 25
         end
         # ウィンドウを更新
        @command_window.update
        @playtime_window.update
        @gold_window.update
        @status_window.update
        @arrow.update
        @playtime_window.update
        # コマンドウィンドウがアクティブの場合: update_command を呼ぶ
        if @command_window.active
          update_command
          return
        end
        # ステータスウィンドウがアクティブの場合: update_status を呼ぶ
        if @status_window.active
          update_status
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_command
         case @command_window.index
        when 0
          @arrow.y = 45
          @commands1.y = 45
          @commands2.y = 105
          @commands3.y = 165
          @commands4.y = 225
          @commands5.y = 285
          @commands6.y = 345
          @status_windowshadow1.y = 13
          @status_windowshadow2.y = 112
          @status_windowshadow3.y = 212
          @status_windowshadow4.y = 312
          @playtimegoldshadow.y = 409
        when 1
          @arrow.y = 105
          @commands1.y = 42
          @commands2.y = 100
          @commands3.y = 162
          @commands4.y = 222
          @commands5.y = 282
          @commands6.y = 342
          @status_windowshadow1.y = 11
          @status_windowshadow2.y = 110
          @status_windowshadow3.y = 210
          @status_windowshadow4.y = 310
          @playtimegoldshadow.y = 406
        when 2
          @arrow.y = 165
          @commands1.y = 39
          @commands2.y = 97
          @commands3.y = 159
          @commands4.y = 219
          @commands5.y = 279
          @commands6.y = 339
          @status_windowshadow1.y = 8
          @status_windowshadow2.y = 107
          @status_windowshadow3.y = 207
          @status_windowshadow4.y = 307
          @playtimegoldshadow.y = 403
        when 3
          @arrow.y = 225
          @commands1.y = 36
          @commands2.y = 94
          @commands3.y = 156
          @commands4.y = 216
          @commands5.y = 276
          @commands6.y = 336
          @status_windowshadow1.y = 5
          @status_windowshadow2.y = 104
          @status_windowshadow3.y = 204
          @status_windowshadow4.y = 304
          @playtimegoldshadow.y = 400
        when 4
          @arrow.y = 285
          @commands1.y = 33
          @commands2.y = 91
          @commands3.y = 153
          @commands4.y = 213
          @commands5.y = 273
          @commands6.y = 333
          @status_windowshadow1.y = 2
          @status_windowshadow2.y = 101
          @status_windowshadow3.y = 201
          @status_windowshadow4.y = 301
          @playtimegoldshadow.y = 397
        when 5
          @arrow.y = 345
          @commands1.y = 30
          @commands2.y = 88
          @commands3.y = 150
          @commands4.y = 210
          @commands5.y = 270
          @commands6.y = 330
          @status_windowshadow1.y = - 1
          @status_windowshadow2.y = 99
          @status_windowshadow3.y = 199
          @status_windowshadow4.y = 299
          @playtimegoldshadow.y = 394
        end
        #======================
      # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # キャンセル SE を演奏
          @arrow.visible = false
          loop do
         if @command1.x > - 200
           @command1.x -= 40
           end
           if @command2.x > - 200
          @command2.x -= 40
        end
        if @command3.x > - 200
          @command3.x -= 40
        end
        if @command4.x > - 200
          @command4.x -= 40
        end
        if @command5.x > - 200
          @command5.x -= 40
        end
        if @command6.x > - 200
          @command6.x -= 40
        end
         @commands1.visible = false
         @commands2.visible = false
         @commands3.visible = false
         @commands4.visible = false
         @commands5.visible = false
         @commands6.visible = false
        if @status_window1.x < 640
         @status_window1.x += 50
        end
        if @status_window2.x < 640
         @status_window2.x += 50
        end
        if @status_window3.x < 640
         @status_window3.x += 50
        end
        if @status_window4.x < 640
         @status_window4.x += 50
        end
        if @status_windowshadow1.x < 640
          @status_windowshadow1.x += 50
        end
        if @status_windowshadow2.x < 640
          @status_windowshadow2.x += 50
        end
        if @status_windowshadow3.x < 640
          @status_windowshadow3.x += 50
        end
        if @status_windowshadow4.x < 640
          @status_windowshadow4.x += 50
        end
        if @status_window.x < 640
          @status_window.x += 50
          end
        if @playtimegoldpicture.x < 640
         @playtimegoldpicture.x += 25
        end
        if @playtimegoldshadow.x < 640
         @playtimegoldshadow.x += 25
       end
       if @playtime_window.x < 640
         @playtime_window.x += 25
       end
       if @gold_window.x < 640
         @gold_window.x += 25
       end
       if @location_bar.y < 480
         @location_bar.y += 25
       end
       if @location_window.y < 480
         @location_window.y += 25
       end
       if @location_white.y < 480
         @location_white.y += 25
       end
       delay(0.1)
       if @status_window.x >= 640
         break
       end
       end
          $game_system.se_play($data_system.cancel_se)
          # マップ画面に切り替え
          $scene = Scene_Map.new
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
          if $game_party.actors.size == 0 and @command_window.index < 4
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # コマンドウィンドウのカーソル位置で分岐
          case @command_window.index
          when 0  # アイテム
            @command1.z = 999
            loop do
            if @status_window.x < 640
              @status_window.x += 50
              end
            if @status_window1.x < 640
              @status_window1.x += 50
            end
            if @status_window2.x < 640
              @status_window2.x += 50
            end
            if @status_window3.x < 640
              @status_window3.x += 50
            end
            if @status_window4.x < 640
              @status_window4.x += 50
            end
            if @status_windowshadow1.x < 640
              @status_windowshadow1.x += 50
            end
            if @status_windowshadow2.x < 640
              @status_windowshadow2.x += 50
            end
            if @status_windowshadow3.x < 640
              @status_windowshadow3.x += 50
            end
            if @status_windowshadow4.x < 640
              @status_windowshadow4.x += 50
            end
            if @playtimegoldpicture.x < 640
              @playtimegoldpicture.x += 50
            end
            if @playtimegoldshadow.x < 640
              @playtimegoldshadow.x += 50
            end
            if @gold_window.x < 640
              @gold_window.x += 50
            end
            if @playtime_window.x < 640
              @playtime_window.x += 50
            end
            if @command2.y > 40
              @command2.y -= 30
            end
            if @command3.y > 40
              @command3.y -= 30
            end
            if @command4.y > 40
              @command4.y -= 30
            end
            if @command5.y > 40
              @command5.y -= 30
            end
            if @command6.y > 40
              @command6.y -= 30
            end
            @commands2.visible = false
            @commands3.visible = false
            @commands4.visible = false
            @commands5.visible = false
            @commands6.visible = false
            @arrow.visible = false
            if @location_bar.y < 480
              @location_bar.y += 30
            end
            if @location_white.y < 480
              @location_white.y += 30
            end
            if @location_window.y < 480
              @location_window.y += 30
            end
            delay(0.1)
            if @command6.y <= 40
            break
          end
          end
            # 決定  SE を演奏
            $game_system.se_play($data_system.decision_se)
            # アイテム画面に切り替え
            $scene = Scene_Item.new
          when 1  # スキル
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # ステータスウィンドウをアクティブにする
            @command_window.active = false
            @status_window.active = true
            @status_window.index = 0
            @arrow_status.visible = true
          when 2  # 装備
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # ステータスウィンドウをアクティブにする
            @command_window.active = false
            @status_window.active = true
            @status_window.index = 0
            @arrow_status.visible = true
          when 3  # ステータス
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # ステータスウィンドウをアクティブにする
            @command_window.active = false
            @status_window.active = true
            @status_window.index = 0
            @arrow_status.visible = true
          when 4  # セーブ
            # セーブ禁止の場合
            if $game_system.save_disabled
              # ブザー SE を演奏
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            #=====================
                    @command5.z = 999
            loop do
            if @status_window.x < 640
              @status_window.x += 50
              end
            if @status_window1.x < 640
              @status_window1.x += 50
            end
            if @status_window2.x < 640
              @status_window2.x += 50
            end
            if @status_window3.x < 640
              @status_window3.x += 50
            end
            if @status_window4.x < 640
              @status_window4.x += 50
            end
            if @status_windowshadow1.x < 640
              @status_windowshadow1.x += 50
            end
            if @status_windowshadow2.x < 640
              @status_windowshadow2.x += 50
            end
            if @status_windowshadow3.x < 640
              @status_windowshadow3.x += 50
            end
            if @status_windowshadow4.x < 640
              @status_windowshadow4.x += 50
            end
            if @playtimegoldpicture.x < 640
              @playtimegoldpicture.x += 50
            end
            if @playtimegoldshadow.x < 640
              @playtimegoldshadow.x += 50
            end
            if @gold_window.x < 640
              @gold_window.x += 50
            end
            if @playtime_window.x < 640
              @playtime_window.x += 50
            end
            if @command2.y > 40
              @command2.y -= 30
            end
            if @command3.y > 40
              @command3.y -= 30
            end
            if @command4.y > 40
              @command4.y -= 30
            end
            if @command5.y > 40
              @command5.y -= 30
            end
            if @command6.y > 40
              @command6.y -= 30
            end
            @commands2.visible = false
            @commands3.visible = false
            @commands4.visible = false
            @commands5.visible = false
            @commands6.visible = false
             @arrow.visible = false
            if @location_bar.y < 480
              @location_bar.y += 30
            end
            if @location_white.y < 480
              @location_white.y += 30
            end
            if @location_window.y < 480
              @location_window.y += 30
            end
            delay(0.1)
            if @command6.y <= 40
            break
          end
          end
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # セーブ画面に切り替え
            $scene = Scene_Save.new
          when 5  # ゲーム終了
                    @command6.z = 999
            loop do
            if @status_window.x < 640
              @status_window.x += 50
              end
            if @status_window1.x < 640
              @status_window1.x += 50
            end
            if @status_window2.x < 640
              @status_window2.x += 50
            end
            if @status_window3.x < 640
              @status_window3.x += 50
            end
            if @status_window4.x < 640
              @status_window4.x += 50
            end
            if @status_windowshadow1.x < 640
              @status_windowshadow1.x += 50
            end
            if @status_windowshadow2.x < 640
              @status_windowshadow2.x += 50
            end
            if @status_windowshadow3.x < 640
              @status_windowshadow3.x += 50
            end
            if @status_windowshadow4.x < 640
              @status_windowshadow4.x += 50
            end
            if @playtimegoldpicture.x < 640
              @playtimegoldpicture.x += 50
            end
            if @playtimegoldshadow.x < 640
              @playtimegoldshadow.x += 50
            end
            if @gold_window.x < 640
              @gold_window.x += 50
            end
            if @playtime_window.x < 640
              @playtime_window.x += 50
            end
            if @command2.y > 40
              @command2.y -= 30
            end
            if @command3.y > 40
              @command3.y -= 30
            end
            if @command4.y > 40
              @command4.y -= 30
            end
            if @command5.y > 40
              @command5.y -= 30
            end
            if @command6.y > 40
              @command6.y -= 30
            end
            @commands2.visible = false
            @commands3.visible = false
            @commands4.visible = false
            @commands5.visible = false
            @commands6.visible = false
            @arrow.visible = false
            if @location_bar.y < 480
              @location_bar.y += 30
            end
            if @location_white.y < 480
              @location_white.y += 30
            end
            if @location_window.y < 480
              @location_window.y += 30
            end
            delay(0.1)
            if @command6.y <= 40
            break
          end
          end
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # ゲーム終了画面に切り替え
            $scene = Scene_End.new
          end
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新 (ステータスウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_status
        case @command_window.index
        when 1
          @arrow.y = 105
          @commands1.y = 42
          @commands2.y = 100
          @commands3.y = 162
          @commands4.y = 222
          @commands5.y = 282
          @commands6.y = 342
          @status_windowshadow1.y = 11
          @status_windowshadow2.y = 110
          @status_windowshadow3.y = 210
          @status_windowshadow4.y = 310
          @playtimegoldshadow.y = 406
        when 2
          @arrow.y = 165
          @commands1.y = 39
          @commands2.y = 97
          @commands3.y = 159
          @commands4.y = 219
          @commands5.y = 279
          @commands6.y = 339
          @status_windowshadow1.y = 8
          @status_windowshadow2.y = 107
          @status_windowshadow3.y = 207
          @status_windowshadow4.y = 307
          @playtimegoldshadow.y = 403
        when 3
          @arrow.y = 225
          @commands1.y = 36
          @commands2.y = 94
          @commands3.y = 156
          @commands4.y = 216
          @commands5.y = 276
          @commands6.y = 336
          @status_windowshadow1.y = 5
          @status_windowshadow2.y = 104
          @status_windowshadow3.y = 204
          @status_windowshadow4.y = 304
          @playtimegoldshadow.y = 400
          end
      #========================
        case @status_window.index
        when 0
          @arrow_status.y = 37
          @arrow_status.x = 260
        when 1
          @arrow_status.y = 137
          @arrow_status.x = 265 - @status_window.index * 25
        when 2
          @arrow_status.y = 237
          @arrow_status.x = 265 - @status_window.index * 25
        when 3
          @arrow_status.y = 337
          @arrow_status.x = 265 - @status_window.index * 23
          end
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # キャンセル SE を演奏
          $game_system.se_play($data_system.cancel_se)
          # コマンドウィンドウをアクティブにする
          @command_window.active = true
          @status_window.active = false
          @status_window.index = -1
          @arrow_status.visible = false
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # コマンドウィンドウのカーソル位置で分岐
          case @command_window.index
          when 1  # スキル
            # このアクターの行動制限が 2 以上の場合
            if $game_party.actors[@status_window.index].restriction >= 2
              # ブザー SE を演奏
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            @command2.z = 999
            loop do
            if @status_window.x < 640
              @status_window.x += 50
              end
            if @status_window1.x < 640
              @status_window1.x += 50
            end
            if @status_window2.x < 640
              @status_window2.x += 50
            end
            if @status_window3.x < 640
              @status_window3.x += 50
            end
            if @status_window4.x < 640
              @status_window4.x += 50
            end
            if @status_windowshadow1.x < 640
              @status_windowshadow1.x += 50
            end
            if @status_windowshadow2.x < 640
              @status_windowshadow2.x += 50
            end
            if @status_windowshadow3.x < 640
              @status_windowshadow3.x += 50
            end
            if @status_windowshadow4.x < 640
              @status_windowshadow4.x += 50
            end
            if @playtimegoldpicture.x < 640
              @playtimegoldpicture.x += 50
            end
            if @playtimegoldshadow.x < 640
              @playtimegoldshadow.x += 50
            end
            if @gold_window.x < 640
              @gold_window.x += 50
            end
            if @playtime_window.x < 640
              @playtime_window.x += 50
            end
            if @command2.y > 40
              @command2.y -= 30
            end
            if @command3.y > 40
              @command3.y -= 30
            end
            if @command4.y > 40
              @command4.y -= 30
            end
            if @command5.y > 40
              @command5.y -= 30
            end
            if @command6.y > 40
              @command6.y -= 30
            end
            @commands2.visible = false
            @commands3.visible = false
            @commands4.visible = false
            @commands5.visible = false
            @commands6.visible = false
            @arrow.visible = false
            @arrow_status.visible = false
            if @location_bar.y < 480
              @location_bar.y += 30
            end
            if @location_white.y < 480
              @location_white.y += 30
            end
            if @location_window.y < 480
              @location_window.y += 30
            end
            delay(0.1)
            if @command6.y <= 40
            break
          end
          end
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # スキル画面に切り替え
            $scene = Scene_Skill.new(@status_window.index)
          when 2  # 装備
                    @command3.z = 999
            loop do
            if @status_window.x < 640
              @status_window.x += 50
              end
            if @status_window1.x < 640
              @status_window1.x += 50
            end
            if @status_window2.x < 640
              @status_window2.x += 50
            end
            if @status_window3.x < 640
              @status_window3.x += 50
            end
            if @status_window4.x < 640
              @status_window4.x += 50
            end
            if @status_windowshadow1.x < 640
              @status_windowshadow1.x += 50
            end
            if @status_windowshadow2.x < 640
              @status_windowshadow2.x += 50
            end
            if @status_windowshadow3.x < 640
              @status_windowshadow3.x += 50
            end
            if @status_windowshadow4.x < 640
              @status_windowshadow4.x += 50
            end
            if @playtimegoldpicture.x < 640
              @playtimegoldpicture.x += 50
            end
            if @playtimegoldshadow.x < 640
              @playtimegoldshadow.x += 50
            end
            if @gold_window.x < 640
              @gold_window.x += 50
            end
            if @playtime_window.x < 640
              @playtime_window.x += 50
            end
            if @command2.y > 40
              @command2.y -= 30
            end
            if @command3.y > 40
              @command3.y -= 30
            end
            if @command4.y > 40
              @command4.y -= 30
            end
            if @command5.y > 40
              @command5.y -= 30
            end
            if @command6.y > 40
              @command6.y -= 30
            end
            @commands2.visible = false
            @commands3.visible = false
            @commands4.visible = false
            @commands5.visible = false
            @commands6.visible = false
            @arrow.visible = false
            @arrow_status.visible = false
            if @location_bar.y < 480
              @location_bar.y += 30
            end
            if @location_white.y < 480
              @location_white.y += 30
            end
            if @location_window.y < 480
              @location_window.y += 30
            end
            delay(0.1)
            if @command6.y <= 40
            break
          end
          end
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # 装備画面に切り替え
            $scene = Scene_Equip.new(@status_window.index)
          when 3  # ステータス
                    @command4.z = 999
            loop do
            if @status_window.x < 640
              @status_window.x += 50
              end
            if @status_window1.x < 640
              @status_window1.x += 50
            end
            if @status_window2.x < 640
              @status_window2.x += 50
            end
            if @status_window3.x < 640
              @status_window3.x += 50
            end
            if @status_window4.x < 640
              @status_window4.x += 50
            end
            if @status_windowshadow1.x < 640
              @status_windowshadow1.x += 50
            end
            if @status_windowshadow2.x < 640
              @status_windowshadow2.x += 50
            end
            if @status_windowshadow3.x < 640
              @status_windowshadow3.x += 50
            end
            if @status_windowshadow4.x < 640
              @status_windowshadow4.x += 50
            end
            if @playtimegoldpicture.x < 640
              @playtimegoldpicture.x += 50
            end
            if @playtimegoldshadow.x < 640
              @playtimegoldshadow.x += 50
            end
            if @gold_window.x < 640
              @gold_window.x += 50
            end
            if @playtime_window.x < 640
              @playtime_window.x += 50
            end
            if @command2.y > 40
              @command2.y -= 30
            end
            if @command3.y > 40
              @command3.y -= 30
            end
            if @command4.y > 40
              @command4.y -= 30
            end
            if @command5.y > 40
              @command5.y -= 30
            end
            if @command6.y > 40
              @command6.y -= 30
            end
            @commands2.visible = false
            @commands3.visible = false
            @commands4.visible = false
            @commands5.visible = false
            @commands6.visible = false
            @arrow.visible = false
            @arrow_status.visible = false
            if @location_bar.y < 480
              @location_bar.y += 30
            end
            if @location_white.y < 480
              @location_white.y += 30
            end
            if @location_window.y < 480
              @location_window.y += 30
            end
            delay(0.1)
            if @command6.y <= 40
            break
          end
          end
            # 決定 SE を演奏
            $game_system.se_play($data_system.decision_se)
            # ステータス画面に切り替え
            $scene = Scene_Status.new(@status_window.index)
          end
          return
        end
      end
    end
    #==============================================================================
    # ■ Scene_Item
    #------------------------------------------------------------------------------
    #  アイテム画面の処理を行うクラスです。
    #==============================================================================
    
    class Scene_Item
      #--------------------------------------------------------------------------
      # ● メイン処理
      #--------------------------------------------------------------------------
      def main
        #==============================================
        # Setting up all the images
        @background = Sprite.new
        @background.bitmap = RPG::Cache.picture("background")
        @background.x = 0
        @background.y = 0
        #================help window pic====================
        @help_picture = Sprite.new
        @help_picture.bitmap = RPG::Cache.picture("helpwindow12")
        @help_picture.x = 0
        @help_picture.y = - 52
        #=================Command=======================
        @command1 = Sprite.new
        @command1.bitmap = RPG::Cache.picture("cmscommand1")
        @command1.x = 15
        @command1.y = 40
        @command1.z = 100
        #=====================shadow=======================
        @commands1 = Sprite.new
        @commands1.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands1.x = 20
        @commands1.y = 45
        @commands1.z = 1
        @commands1.opacity = 155
        #===================item window======================
        @item_picture = Sprite.new
        @item_picture.bitmap = RPG::Cache.picture("itemwindow")
        @item_picture.x = 7
        @item_picture.y = 509
        @item_picture.z = 11
        #===============================================
        @item_shadow = Sprite.new
        @item_shadow.bitmap = RPG::Cache.picture("itemshadow")
        @item_shadow.x = 12
        @item_shadow.y = 514
        @item_shadow.z = 1
        @item_shadow.opacity = 155
        #===============================================
        @help_window = Window_Menuhelp.new
        @item_window = Window_Menuitem.new
        @item_window.z = 100
        @item_window.help_window = @help_window
        # ターゲットウィンドウを作成 (不可視・非アクティブに設定)
        @target_picture = Sprite.new
        @target_picture.bitmap = RPG::Cache.picture("targetwindow")
        @target_picture.z = 998
        @target_picture.visible = false
        @target_window = Window_Target.new
        @target_window.z = 999
        @target_window.opacity = 0
        @target_window.visible = false
        @target_window.active = false
        # トランジション実行
        Graphics.transition
        # メインループ
        loop do
          # ゲーム画面を更新
          Graphics.update
          # 入力情報を更新
          Input.update
          # フレーム更新
          update
          # 画面が切り替わったらループを中断
          if $scene != self
            break
          end
        end
        # トランジション準備
        Graphics.freeze
        # ウィンドウを解放
        @help_window.dispose
        @item_window.dispose
        @target_window.dispose
        @background.dispose
        @command1.dispose
        @commands1.dispose
        @help_picture.dispose
        @item_shadow.dispose
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        # ウィンドウを更新
        @help_window.update
        @item_window.update
        @target_window.update
        @command1.update
        # enter animation
        if @item_shadow.y > 114
          @item_shadow.y -= 50
          end
        if @item_picture.y > 109
          @item_picture.y -= 50
        end
        if @item_window.y > 100
          @item_window.y -= 50
        end
        if @help_picture.y < - 4
          @help_picture.y += 24
        end
        if @help_window.y < - 7
          @help_window.y += 35
        end
        if @command1.x < 215
          @command1.x += 100
        end
        if @command1.y < 50
          @command1.y += 5
        end
        if @commands1.x < 220
          @commands1.x += 100
        end
        if @commands1.y < 55
          @commands1.y += 5
          end
        # アイテムウィンドウがアクティブの場合: update_item を呼ぶ
        if @item_window.active
          update_item
          return
        end
        # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
        if @target_window.active
          update_target
          return
        end
      end
      #--------------------------------------------------------------------------
      def delay(seconds)
      for i in 0...(seconds * 1)
        sleep 0.01
        Graphics.update
      end
    end
      # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_item
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # exit animation
          $game_system.se_play($data_system.cancel_se)
          loop do
            if @item_shadow.y < 480
              @item_shadow.y += 50
              end
            if @item_picture.y < 480
              @item_picture.y += 50
            end
            if @item_window.y < 480
              @item_window.y += 50
            end
            if @help_picture.y > - 50
              @help_picture.y -= 30
            end
            if @help_window.y > - 64
              @help_window.y -= 30
            end
            if @command1.x > 15
              @command1.x -= 100
            end
            if @command1.y > 40
              @command1.y -= 5
            end
            if @commands1.x > 20
              @commands1.x -= 100
            end
            if @commands1.y > 45
              @commands1.y -= 5
            end
            delay(0.2)
            if @item_picture.y >= 480
              break
            end
            end
          # メニュー画面に切り替え
          $scene = Scene_Menu.new(0)
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # アイテムウィンドウで現在選択されているデータを取得
          @item = @item_window.item
          # 使用アイテムではない場合
          unless @item.is_a?(RPG::Item)
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # 使用できない場合
          unless $game_party.item_can_use?(@item.id)
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # 決定 SE を演奏
          $game_system.se_play($data_system.decision_se)
          # 効果範囲が味方の場合
          if @item.scope >= 3
            # ターゲットウィンドウをアクティブ化
            @item_window.active = false
            @target_window.x = (@item_window.index + 1) % 2 * 304
            @target_picture.x = (@item_window.index + 1) % 2 * 304
            @target_picture.visible = true
            @target_window.visible = true
            @target_window.active = true
            # 効果範囲 (単体/全体) に応じてカーソル位置を設定
            if @item.scope == 4 || @item.scope == 6
              @target_window.index = -1
            else
              @target_window.index = 0
            end
          # 効果範囲が味方以外の場合
          else
            # コモンイベント ID が有効の場合
            if @item.common_event_id > 0
              # コモンイベント呼び出し予約
              $game_temp.common_event_id = @item.common_event_id
              # アイテムの使用時 SE を演奏
              $game_system.se_play(@item.menu_se)
              # 消耗品の場合
              if @item.consumable
                # 使用したアイテムを 1 減らす
                $game_party.lose_item(@item.id, 1)
                # アイテムウィンドウの項目を再描画
                @item_window.draw_item(@item_window.index)
              end
              # マップ画面に切り替え
              $scene = Scene_Map.new
              return
            end
          end
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_target
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # キャンセル SE を演奏
          $game_system.se_play($data_system.cancel_se)
          # アイテム切れなどで使用できなくなった場合
          unless $game_party.item_can_use?(@item.id)
            # アイテムウィンドウの内容を再作成
            @item_window.refresh
          end
          # ターゲットウィンドウを消去
          @item_window.active = true
          @target_window.visible = false
          @target_picture.visible = false
          @target_window.active = false
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # アイテムを使い切った場合
          if $game_party.item_number(@item.id) == 0
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # ターゲットが全体の場合
          if @target_window.index == -1
            # パーティ全体にアイテムの使用効果を適用
            used = false
            for i in $game_party.actors
              used |= i.item_effect(@item)
            end
          end
          # ターゲットが単体の場合
          if @target_window.index >= 0
            # ターゲットのアクターにアイテムの使用効果を適用
            target = $game_party.actors[@target_window.index]
            used = target.item_effect(@item)
          end
          # アイテムを使った場合
          if used
            # アイテムの使用時 SE を演奏
            $game_system.se_play(@item.menu_se)
            # 消耗品の場合
            if @item.consumable
              # 使用したアイテムを 1 減らす
              $game_party.lose_item(@item.id, 1)
              # アイテムウィンドウの項目を再描画
              @item_window.draw_item(@item_window.index)
            end
            # ターゲットウィンドウの内容を再作成
            @target_window.refresh
            # 全滅の場合
            if $game_party.all_dead?
              # ゲームオーバー画面に切り替え
              $scene = Scene_Gameover.new
              return
            end
            # コモンイベント ID が有効の場合
            if @item.common_event_id > 0
              # コモンイベント呼び出し予約
              $game_temp.common_event_id = @item.common_event_id
              # マップ画面に切り替え
              $scene = Scene_Map.new
              return
            end
          end
          # アイテムを使わなかった場合
          unless used
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
          end
          return
        end
      end
    end
    #==============================================================================
    # ■ Scene_Skill
    #------------------------------------------------------------------------------
    #  スキル画面の処理を行うクラスです。
    #==============================================================================
    
    class Scene_Skill
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor_index : アクターインデックス
      #--------------------------------------------------------------------------
      def initialize(actor_index = 0, equip_index = 0)
        @actor_index = actor_index
      end
      #--------------------------------------------------------------------------
      # ● メイン処理
      #--------------------------------------------------------------------------
      def main
         #==============================================
        # Setting up all the images
        @background = Sprite.new
        @background.bitmap = RPG::Cache.picture("background")
        @background.x = 0
        @background.y = 0
        #================help window image=====================
        @help_picture = Sprite.new
        @help_picture.bitmap = RPG::Cache.picture("helpwindow12")
        @help_picture.x = 0
        @help_picture.y = - 52
        #==============Command image=====================
        @command2 = Sprite.new
        @command2.bitmap = RPG::Cache.picture("cmscommand2")
        @command2.x = 15
        @command2.y = 40
        @command2.z = 100
        #==============shadow================================
        @commands2 = Sprite.new
        @commands2.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands2.x = 20
        @commands2.y = 45
        @commands2.z = 1
        @commands2.opacity = 155
        #==============status window==========================
        @status_window1 = Sprite.new
        @status_window1.bitmap = RPG::Cache.picture("status window 1")
        @status_window1.x = 693
        @status_window1.y = 45
        @status_window1.z = 100
        #============shadow================================
        @status_windowshadow1 = Sprite.new
        @status_windowshadow1.bitmap = RPG::Cache.picture("blackwindow2")
        @status_windowshadow1.x = 697
        @status_windowshadow1.y = 50
        @status_windowshadow1.z = 1
        @status_windowshadow1.opacity = 155
        #==================skill window pic====================
        @skill_picture = Sprite.new
        @skill_picture.bitmap = RPG::Cache.picture("skillwindow")
        @skill_picture.x = 7
        @skill_picture.y = 540
        @skill_picture.z = 2
        #================skill shadow pic=====================
        @skill_shadow = Sprite.new
        @skill_shadow.bitmap = RPG::Cache.picture("skillshadow")
        @skill_shadow.x = 14
        @skill_shadow.y = 545
        @skill_shadow.z = 1
        @skill_shadow.opacity = 155
        #===============target window========================
        @target_picture = Sprite.new
        @target_picture.bitmap = RPG::Cache.picture("targetwindow")
        @target_picture.z = 998
        @target_picture.visible = false
        # アクターを取得
        @actor = $game_party.actors[@actor_index]
        # ヘルプウィンドウ、ステータスウィンドウ、スキルウィンドウを作成
        @help_window = Window_Menuhelp.new
        @help_window.opacity = 0
        @status_window = Window_SkillStatus.new(@actor)
        @skill_window = Window_Menuskill.new(@actor)
        @skill_window.opacity = 0
        # ヘルプウィンドウを関連付け
        @skill_window.help_window = @help_window
        # ターゲットウィンドウを作成 (不可視・非アクティブに設定)
        @target_window = Window_Target.new
        @target_window.z = 999
        @target_window.opacity = 0
        @target_window.visible = false
        @target_window.active = false
        # トランジション実行
        Graphics.transition
        # メインループ
        loop do
          # ゲーム画面を更新
          Graphics.update
          # 入力情報を更新
          Input.update
          # フレーム更新
          update
          # 画面が切り替わったらループを中断
          if $scene != self
            break
          end
        end
        # トランジション準備
        Graphics.freeze
        # ウィンドウを解放
        @help_window.dispose
        @status_window.dispose
        @skill_window.dispose
        @target_window.dispose
        @background.dispose
        @help_picture.dispose
        @commands2.dispose
        @command2.dispose
        @status_window1.dispose
        @status_windowshadow1.dispose
        @skill_picture.dispose
        @skill_shadow.dispose
      end
      #--------------------------------------------------------------------------
      def delay(seconds)
      for i in 0...(seconds * 1)
        sleep 0.01
        Graphics.update
      end
    end
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        # enter animation
        if @help_picture.y < - 4
          @help_picture.y += 24
        end
        if @help_window.y < - 7
          @help_window.y += 35
        end
        if @command2.y < 60
          @command2.y += 20
        end
        if @commands2.y < 65
          @commands2.y += 20
        end
        if @skill_shadow.y > 145
          @skill_shadow.y -= 50
          end
        if @skill_picture.y > 140
          @skill_picture.y -= 50
        end
        if @skill_window.y > 131
          @skill_window.y -= 50
        end
        if @status_window1.x > 293
           @status_window1.x -= 100
        end
        if @status_window.x > 230
           @status_window.x -= 100
         end
         if @status_windowshadow1.x > 297
           @status_windowshadow1.x -= 100
         end
        # ウィンドウを更新
        @help_window.update
        @status_window.update
        @skill_window.update
        @target_window.update
        # スキルウィンドウがアクティブの場合: update_skill を呼ぶ
        if @skill_window.active
          update_skill
          return
        end
        # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
        if @target_window.active
          update_target
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新 (スキルウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_skill
        if Input.trigger?(Input::B)
          # exit animation
           loop do
             if @skill_shadow.y < 480
               @skill_shadow.y += 50
               end
            if @skill_picture.y < 480
              @skill_picture.y += 50
            end
            if @skill_window.y < 480
              @skill_window.y += 50
            end
            if @help_picture.y > - 50
              @help_picture.y -= 30
            end
            if @help_window.y > - 64
              @help_window.y -= 30
            end
            if @command2.x > 15
              @command2.x -= 100
            end
            if @command2.y > 40
              @command2.y -= 10
            end
            if @commands2.x > 20
              @commands2.x -= 100
            end
            if @commands2.y > 45
              @commands2.y -= 10
            end
            if @status_window1.x < 640
               @status_window1.x += 100
            end
            if @status_window.x < 640
               @status_window.x += 100
             end
             if @status_windowshadow1.x < 640
               @status_windowshadow1.x += 100
               end
            delay(0.2)
            if @skill_picture.y >= 480
              break
            end
            end
          # キャンセル SE を演奏
          $game_system.se_play($data_system.cancel_se)
          # メニュー画面に切り替え
          $scene = Scene_Menu.new(1)
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # スキルウィンドウで現在選択されているデータを取得
          @skill = @skill_window.skill
          # 使用できない場合
          if @skill == nil or not @actor.skill_can_use?(@skill.id)
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # 決定 SE を演奏
          $game_system.se_play($data_system.decision_se)
          # 効果範囲が味方の場合
          if @skill.scope >= 3
            # ターゲットウィンドウをアクティブ化
            @skill_window.active = false
            @target_window.x = (@skill_window.index + 1) % 2 * 304
            @target_picture.x = (@skill_window.index + 1) % 2 * 304
            @target_window.visible = true
            @target_window.active = true
            @target_picture.visible = true
            # 効果範囲 (単体/全体) に応じてカーソル位置を設定
            if @skill.scope == 4 || @skill.scope == 6
              @target_window.index = -1
            elsif @skill.scope == 7
              @target_window.index = @actor_index - 10
            else
              @target_window.index = 0
            end
          # 効果範囲が味方以外の場合
          else
            # コモンイベント ID が有効の場合
            if @skill.common_event_id > 0
              # コモンイベント呼び出し予約
              $game_temp.common_event_id = @skill.common_event_id
              # スキルの使用時 SE を演奏
              $game_system.se_play(@skill.menu_se)
              # SP 消費
              @actor.sp -= @skill.sp_cost
              # 各ウィンドウの内容を再作成
              @status_window.refresh
              @skill_window.refresh
              @target_window.refresh
              # マップ画面に切り替え
              $scene = Scene_Map.new
              return
            end
          end
          return
        end
        # R ボタンが押された場合
        if Input.trigger?(Input::R)
          # カーソル SE を演奏
          $game_system.se_play($data_system.cursor_se)
          # 次のアクターへ
          @actor_index += 1
          @actor_index %= $game_party.actors.size
          # 別のスキル画面に切り替え
          $scene = Scene_Skill.new(@actor_index)
          return
        end
        # L ボタンが押された場合
        if Input.trigger?(Input::L)
          # カーソル SE を演奏
          $game_system.se_play($data_system.cursor_se)
          # 前のアクターへ
          @actor_index += $game_party.actors.size - 1
          @actor_index %= $game_party.actors.size
          # 別のスキル画面に切り替え
          $scene = Scene_Skill.new(@actor_index)
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_target
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # キャンセル SE を演奏
          $game_system.se_play($data_system.cancel_se)
          # ターゲットウィンドウを消去
          @skill_window.active = true
          @target_window.visible = false
          @target_window.active = false
          @target_picture.visible = false
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # SP 切れなどで使用できなくなった場合
          unless @actor.skill_can_use?(@skill.id)
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # ターゲットが全体の場合
          if @target_window.index == -1
            # パーティ全体にスキルの使用効果を適用
            used = false
            for i in $game_party.actors
              used |= i.skill_effect(@actor, @skill)
            end
          end
          # ターゲットが使用者の場合
          if @target_window.index <= -2
            # ターゲットのアクターにスキルの使用効果を適用
            target = $game_party.actors[@target_window.index + 10]
            used = target.skill_effect(@actor, @skill)
          end
          # ターゲットが単体の場合
          if @target_window.index >= 0
            # ターゲットのアクターにスキルの使用効果を適用
            target = $game_party.actors[@target_window.index]
            used = target.skill_effect(@actor, @skill)
          end
          # スキルを使った場合
          if used
            # スキルの使用時 SE を演奏
            $game_system.se_play(@skill.menu_se)
            # SP 消費
            @actor.sp -= @skill.sp_cost
            # 各ウィンドウの内容を再作成
            @status_window.refresh
            @skill_window.refresh
            @target_window.refresh
            # 全滅の場合
            if $game_party.all_dead?
              # ゲームオーバー画面に切り替え
              $scene = Scene_Gameover.new
              return
            end
            # コモンイベント ID が有効の場合
            if @skill.common_event_id > 0
              # コモンイベント呼び出し予約
              $game_temp.common_event_id = @skill.common_event_id
              # マップ画面に切り替え
              $scene = Scene_Map.new
              return
            end
          end
          # スキルを使わなかった場合
          unless used
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
          end
          return
        end
      end
    end
    #==============================================================================
    # ■ Scene_Equip
    #------------------------------------------------------------------------------
    #  装備画面の処理を行うクラスです。
    #==============================================================================
    
    class Scene_Equip
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor_index : アクターインデックス
      #     equip_index : 装備インデックス
      #--------------------------------------------------------------------------
      def initialize(actor_index = 0, equip_index = 0)
        @actor_index = actor_index
        @equip_index = equip_index
      end
      #--------------------------------------------------------------------------
      # ● メイン処理
      #--------------------------------------------------------------------------
      def main
         # This is setting up the background picture
        @background = Sprite.new
        @background.bitmap = RPG::Cache.picture("background")
        @background.x = 0
        @background.y = 0
        #=============the equip command pic========================
        @command3 = Sprite.new
        @command3.bitmap = RPG::Cache.picture("cmscommand3")
        @command3.x = 15
        @command3.y = 40
        @command3.z = 100
        #=================the shadow of it=======================
        @commands3 = Sprite.new
        @commands3.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands3.x = 20
        @commands3.y = 45
        @commands3.z = 1
        @commands3.opacity = 155
        #================the status window pic====================
        @status_window1 = Sprite.new
        @status_window1.bitmap = RPG::Cache.picture("status window 1")
        @status_window1.x = 693
        @status_window1.y = 45
        @status_window1.z = 100
        #=============the shadow of it===========================
        @status_windowshadow1 = Sprite.new
        @status_windowshadow1.bitmap = RPG::Cache.picture("blackwindow2")
        @status_windowshadow1.x = 697
        @status_windowshadow1.y = 50
        @status_windowshadow1.z = 1
        @status_windowshadow1.opacity = 155
        #================help window image=====================
        @help_picture = Sprite.new
        @help_picture.bitmap = RPG::Cache.picture("helpwindow12")
        @help_picture.x = 0
        @help_picture.y = - 52
        #==============This sets up the 3rd status picture=============
        @picture_status2 = Sprite.new
        @picture_status2.bitmap = RPG::Cache.picture("windowstatus2")
        @picture_status2.x = 850
        @picture_status2.y = 135
        @picture_status2.z = 3
        #============the shadow of the 2nd status pic================
        @picture_shadow2 = Sprite.new
        @picture_shadow2.bitmap = RPG::Cache.picture("windowstatus2shadow")
        @picture_shadow2.x = 855
        @picture_shadow2.y = 140
        @picture_shadow2.z = 1
        @picture_shadow2.opacity = 155
        #======the pic for equip left (status window 2 in this script)==========
        @equip_window1 = Sprite.new 
        @equip_window1.bitmap = RPG::Cache.picture("equipwindow1")
        @equip_window1.x = - 113
        @equip_window1.y = 117
        @equip_window1.z = 2
        #============the equipment selection window pic===============
        @equip_window2 = Sprite.new 
        @equip_window2.bitmap = RPG::Cache.picture("equipwindow2")
        @equip_window2.x = 245
        @equip_window2.y = 585
        @equip_window2.z = 2
        #================the shadow of it==========================
        @equip_shadow2 = Sprite.new 
        @equip_shadow2.bitmap = RPG::Cache.picture("equipwindow2shadow")
        @equip_shadow2.x = 250
        @equip_shadow2.y = 590
        @equip_shadow2.opacity = 155
        @equip_shadow2.z = 1
        #================the selection arrow=========================
        @arrow = Sprite.new
        @arrow.bitmap = RPG::Cache.picture("arrow4")
        @arrow.x = - 60
        @arrow.y = 141
        @arrow.z = 1000
        # アクターを取得
        @actor = $game_party.actors[@actor_index]
        # ウィンドウを作成
        @status_window = Window_SkillStatus.new(@actor)
        @status_window2 = Window_Status2.new(@actor)
        @status_window2.x = 850
        @status_window2.y = 120
        @status_window2.opacity = 0
        @help_window = Window_Menuhelp.new
        @help_window.opacity = 0
        @right_window = Window_EquipRight.new(@actor)
        @right_window.visible = true
        @item_window1 = Window_EquipItem.new(@actor, 0)
        @item_window2 = Window_EquipItem.new(@actor, 1)
        @item_window3 = Window_EquipItem.new(@actor, 2)
        @item_window4 = Window_EquipItem.new(@actor, 3)
        @item_window5 = Window_EquipItem.new(@actor, 4)
        # ヘルプウィンドウを関連付け
        @right_window.help_window = @help_window
        @item_window1.help_window = @help_window
        @item_window2.help_window = @help_window
        @item_window3.help_window = @help_window
        @item_window4.help_window = @help_window
        @item_window5.help_window = @help_window
        # カーソル位置を設定
        @right_window.index = @equip_index
        refresh
        # トランジション実行
        Graphics.transition
        # メインループ
        loop do
          # ゲーム画面を更新
          Graphics.update
          # 入力情報を更新
          Input.update
          # フレーム更新
          update
          # 画面が切り替わったらループを中断
          if $scene != self
            break
          end
        end
        # トランジション準備
        Graphics.freeze
        # ウィンドウを解放
        @help_window.dispose
        @right_window.dispose
        @item_window1.dispose
        @item_window2.dispose
        @item_window3.dispose
        @item_window4.dispose
        @item_window5.dispose
        @background.dispose
        @command3.dispose
        @commands3.dispose
        @status_window1.dispose
        @status_windowshadow1.dispose
        @help_picture.dispose
        @status_window.dispose
        @status_window2.dispose
        @equip_window1.dispose
        @equip_window2.dispose
        @picture_status2.dispose
        @arrow.dispose
        @equip_shadow2.dispose
        @picture_shadow2.dispose
      end
      #--------------------------------------------------------------------------
      # ● リフレッシュ
      #--------------------------------------------------------------------------
      def refresh
        # アイテムウィンドウの可視状態設定
        @item_window1.visible = (@right_window.index == 0)
        @item_window2.visible = (@right_window.index == 1)
        @item_window3.visible = (@right_window.index == 2)
        @item_window4.visible = (@right_window.index == 3)
        @item_window5.visible = (@right_window.index == 4)
        # 現在装備中のアイテムを取得
        item1 = @right_window.item
        # 現在のアイテムウィンドウを @item_window に設定
        case @right_window.index
        when 0
          @item_window = @item_window1
        when 1
          @item_window = @item_window2
        when 2
          @item_window = @item_window3
        when 3
          @item_window = @item_window4
        when 4
          @item_window = @item_window5
        end
        # ライトウィンドウがアクティブの場合
        if @right_window.active
          # 装備変更後のパラメータを消去
          @status_window2.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
        end
        # アイテムウィンドウがアクティブの場合
        if @item_window.active
          # 現在選択中のアイテムを取得
          item2 = @item_window.item
          # 装備を変更
          last_hp = @actor.hp
          last_sp = @actor.sp
          @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
          # 装備変更後のパラメータを取得
          new_atk = @actor.atk
          new_pdef = @actor.pdef
          new_mdef = @actor.mdef
          new_str = @actor.str
          new_dex = @actor.dex
          new_agi = @actor.agi
          new_int = @actor.int
          # 装備を戻す
          @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
          @actor.hp = last_hp
          @actor.sp = last_sp
          # レフトウィンドウに描画
        @status_window2.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
        @status_window2.refresh
        end
      end
      #--------------------------------------------------------------------------
      def delay(seconds)
      for i in 0...(seconds * 1)
        sleep 0.01
        Graphics.update
      end
    end
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        @status_window.update
            if @command3.y < 60
          @command3.y += 20
        end
        if @commands3.y < 65
          @commands3.y += 20
        end
          if @help_picture.y < - 4
          @help_picture.y += 24
        end
        if @help_window.y < - 7
          @help_window.y += 35
        end
        if @status_window1.x > 293
           @status_window1.x -= 80
         end
        if @status_windowshadow1.x > 297
          @status_windowshadow1.x -= 80
          end
            if @status_window.x > 230
           @status_window.x -= 50
         end
           if @status_window2.x > 250
          @status_window2.x -= 100
        end
          if @picture_status2.x > 250
          @picture_status2.x -= 100
        end
         if @picture_shadow2.x > 255
          @picture_shadow2.x -= 100
        end
        if @equip_window1.x < 7
          @equip_window1.x += 20
        end
        if @right_window.x < 20
          @right_window.x += 20
        end
        if @equip_window2.y > 285
          @equip_window2.y -= 50
        end
        if @equip_shadow2.y > 290
          @equip_shadow2.y -= 50
          end
        if @arrow.x < - 10
          @arrow.x += 10
        end
           if @item_window1.y > 273
          @item_window1.y -= 50
        end
        if @item_window2.y > 273
          @item_window2.y -= 50
        end
        if @item_window3.y > 273
          @item_window3.y -= 50
        end
        if @item_window4.y > 273
          @item_window4.y -= 50
        end
        if @item_window5.y > 273
          @item_window5.y -= 50
          end
        # ウィンドウを更新
        @right_window.update
        @item_window.update
        refresh
        # ライトウィンドウがアクティブの場合: update_right を呼ぶ
        if @right_window.active
          update_right
          return
        end
        # アイテムウィンドウがアクティブの場合: update_item を呼ぶ
        if @item_window.active
          update_item
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新 (ライトウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_right
        case @right_window.index
        when 0
          @arrow.y = 141
        when 1
          @arrow.y = 208
        when 2
          @arrow.y = 276
        when 3
          @arrow.y = 344
        when 4
          @arrow.y = 408
          end
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # キャンセル SE を演奏
          loop do
              if @command3.x > 15
              @command3.x -= 100
            end
            if @command3.y > 40
              @command3.y -= 10
            end
            if @commands3.x > 20
              @commands2.x -= 100
            end
            if @commands3.y > 45
              @commands3.y -= 10
            end
            if @help_picture.y > - 50
              @help_picture.y -= 30
            end
            if @help_window.y > - 64
              @help_window.y -= 30
            end
             if @status_window1.x < 640
               @status_window1.x += 100
            end
            if @status_window.x < 640
               @status_window.x += 100
             end
             if @status_windowshadow1.x < 640
               @status_windowshadow1.x += 100
             end
             if @status_window2.x < 640
                @status_window2.x += 100
             end
            if @picture_status2.x < 640
               @picture_status2.x += 100
             end
             if @picture_shadow2.x < 640
               @picture_shadow2.x += 100
             end
              if @equip_window1.x > - 250
              @equip_window1.x -= 50
             end
            if @right_window.x > - 250
           @right_window.x -= 50
          end
          if @equip_window2.y < 480
           @equip_window2.y += 50
         end
          if @equip_shadow2.y < 480
          @equip_shadow2.y += 50
          end
          if @item_window1.y < 480
            @item_window1.y += 50
          end
          if @item_window2.y < 480
            @item_window2.y += 50
          end
           if @item_window3.y < 480
            @item_window3.y += 50
           end
           if @item_window4.y < 480
           @item_window4.y += 50
          end
          if @item_window5.y < 480
             @item_window5.y += 50
           end
        @arrow.visible = false
          delay(0.1)
          if @equip_window1.x <= - 250
            break
        end
        end
           $game_system.se_play($data_system.cancel_se)
          # メニュー画面に切り替え
          $scene = Scene_Menu.new(2)
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # 装備固定の場合
          if @actor.equip_fix?(@right_window.index)
            # ブザー SE を演奏
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # 決定 SE を演奏
          $game_system.se_play($data_system.decision_se)
          # アイテムウィンドウをアクティブ化
          @right_window.active = false
          @item_window.active = true
          @item_window.index = 0
          return
        end
        # R ボタンが押された場合
        if Input.trigger?(Input::R)
          # カーソル SE を演奏
          $game_system.se_play($data_system.cursor_se)
          # 次のアクターへ
          @actor_index += 1
          @actor_index %= $game_party.actors.size
          # 別の装備画面に切り替え
          $scene = Scene_Equip.new(@actor_index, @right_window.index)
          return
        end
        # L ボタンが押された場合
        if Input.trigger?(Input::L)
          # カーソル SE を演奏
          $game_system.se_play($data_system.cursor_se)
          # 前のアクターへ
          @actor_index += $game_party.actors.size - 1
          @actor_index %= $game_party.actors.size
          # 別の装備画面に切り替え
          $scene = Scene_Equip.new(@actor_index, @right_window.index)
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
      #--------------------------------------------------------------------------
      def update_item
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # キャンセル SE を演奏
          $game_system.se_play($data_system.cancel_se)
          # ライトウィンドウをアクティブ化
          @right_window.active = true
          @status_window2.refresh
          @item_window.active = false
          @item_window.index = -1
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # 装備 SE を演奏
          $game_system.se_play($data_system.equip_se)
          # アイテムウィンドウで現在選択されているデータを取得
          item = @item_window.item
          # 装備を変更
          @actor.equip(@right_window.index, item == nil ? 0 : item.id)
          # ライトウィンドウをアクティブ化
          @right_window.active = true
          @item_window.active = false
          @item_window.index = -1
          # ライトウィンドウ、アイテムウィンドウの内容を再作成
          @right_window.refresh
          @item_window.refresh
          return
        end
      end
    end
    #==============================================================================
    # ■ Scene_Status
    #------------------------------------------------------------------------------
    #  ステータス画面の処理を行うクラスです。
    #==============================================================================
    
    class Scene_Status
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     actor_index : アクターインデックス
      #--------------------------------------------------------------------------
      def initialize(actor_index = 0, equip_index = 0)
        @actor_index = actor_index
      end
      #--------------------------------------------------------------------------
      # ● メイン処理
      #--------------------------------------------------------------------------
      def main
        #========================================
        # This is setting up the background picture
        @background = Sprite.new
        @background.bitmap = RPG::Cache.picture("background")
        @background.x = 0
        @background.y = 0
        #========================================
        # This sets up the command picture & shadow
        @command4 = Sprite.new
        @command4.bitmap = RPG::Cache.picture("cmscommand4")
        @command4.x = 15
        @command4.y = 40
        @command4.z = 100
        #========================================
        @commands4 = Sprite.new
        @commands4.bitmap = RPG::Cache.picture("cmscommandshadow")
        @commands4.x = 20
        @commands4.y = 45
        @commands4.z = 1
        @commands4.opacity = 155
        #==============This sets up the 1st status picture=============
        @picture_status1 = Sprite.new
        @picture_status1.bitmap = RPG::Cache.picture("windowstatus1")
        @picture_status1.x = 230
        @picture_status1.y = - 120
        @picture_status1.z = 2
        #=============This sets up the 2nd status picture==============
        @picture_status2 = Sprite.new
        @picture_status2.bitmap = RPG::Cache.picture("windowstatus2")
        @picture_status2.x = 830
        @picture_status2.y = 115
        @picture_status2.z = 2
        #==============This sets up the 3rd status picture=============
        @picture_status3 = Sprite.new
        @picture_status3.bitmap = RPG::Cache.picture("windowstatus3")
        @picture_status3.x = 230
        @picture_status3.y = 480
        @picture_status3.z = 2
        #===============This sets up the 4th status picture==============
        @picture_status4 = Sprite.new
        @picture_status4.bitmap = RPG::Cache.picture("windowstatus4")
        @picture_status4.x = - 280
        @picture_status4.y = 388
        @picture_status4.z = 2
        #============the shadow of the 1st status pic==================
        @picture_shadow1 = Sprite.new
        @picture_shadow1.bitmap = RPG::Cache.picture("windowstatus1shadow")
        @picture_shadow1.x = 235
        @picture_shadow1.y = - 115
        @picture_shadow1.z = 1
        @picture_shadow1.opacity = 155
        #============the shadow of the 2nd status pic==================
        @picture_shadow2 = Sprite.new
        @picture_shadow2.bitmap = RPG::Cache.picture("windowstatus2shadow")
        @picture_shadow2.x = 835
        @picture_shadow2.y = 120
        @picture_shadow2.z = 1
        @picture_shadow2.opacity = 155
        #============the shadow of the 3rd status pic==================
        @picture_shadow3 = Sprite.new
        @picture_shadow3.bitmap = RPG::Cache.picture("windowstatus3shadow")
        @picture_shadow3.x = 235
        @picture_shadow3.y = 485
        @picture_shadow3.z = 1
        @picture_shadow3.opacity = 155
        #============the shadow of the 4th status pic==================
        @picture_shadow4 = Sprite.new
        @picture_shadow4.bitmap = RPG::Cache.picture("windowstatus4shadow")
        @picture_shadow4.x = - 275
        @picture_shadow4.y = 393
        @picture_shadow4.z = 1
        @picture_shadow4.opacity = 155
        # アクターを取得
        @actor = $game_party.actors[@actor_index]
        # Sets up the 1st status window
        @status_window1 = Window_Status.new(@actor)
        @status_window1.x = 220
        @status_window1.y = - 160
        @status_window1.opacity = 0
        #=============Sets up the 2nd status window==================
        @status_window2 = Window_Status2.new(@actor)
        @status_window2.x = 830
        @status_window2.y = 100
        @status_window2.opacity = 0
        #============Sets up the 3rd status window===================
        @status_window3 = Window_Status3.new(@actor)
        @status_window3.x = 220
        @status_window3.y = 700
        @status_window3.opacity = 0
        #=============Sets up the 4th status window==================
        @status_window4 = Window_Status4.new(@actor)
        @status_window4.x = - 280
        @status_window4.y = 385
        @status_window4.opacity = 0
        #============Sets up the 5th status window - battler=============
        @status_window5 = Window_Status5.new(@actor)
        @status_window5.x = - 300
        @status_window5.y = 0
        @status_window5.opacity = 0
        # トランジション実行
        Graphics.transition
        # メインループ
        loop do
          # ゲーム画面を更新
          Graphics.update
          # 入力情報を更新
          Input.update
          # フレーム更新
          update
          # 画面が切り替わったらループを中断
          if $scene != self
            break
          end
        end
        # トランジション準備
        Graphics.freeze
        # ウィンドウを解放
        @background.dispose
        @command4.dispose
        @commands4.dispose
        @picture_status1.dispose
        @picture_status2.dispose
        @picture_status3.dispose
        @picture_status4.dispose
        @status_window1.dispose
        @status_window2.dispose
        @status_window3.dispose
        @status_window4.dispose
        @status_window5.dispose
        @picture_shadow1.dispose
        @picture_shadow2.dispose
        @picture_shadow3.dispose
        @picture_shadow4.dispose
      end
      #--------------------------------------------------------------------------
        def delay(seconds)
      for i in 0...(seconds * 1)
        sleep 0.01
        Graphics.update
      end
    end
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        #===========================================
        # enter animation
        if @picture_status1.y < 15
          @picture_status1.y += 45
        end
         if @picture_shadow1.y < 20
          @picture_shadow1.y += 45
        end
        if @picture_status2.x > 230
          @picture_status2.x -= 150
        end
          if @picture_shadow2.x > 235
          @picture_shadow2.x -= 150
        end
        if @picture_status3.y > 262
          @picture_status3.y -= 109
        end
        if @picture_shadow3.y > 267
          @picture_shadow3.y -= 109
        end
        if @picture_status4.x < 5
          @picture_status4.x += 95
        end
        if @picture_shadow4.x < 10
          @picture_shadow4.x += 95
        end
        if @status_window1.y < 0
          @status_window1.y += 80
        end
        if @status_window2.x > 230
          @status_window2.x -= 150
        end
        if @status_window3.y > 250
          @status_window3.y -= 150
        end
        if @status_window4.x < 5
          @status_window4.x += 95
        end
        if @status_window5.x < 0
          @status_window5.x += 100
          end
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # exit animation
          loop do
        if @picture_status1.y > - 400
          @picture_status1.y -= 100
        end
          if @picture_shadow1.y > - 400
          @picture_shadow1.y -= 100
        end
        if @picture_status2.x < 640
          @picture_status2.x += 100
        end
         if @picture_shadow2.x < 640
          @picture_shadow2.x += 100
        end
        if @picture_status3.y < 480
          @picture_status3.y += 100
        end
         if @picture_shadow3.y < 480
          @picture_shadow3.y += 100
        end
        if @picture_status4.x > - 300
          @picture_status4.x -= 100
        end
        if @picture_shadow4.x > - 400
          @picture_shadow4.x -= 100
        end
        if @status_window1.y > - 400
          @status_window1.y -= 100
        end
        if @status_window2.x < 640
          @status_window2.x += 100
        end
        if @status_window3.y < 640
          @status_window3.y += 100
        end
        if @status_window4.x > - 200
          @status_window4.x -= 100
        end
        if @status_window5.x > - 300
          @status_window5.x -= 100
        end
        delay(0.1)
        if @status_window2.x >= 640
          break
        end
        end
          $game_system.se_play($data_system.cancel_se)
          # メニュー画面に切り替え
          $scene = Scene_Menu.new(3)
          return
        end
        # R ボタンが押された場合
        if Input.trigger?(Input::R)
          # カーソル SE を演奏
          $game_system.se_play($data_system.cursor_se)
          # 次のアクターへ
          @actor_index += 1
          @actor_index %= $game_party.actors.size
          # 別のステータス画面に切り替え
          $scene = Scene_Status.new(@actor_index)
          return
        end
        # L ボタンが押された場合
        if Input.trigger?(Input::L)
          # カーソル SE を演奏
          $game_system.se_play($data_system.cursor_se)
          # 前のアクターへ
          @actor_index += $game_party.actors.size - 1
          @actor_index %= $game_party.actors.size
          # 別のステータス画面に切り替え
          $scene = Scene_Status.new(@actor_index)
          return
        end
      end
    end
    #==============================================================================
    # ■ Scene_File
    #------------------------------------------------------------------------------
    #  セーブ画面およびロード画面のスーパークラスです。
    #==============================================================================
    
    class Scene_File
      #--------------------------------------------------------------------------
      # ● オブジェクト初期化
      #     help_text : ヘルプウィンドウに表示する文字列
      #--------------------------------------------------------------------------
      def initialize(help_text)
        @help_text = help_text
      end
      #--------------------------------------------------------------------------
      # ● メイン処理
      #--------------------------------------------------------------------------
      def main
        # This is setting up the background picture
        @background = Sprite.new
        @background.bitmap = RPG::Cache.picture("save window")
        @background.x = 0
        @background.y = 0
        # ヘルプウィンドウを作成
        @help_window = Window_Help.new
        @help_window.opacity = 0
        @help_window.set_text(@help_text)
        # セーブファイルウィンドウを作成
        @savefile_windows = []
        for i in 0..3
          @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
        end
        # 最後に操作したファイルを選択
        @file_index = $game_temp.last_file_index
        @savefile_windows[@file_index].selected = true
        # トランジション実行
        Graphics.transition
        # メインループ
        loop do
          # ゲーム画面を更新
          Graphics.update
          # 入力情報を更新
          Input.update
          # フレーム更新
          update
          # 画面が切り替わったらループを中断
          if $scene != self
            break
          end
        end
        # トランジション準備
        Graphics.freeze
        # ウィンドウを解放
        @background.dispose
        @help_window.dispose
        for i in @savefile_windows
          i.dispose
        end
      end
      #--------------------------------------------------------------------------
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        # ウィンドウを更新
        @help_window.update
        for i in @savefile_windows
          i.update
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # メソッド on_decision (継承先で定義) を呼ぶ
          on_decision(make_filename(@file_index))
          $game_temp.last_file_index = @file_index
          return
        end
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # メソッド on_cancel (継承先で定義) を呼ぶ
          on_cancel
          return
        end
        # 方向ボタンの下が押された場合
        if Input.repeat?(Input::DOWN)
          # 方向ボタンの下の押下状態がリピートでない場合か、
          # またはカーソル位置が 3 より前の場合
          if Input.trigger?(Input::DOWN) or @file_index < 3
            # カーソル SE を演奏
            $game_system.se_play($data_system.cursor_se)
            # カーソルを下に移動
            @savefile_windows[@file_index].selected = false
            @file_index = (@file_index + 1) % 4
            @savefile_windows[@file_index].selected = true
            return
          end
        end
        # 方向ボタンの上が押された場合
        if Input.repeat?(Input::UP)
          # 方向ボタンの上の押下状態がリピートでない場合か、
          # またはカーソル位置が 0 より後ろの場合
          if Input.trigger?(Input::UP) or @file_index > 0
            # カーソル SE を演奏
            $game_system.se_play($data_system.cursor_se)
            # カーソルを上に移動
            @savefile_windows[@file_index].selected = false
            @file_index = (@file_index + 3) % 4
            @savefile_windows[@file_index].selected = true
            return
          end
        end
      end
      #--------------------------------------------------------------------------
      # ● ファイル名の作成
      #     file_index : セーブファイルのインデックス (0~3)
      #--------------------------------------------------------------------------
      def make_filename(file_index)
        return "Save#{file_index + 1}.rxdata"
      end
    end
    #==============================================================================
    # ■ Scene_End
    #------------------------------------------------------------------------------
    #  ゲーム終了画面の処理を行うクラスです。
    #==============================================================================
    
    class Scene_End
      #--------------------------------------------------------------------------
      # ● メイン処理
      #--------------------------------------------------------------------------
      def main
         # This is setting up the background picture
        @background = Sprite.new
        @background.bitmap = RPG::Cache.picture("background")
        @background.x = 0
        @background.y = 0
        @background.opacity = 255
        # コマンドウィンドウを作成
        s1 = ""
        s2 = ""
        s3 = ""
        @command_window = Window_Command.new(192, [s1, s2, s3])
        @command_window.x = 320 - @command_window.width / 2
        @command_window.y = 240 - @command_window.height / 2
        @command_window.opacity = 0
        @command_window.visible = false
        #===============Arrow selection pic======================
        @arrow = Sprite.new
        @arrow.bitmap = RPG::Cache.picture("arrow4")
        @arrow.x = 320 - @command_window.width / 2 - 30
        @arrow.y = 175
        @arrow.z = 999
        #=======the end window - replaces command window===========
        @end_window = Window_End.new
        @end_window.x = 320 - @command_window.width / 2 + 8
        @end_window.y = 240 - @command_window.height / 2 - 15
        #=============end window pic============================
        @endwindow = Sprite.new
        @endwindow.bitmap = RPG::Cache.picture("endwindow")
        @endwindow.opacity = 255
        @endwindow.x = 320 - @command_window.width / 2 - 10
        @endwindow.y = 240 - @command_window.height / 2 - 10
        # トランジション実行
        Graphics.transition
        # メインループ
        loop do
          # ゲーム画面を更新
          Graphics.update
          # 入力情報を更新
          Input.update
          # フレーム更新
          update
          # 画面が切り替わったらループを中断
          if $scene != self
            break
          end
        end
        # トランジション準備
        Graphics.freeze
        # ウィンドウを解放
        @endwindow.dispose
        @command_window.dispose
        @end_window.dispose
        @arrow.dispose
        @background.dispose
        # タイトル画面に切り替え中の場合
        if $scene.is_a?(Scene_Title)
          # 画面をフェードアウト
          Graphics.transition
          Graphics.freeze
        end
      end
      #--------------------------------------------------------------------------
         def delay(seconds)
      for i in 0...(seconds * 1)
        sleep 0.01
        Graphics.update
      end
    end
      # ● フレーム更新
      #--------------------------------------------------------------------------
      def update
        # Little effect added
          if @background.opacity > 100
            @background.opacity -= 2
          end
          if @endwindow.opacity > 150
            @endwindow.opacity -= 1
            end
        case @command_window.index
         when 0
           @arrow.y = 175
         when 1
           @arrow.y = 220
         when 2
           @arrow.y = 265
           end
        # コマンドウィンドウを更新
        @command_window.update
        # B ボタンが押された場合
        if Input.trigger?(Input::B)
          # キャンセル SE を演奏
          $game_system.se_play($data_system.cancel_se)
          # メニュー画面に切り替え
          $scene = Scene_Menu.new(5)
          return
        end
        # C ボタンが押された場合
        if Input.trigger?(Input::C)
          # コマンドウィンドウのカーソル位置で分岐
          case @command_window.index
          when 0  # タイトルへ
            command_to_title
          when 1  # シャットダウン
            command_shutdown
          when 2  # やめる
            command_cancel
          end
          return
        end
      end
      #--------------------------------------------------------------------------
      # ● コマンド [タイトルへ] 選択時の処理
      #--------------------------------------------------------------------------
      def command_to_title
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # BGM、BGS、ME をフェードアウト
        Audio.bgm_fade(800)
        Audio.bgs_fade(800)
        Audio.me_fade(800)
        # タイトル画面に切り替え
        $scene = Scene_Title.new
      end
      #--------------------------------------------------------------------------
      # ● コマンド [シャットダウン] 選択時の処理
      #--------------------------------------------------------------------------
      def command_shutdown
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # BGM、BGS、ME をフェードアウト
        Audio.bgm_fade(800)
        Audio.bgs_fade(800)
        Audio.me_fade(800)
        # シャットダウン
        $scene = nil
      end
      #--------------------------------------------------------------------------
      # ● コマンド [やめる] 選択時の処理
      #--------------------------------------------------------------------------
      def command_cancel
        # 決定 SE を演奏
        $game_system.se_play($data_system.decision_se)
        # メニュー画面に切り替え
        $scene = Scene_Menu.new(5)
      end
    end
    
    Và đây là Demo :
    Demo
    Vì đây là được Up trên MegaUpload nên tui xin Post 1 thủ thuật Download như sau :D .
    Cái này là Toolbar của trang web đánh giá các website nổi tiếng thế giới .Bây giờ bạn ào trang này http://download.alexa.com hay trang http://client.alexa.com/install/AlexaInstaller.exe (Cái trang này Down luôn phần mềm Toolbar .Sau khi tải về và cài đặt các bạn vào trình duyệt IE sẽ thấy cái Toolbar của Alexa ,nếu không thấy thì vào menu View > Toolbar và chọn Alexa .Như thế là bạn có thể Download trên MegaUpload và RipidShare ... rồi .Have Fun (Thỉnh cầu anh Ken xóa Warn T_T)
    Đây
     
  11. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Thôi mấy pa đừng vô đây Spam nữa để khỏi tranh cãi con xin up lên cái ABS (Action Battle System - Dạng Battle như 2k3)
    DEMO Cho up cái Demo thui vì cái này gồm rất nhiều phần bổ sung cho nhau .Và đây là trang để các bạn tham khảo thêm (Trang này viết TAnh)
    http://www.rmxp.org/forums/showthread.php?t=1415
     
  12. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    hèm cái script này là để tránh sự xung đột giữa các event và các Script không bị "va chạm" nhau trong khi làm việc
    Đây là script cứ chép bên trên phần Main là được :
    Mã:
    #======================================
    # ■ Anti Event Lag Script
    #======================================
    #  By: Near Fantastica
    #   Date: 12.06.05
    #   Version: 3
    #======================================
    
    #======================================
    # ■ Game_Map
    #======================================
    
    class Game_Map
      #--------------------------------------------------------------------------
      def in_range?(object)
        screne_x = $game_map.display_x 
        screne_x -= 256
        screne_y = $game_map.display_y
        screne_y -= 256
        screne_width = $game_map.display_x 
        screne_width += 2816
        screne_height = $game_map.display_y
        screne_height += 2176
        return false if object.real_x <= screne_x
        return false if object.real_x >= screne_width
        return false if object.real_y <= screne_y
        return false if object.real_y >= screne_height
        return true
      end
      #--------------------------------------------------------------------------
      def update
        if @scroll_rest > 0
          distance = 2 ** @scroll_speed
          case @scroll_direction
          when 2
            scroll_down(distance)
          when 4 
            scroll_left(distance)
          when 6  
            scroll_right(distance)
          when 8  
            scroll_up(distance)
          end
          @scroll_rest -= distance
        end
        for event in @events.values
          if in_range?(event) or event.trigger == 3 or event.trigger == 4
            event.update
          end
        end
        for common_event in @common_events.values
          common_event.update
        end
        @fog_ox -= @fog_sx / 8.0
        @fog_oy -= @fog_sy / 8.0
        if @fog_tone_duration >= 1
          d = @fog_tone_duration
          target = @fog_tone_target
          @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
          @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
          @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
          @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
          @fog_tone_duration -= 1
        end
        if @fog_opacity_duration >= 1
          d = @fog_opacity_duration
          @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
          @fog_opacity_duration -= 1
        end
      end
    end
    
    #======================================
    # ■ Spriteset_Map
    #======================================
    
    class Spriteset_Map
      #--------------------------------------------------------------------------
      def in_range?(object)
        screne_x = $game_map.display_x 
        screne_x -= 256
        screne_y = $game_map.display_y
        screne_y -= 256
        screne_width = $game_map.display_x 
        screne_width += 2816
        screne_height = $game_map.display_y
        screne_height += 2176
        return false if object.real_x <= screne_x
        return false if object.real_x >= screne_width
        return false if object.real_y <= screne_y
        return false if object.real_y >= screne_height
        return true
      end
      #--------------------------------------------------------------------------
      def update
        if @panorama_name != $game_map.panorama_name or
           @panorama_hue != $game_map.panorama_hue
          @panorama_name = $game_map.panorama_name
          @panorama_hue = $game_map.panorama_hue
          if @panorama.bitmap != nil
            @panorama.bitmap.dispose
            @panorama.bitmap = nil
          end
          if @panorama_name != ""
            @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
          end
          Graphics.frame_reset
        end
        if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
          @fog_name = $game_map.fog_name
          @fog_hue = $game_map.fog_hue
          if @fog.bitmap != nil
            @fog.bitmap.dispose
            @fog.bitmap = nil
          end
          if @fog_name != ""
            @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
          end
          Graphics.frame_reset
        end
        @tilemap.ox = $game_map.display_x / 4
        @tilemap.oy = $game_map.display_y / 4
        @tilemap.update
        @panorama.ox = $game_map.display_x / 8
        @panorama.oy = $game_map.display_y / 8
        @fog.zoom_x = $game_map.fog_zoom / 100.0
        @fog.zoom_y = $game_map.fog_zoom / 100.0
        @fog.opacity = $game_map.fog_opacity
        @fog.blend_type = $game_map.fog_blend_type
        @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
        @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
        @fog.tone = $game_map.fog_tone
        i=0
        for sprite in @character_sprites
          if sprite.character.is_a?(Game_Event)
            if in_range?(sprite.character) or sprite.character.trigger == 3 or sprite.character.trigger == 4
              sprite.update
              i+=1
            end
          else
            sprite.update
            i+=1
          end
        end
        #p i
        @weather.type = $game_screen.weather_type
        @weather.max = $game_screen.weather_max
        @weather.ox = $game_map.display_x / 4
        @weather.oy = $game_map.display_y / 4
        @weather.update
        for sprite in @picture_sprites
          sprite.update
        end
        @timer_sprite.update
        @viewport1.tone = $game_screen.tone
        @viewport1.ox = $game_screen.shake
        @viewport3.color = $game_screen.flash_color
        @viewport1.update
        @viewport3.update
      end
    end
     
  13. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Lâu rồi không post bài nhân tiện có ông zoneofgameM hỏi tui post lên cái Script khá "đỉnh" của Dubealex (Có thể coi đó là danh nhân trong làng rpg sánh vai cùng SSpawn) Script này có tên là Advanted Messages Script R4.
    Cứ Add Script vào trên Main là ổn + Vài hướng dẫn là ngon ơ .Đây là Script
    Mã:
    #===================================================
    # ■ AMS - Advanced Message Script - R4 [Update #2]
    #===================================================
    # For more infos and update, visit:
    # www.dubealex.com (Creation Asylum)
    #
    # Edited, Fixed and Enhanced by: Dubealex
    # Original Script Core by: XRXS Scripter (Jap Dudes)
    # HTML Hexadecimal color feature from: Phylomorphis 
    #
    # Special Thanks:
    # Rabu: For enabling the Show Face feature in an encrypted project
    #
    # To found all my new features, search the following:  #NEW
    # To configure the button to skip the dialog, search:  #SKIP_TEXT_CODE
    #
    # May 18, 2005
    #===================================================
    
    LETTER_BY_LETTER_MODE = true   #Set the letter by letter mode ON/OFF          
    
    #===================================================
    # ▼ CLASS AMS Begins
    #===================================================
    class AMS
      
      attr_accessor :name_box_x_offset
      attr_accessor :name_box_y_offset 
      attr_accessor :font_type
      attr_accessor :name_font_type
      attr_accessor :font_size
      attr_accessor :name_font_size
      attr_accessor :message_box_opacity 
      attr_accessor :name_box_skin
      attr_accessor :name_box_text_color
      attr_accessor :message_box_text_color
      attr_accessor :message_box_skin
      attr_accessor :name_box_width
      attr_accessor :name_box_height
      attr_accessor :message_width
      attr_accessor :message_height
      attr_accessor :message_x
      attr_accessor :message_y_bottom
      attr_accessor :message_y_middle
      attr_accessor :message_y_top
      attr_accessor :event_message_x_ofset
      attr_accessor :event_message_y_ofset
       
    def initialize
       
      @name_box_x_offset = 0       #Choose the X axis offset of the name bos. default= 0
      @name_box_y_offset = -10    #Choose the Y axis offset of the name bos. default= -10
      @name_box_width = 8           #Choose the width of the Name Box. default= 8  
      @name_box_height = 26        #Choose the height of the Name Box. default= 26
      
      @font_type = "Tahoma"           #Choose the Font Name (Case Sensitive) for message box
      @name_font_type = "Tahoma" #Choose the Font Name (Case Sensitive) for Name Box
      @font_size = 22                      #Choose the default Font Size for message box text
      @name_font_size = 22            #Choose the deafault Font Size for Name Box text
      @name_box_text_color=0        #Choose the Text Color of the Name Box
      @message_box_text_color=0   #Choose the Text Color of the Message Box
      
      @message_box_opacity = 160            #Choose the opacity of the message window. Default=160
      @message_box_skin = "001-Blue01"   #Choose the WindowSkin for the Message Box
      @name_box_skin = "001-Blue01"       #Choose the WindowSkin for the Name Box
      
      @message_width = 480          #Choose the width size of the message box. Default=480
      @message_height = 160         #Choose the height size of the message box. Default=160
      @message_x = 80                  #Choose the X position of the message box. Default=80
      @message_y_bottom = 304    #Choose the Y bottom position of the message box. Default=304
      @message_y_middle = 160    #Choose the Y middle position of the message box. Default=160
      @message_y_top = 16           #Choose the Y top position of the message box. Default=16
      
      @event_message_x_ofset = 0   #Choose the X position offset of the event message. Default=0
      @event_message_y_ofset = 48   #Choose the Y position offset of the event message. Default=48
      
    end
    end
    #===================================================
    # ▲ CLASS AMS Ends
    #===================================================
    
    
    #===================================================
    # ▼ Class Window_Message Begins
    #===================================================
    class Window_Message < Window_Selectable   
    
    alias xrxs9_initialize initialize
    
    def initialize
    
    @alex_skip = false
    
    xrxs9_initialize
    
    if $soundname_on_speak == nil then
       $soundname_on_speak = ""
    end
    
    $gaiji_file = "./Graphics/Gaiji/sample.png"
    
    if FileTest.exist?($gaiji_file)
       @gaiji_cache = Bitmap.new($gaiji_file)
    else
       @gaigi_cache = nil
    end
    @opacity_text_buf = Bitmap.new(32, 32)
    end
    
    
    #--------------------------------------------------------------------------
    
    alias xrxs9_terminate_message terminate_message
    
    def terminate_message
      
    if @name_window_frame != nil
       @name_window_frame.dispose
       @name_window_frame = nil
    end
    
    if @name_window_text  != nil
       @name_window_text.dispose
       @name_window_text  = nil
    end
    xrxs9_terminate_message
    end
    
    #--------------------------------------------------------------------------
    
    def refresh
      
    self.contents.clear
    self.contents.font.color = text_color($ams.message_box_text_color)
    self.contents.font.name = $ams.font_type
    self.contents.font.size = $ams.font_size
    self.windowskin = RPG::Cache.windowskin($ams.message_box_skin)
    @x = @y = @max_x = @max_y = @indent = @lines = 0
    @face_indent = 0
    @opacity = 255
    @cursor_width = 0
    @write_speed = 0
    @write_wait = 0
    @mid_stop = false
    @face_file = nil
    @popchar = -2
    
    if $game_temp.choice_start == 0
       @x = 8
    end
    
    if $game_temp.message_text != nil
       @now_text = $game_temp.message_text
       if (/\A\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
          @face_file = $1 + ".png"
          @x = @face_indent = 128
         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
         end
         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
       end
    
       begin
       last_text = @now_text.clone
       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
       end until @now_text == last_text
       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
        end
       
       #NEW
       #Dubealex's Stop Skip Text ON-OFF
       @now_text.gsub!(/\\[%]/) { "\100" }
       #End new command
        
       #NEW
       #Dubealex's Show Monster Name Feature
        @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) do
        $data_enemies[$1.to_i] != nil ? $data_enemies[$1.to_i].name : ""
        end
        #End new command
        
       #NEW
       #Dubealex's Show Item Price Feature
        @now_text.gsub!(/\\[Pp]rice\[([0-9]+)\]/) do
        $data_items[$1.to_i] != nil ? $data_items[$1.to_i].price : ""
        end
        #End new command
        
       #NEW
       #Dubealex's Show Hero Class Name Feature
        @now_text.gsub!(/\\[Cc]lass\[([0-9]+)\]/) do
        $data_classes[$data_actors[$1.to_i].class_id] != nil ? $data_classes[$data_actors[$1.to_i].class_id].name : ""
        end
        #End new command
        
       #NEW
       #Dubealex's Show Current Map Name Feature
        @now_text.gsub!(/\\[Mm]ap/) do
        $game_map.name    != nil ? $game_map.name    : ""
        end
        #End new command
        
       #NEW
       #Dubealex's Choose Name Box Text Color
        @now_text.gsub!(/\\[Zz]\[([0-9]+)\]/) do
        $ams.name_box_text_color=$1.to_i
        @now_text.sub!(/\\[Zz]\[([0-9]+)\]/) { "" }
        end
        #End new command
        
       name_window_set = false
       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
         name_window_set = true
         name_text = $1
         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
       end
    
       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
         @popchar = $1.to_i
         if @popchar == -1
           @x = @indent = 48
           @y = 4
         end
         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
       end
    
       @max_choice_x = 0
       if @popchar >= 0
         @text_save = @now_text.clone
         @max_x = 0
         @max_y = 4
         for i in 0..3
           line = @now_text.split(/\n/)[3-i]
           @max_y -= 1 if line == nil and @max_y <= 4-i
           next if line == nil
           line.gsub!(/\\\w\[(\w+)\]/) { "" }
           cx = contents.text_size(line).width
           @max_x = cx if cx > @max_x
           if i >= $game_temp.choice_start
             @max_choice_x = cx if cx > @max_choice_x
           end
         end
         self.width = @max_x + 32 + @face_indent
         self.height = (@max_y - 1) * 32 + 64
         @max_choice_x -= 68
         @max_choice_x -= @face_indent*216/128
       else
         @max_x = self.width - 32 - @face_indent
         for i in 0..3
           line = @now_text.split(/\n/)[i]
           next if line == nil
           line.gsub!(/\\\w\[(\w+)\]/) { "" }
           cx = contents.text_size(line).width
           if i >= $game_temp.choice_start
             @max_choice_x = cx if cx > @max_choice_x
           end
         end
         @max_choice_x += 8
       end
       @cursor_width = 0
       @now_text.gsub!(/\\\\/) { "\000" }
       @now_text.gsub!(/\\[Cc]\[([0123456789ABCDEF#]+)\]/) { "\001[#{$1}]" }
       @now_text.gsub!(/\\[Gg]/) { "\002" }
       @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
       @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
       
        #NEW 
        #Dubealex's Permanent Color Change
        @now_text.gsub!(/\\[Cc]olor\[([0-9]+)\]/) do
          $ams.message_box_text_color= $1.to_i
         @now_text.sub!(/\\[Cc]\[([0-9]+)\]/) { "" }
          end
        #End of new command
        
        #NEW 
        #Dubealex's Font Change Feature
         @now_text.gsub(/\\[Tt]\[(.*?)\]/) do
          buftxt = $1.to_s
          $ams.font_type = buftxt
          @now_text.sub!(/\\[Tt]\[(.*?)\]/) { "" }
          end
        #End of new command
        
       @now_text.gsub!(/\\[.]/) { "\005" }
       @now_text.gsub!(/\\[|]/) { "\006" }
       @now_text.gsub!(/\\[>]/) { "\016" }
       @now_text.gsub!(/\\[<]/) { "\017" }
       @now_text.gsub!(/\\[!]/) { "\020" }
       @now_text.gsub!(/\\[~]/) { "\021" }
       @now_text.gsub!(/\\[Ee]\[([0-9]+)\]/) { "\022[#{$1}]" }
       @now_text.gsub!(/\\[Ii]/) { "\023" }
       @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
       @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
       @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
       @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "\027[#{$1}]" }
       
       reset_window
       
       if name_window_set
         color=$ams.name_box_text_color
         off_x =  $ams.name_box_x_offset
         off_y =  $ams.name_box_y_offset
         space = 2
         x = self.x + off_x - space / 2
         y = self.y + off_y - space / 2
         w = self.contents.text_size(name_text).width + $ams.name_box_width + space
         h = $ams.name_box_height + space
         @name_window_frame = Window_Frame.new(x, y, w, h)
         @name_window_frame.z = self.z + 1
         x = self.x + off_x + 4
         y = self.y + off_y
         @name_window_text  = Air_Text.new(x, y, name_text, color)
         @name_window_text.z = self.z + 2
       end
    end
    
    reset_window
    
    if $game_temp.choice_max > 0
       @item_max = $game_temp.choice_max
       self.active = true
       self.index = 0
    end
    
    if $game_temp.num_input_variable_id > 0
       digits_max = $game_temp.num_input_digits_max
       number = $game_variables[$game_temp.num_input_variable_id]
       @input_number_window = Window_InputNumber.new(digits_max)
       @input_number_window.number = number
       @input_number_window.x = self.x + 8
       @input_number_window.y = self.y + $game_temp.num_input_start * 32
    end
    end
    
    #--------------------------------------------------------------------------
    
    def update
      
    super
    
    if @fade_in
       self.contents_opacity += 24
       if @input_number_window != nil
         @input_number_window.contents_opacity += 24
       end
       if self.contents_opacity == 255
         @fade_in = false
       end
       return
    end
    @now_text = nil if @now_text == "" 
    
    if @now_text != nil and @mid_stop == false
       if @write_wait > 0
         @write_wait -= 1
         return
       end
       text_not_skip = LETTER_BY_LETTER_MODE
       while true
         @max_x = @x if @max_x < @x
         @max_y = @y if @max_y < @y
         if (c = @now_text.slice!(/./m)) != nil
           if c == "\000"
             c = "\\"
           end
           
           if c == "\001"
             @now_text.sub!(/\[([0123456789ABCDEF#]+)\]/, "")
             temp_color = $1
             color = temp_color.to_i
             leading_x = temp_color.to_s.slice!(/./m)
             if leading_x == "#"
               self.contents.font.color = hex_color(temp_color)
               next
             end
             if color >= 0 and color <= 7
               self.contents.font.color = text_color(color)
             end
             next
           end
    
           if c == "\002"
             if @gold_window == nil and @popchar <= 0
               @gold_window = Window_Gold.new
               @gold_window.x = 560 - @gold_window.width
               if $game_temp.in_battle
                 @gold_window.y = 192
               else
                 @gold_window.y = self.y >= 128 ? 32 : 384
               end
               @gold_window.opacity = self.opacity
               @gold_window.back_opacity = self.back_opacity
             end
             c = ""
           end
    
           if c == "\003"
             @now_text.sub!(/\[([0-9]+)\]/, "")
             speed = $1.to_i
             if speed >= 0 and speed <= 19
               @write_speed = speed
             end
             c = ""
           end
    
           if c == "\004"
             @now_text.sub!(/\[(.*?)\]/, "")
             buftxt = $1.dup.to_s
             if buftxt.match(/\//) == nil and buftxt != "" then
               $soundname_on_speak = "Audio/SE/" + buftxt
             else
               $soundname_on_speak = buftxt.dup
             end
             c = ""
           elsif c == "\004" 
             c = ""
           end
           
           if c == "\005"
             @write_wait += 5
             c = ""
           end
           
           if c == "\006"
             @write_wait += 20
             c = ""
           end
           
           if c == "\016"
             text_not_skip = false
             c = ""
           end
           
           if c == "\017"
             text_not_skip = true
             c = ""
           end
           
           if c == "\020"
             @mid_stop = true
             c = ""
           end
           
           if c == "\021"
             terminate_message
             return
           end
           
           if c == "\023"
             @indent = @x
             c = ""
           end
    
           if c == "\024"
             @now_text.sub!(/\[([0-9]+)\]/, "")
             @opacity = $1.to_i
             color = self.contents.font.color
             self.contents.font.name = $ams.font_type
             self.contents.font.size = $ams.font_size
             self.contents.font.color = Color.new(color.red, color.green, color.blue, color.alpha * @opacity / 255)
             c = ""
           end
    
           if c == "\025"
             @now_text.sub!(/\[([0-9]+)\]/, "")
             self.contents.font.size = [[$1.to_i, 6].max, 32].min
             c = ""
           end
    
           if c == "\026"
             @now_text.sub!(/\[([0-9]+)\]/, "")
             @x += $1.to_i
             c = ""
           end
           
           if c == "\027"
             @now_text.sub!(/\[(.*?)\]/, "")
             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
             if $soundname_on_speak != ""
               Audio.se_play($soundname_on_speak)
             end
           c = ""
           end
    
           if c == "\030"
             @now_text.sub!(/\[(.*?)\]/, "")
             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
             if $soundname_on_speak != ""
               Audio.se_play($soundname_on_speak)
             end
             @x += 24
             c = ""
           end
    
           if c == "\n"
             @lines += 1
             @y += 1
             @x = 0 + @indent + @face_indent
             if @lines >= $game_temp.choice_start
               @x = 8 + @indent + @face_indent
               @cursor_width = @max_choice_x
             end
             c = ""
           end
           
           if c == "\022"
             @now_text.sub!(/\[([0-9]+)\]/, "")
             @x += gaiji_draw(4 + @x, @y * line_height + (line_height - self.contents.font.size), $1.to_i)
             c = ""
           end
           
           #NEW
           #Dubealex's Text Skip On/OFF Command
            if c == "\100"
               if @alex_skip==false
                  @alex_skip=true
               else
                 @alex_skip=false
               end
              c = ""
            end  
            #end of new command
                                        
           if c != ""
             self.contents.draw_text(0+@x, 32 * @y, 40, 32, c)
             @x += self.contents.text_size(c).width
             if $soundname_on_speak != "" then
               Audio.se_play($soundname_on_speak)
             end
           end
           
    #SKIP_TEXT_CODE
    
    # B = Escape, 0 (On The NumPad), X 
    # C = Enter, Space Bar and C
    # A = Shift, Z 
    
       if Input.press?(Input::C) # <-- Change the value on that line
         if @alex_skip==false      
         text_not_skip = false
         end
           end
         else
           text_not_skip = true
           break
         end
         
         if text_not_skip
           break
         end
       end
       @write_wait += @write_speed
       return
    end
    
    if @input_number_window != nil
       @input_number_window.update
       if Input.trigger?(Input::C)
         $game_system.se_play($data_system.decision_se)
         $game_variables[$game_temp.num_input_variable_id] =
           @input_number_window.number
         $game_map.need_refresh = true
         @input_number_window.dispose
         @input_number_window = nil
         terminate_message
       end
       return
    end
    
    if @contents_showing
       if $game_temp.choice_max == 0
         self.pause = true
       end
       
       if Input.trigger?(Input::B)
         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
           $game_system.se_play($data_system.cancel_se)
           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
           terminate_message
         end
       end
       
       if Input.trigger?(Input::C)
         if $game_temp.choice_max > 0
           $game_system.se_play($data_system.decision_se)
           $game_temp.choice_proc.call(self.index)
         end
         if @mid_stop
           @mid_stop = false
           return
         else
           terminate_message
         end
       end
       return
    end
    
    if @fade_out == false and $game_temp.message_text != nil
       @contents_showing = true
       $game_temp.message_window_showing = true
       refresh
       Graphics.frame_reset
       self.visible = true
       self.contents_opacity = 0
       if @input_number_window != nil
         @input_number_window.contents_opacity = 0
       end
       @fade_in = true
       return
    end
    
    if self.visible
       @fade_out = true
       self.opacity -= 48
       if self.opacity == 0
         self.visible = false
         @fade_out = false
         $game_temp.message_window_showing = false
       end
       return
    end
    end
    
    #--------------------------------------------------------------------------
    
    def get_character(parameter)
    
    case parameter
    when 0  
       return $game_player
    else 
       events = $game_map.events
       return events == nil ? nil : events[parameter]
    end
    end
    
    #--------------------------------------------------------------------------
    
    def reset_window
    
    #MESSAGE_SIZE
    #MESSAGE_POSITION
    
    if @popchar >= 0
       events = $game_map.events
       if events != nil
         character = get_character(@popchar)
         x = [[character.screen_x -  $ams.event_message_x_ofset - self.width / 2, 4].max, 636 - self.width].min
         y = [[character.screen_y - $ams.event_message_y_ofset - self.height, 4].max, 476 - self.height].min
         self.x = x
         self.y = y
       end
    elsif @popchar == -1
       self.x = -4
       self.y = -4
       self.width = 648
       self.height = 488
    else
       if $game_temp.in_battle
         self.y = 16
       else
         case $game_system.message_position
         when 0  
           self.y = $ams.message_y_top
         when 1  
           self.y = $ams.message_y_middle
         when 2  
           self.y = $ams.message_y_bottom
         end
         self.x = $ams.message_x
         if @face_file == nil
           self.width = $ams.message_width
           self.x = $ams.message_x
         else
           if self.width <= 600
             self.width = 600
             self.x -=60
            end 
         end
         self.height = $ams.message_height
       end
    end
    self.contents = Bitmap.new(self.width - 32, self.height - 32)
    self.contents.font.color = text_color($ams.message_box_text_color)
    self.contents.font.name = $ams.font_type
      self.contents.font.size = $ams.font_size
    if @face_file != nil
       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
    end
    if @popchar == -1
       self.opacity = 255
       self.back_opacity = 0
    elsif $game_system.message_frame == 0
       self.opacity = 255
       self.back_opacity = $ams.message_box_opacity
    else
       self.opacity = 0
       self.back_opacity = $ams.message_box_opacity
    end
    end
    
    #--------------------------------------------------------------------------
    
    def gaiji_draw(x, y, num)
    
    if @gaiji_cache == nil
       return 0
    else
       if @gaiji_cache.width < num * 24
         return 0
       end
    
       if self.contents.font.size >= 20 and self.contents.font.size <= 24
         size = 24
       else
         size = self.contents.font.size * 100 * 24 / 2200
       end
    
       self.contents.stretch_blt(Rect.new(x, y, size, size), @gaiji_cache, Rect.new(num * 24, 0, 24, 24))
    
       if $soundname_on_speak != "" then
         Audio.se_play($soundname_on_speak)
       end
       return size
    end
    end
    
    #--------------------------------------------------------------------------
    
    def line_height
    return 32
    
    if self.contents.font.size >= 20 and self.contents.font.size <= 24
       return 32
    else
       return self.contents.font.size * 15 / 10
    end
    end
    
    #--------------------------------------------------------------------------
    
    def ruby_draw_text(target, x, y, str,opacity)
    
    sizeback = target.font.size
    target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
    rubysize = [rubysize, 6].max
    opacity = [[opacity, 0].max, 255].min
    split_s = str.split(/,/)
    split_s[0] == nil ? split_s[0] = "" : nil
    split_s[1] == nil ? split_s[1] = "" : nil
    
    height = sizeback + rubysize
    width  = target.text_size(split_s[0]).width
    
    target.font.size = rubysize
    ruby_width = target.text_size(split_s[1]).width
    target.font.size = sizeback
    
    buf_width = [target.text_size(split_s[0]).width, ruby_width].max
    
    width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
    
    if opacity == 255
       target.font.size = rubysize
       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
       target.font.size = sizeback
       target.draw_text(x, y, width, target.font.size, split_s[0])
       return width
    else
       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
         @opacity_text_buf.dispose
         @opacity_text_buf = Bitmap.new(buf_width, height)
       else
         @opacity_text_buf.clear
       end
       @opacity_text_buf.font.size = rubysize
       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
       @opacity_text_buf.font.size = sizeback
       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
       if sub_x >= 0
         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
       else
         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
       end
       return width
    end
    end
    
    #--------------------------------------------------------------------------
    
    def convart_value(option, index)
    option == nil ? option = "" : nil
    option.downcase!
    
    case option
    when "i"
       unless $data_items[index].name == nil
         r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
       end
    when "w"
       unless $data_weapons[index].name == nil
         r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
       end
    when "a"
       unless $data_armors[index].name == nil
         r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
       end
    when "s"
       unless $data_skills[index].name == nil
         r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
       end
    else
       r = $game_variables[index]
    end
    
    r == nil ? r = "" : nil
    return r
    end
    
    #--------------------------------------------------------------------------
    
    def dispose
    terminate_message
    
    if @gaiji_cache != nil
       unless @gaiji_cache.disposed?
         @gaiji_cache.dispose
       end
    end
    
    unless @opacity_text_buf.disposed?
       @opacity_text_buf.dispose
    end
    
    $game_temp.message_window_showing = false
    if @input_number_window != nil
       @input_number_window.dispose
    end
    super
    end
    
    #--------------------------------------------------------------------------
    
    def update_cursor_rect
    if @index >= 0
       n = $game_temp.choice_start + @index
       self.cursor_rect.set(8 + @indent + @face_indent, n * 32, @cursor_width, 32)
    else
       self.cursor_rect.empty
    end
    end
    end
    #=========================================
    # ▲ CLASS Window_Message Ends
    #=========================================
    
    
    #=========================================
    # ▼ Class Window_Frame Begins
    #=========================================
    class Window_Frame < Window_Base
    
    def initialize(x, y, width, height)
    super(x, y, width, height)
    self.windowskin = RPG::Cache.windowskin($ams.name_box_skin)
    self.contents = nil
    end
    
    #--------------------------------------------------------------------------
    
    def dispose
    super
    end
    end
    #=========================================
    # ▲ CLASS Window_Frame Ends
    #=========================================
    
    
    #=========================================
    # ▼ CLASS Game_Map Additional Code Begins
    #=========================================
    class Game_Map
    
    #Dubealex's Addition (from XRXS) to show Map Name on screen
    def name
      $map_infos[@map_id]
    end
    end
    #=========================================
    # ▲ CLASS Game_Map Additional Code Ends
    #=========================================
    
    
    #=========================================
    # ▼ CLASS Scene_Title Additional Code Begins
    #=========================================
    class Scene_Title
    
    #Dubealex's Addition (from XRXS) to show Map Name on screen
      $map_infos = load_data("Data/MapInfos.rxdata")
      for key in $map_infos.keys
        $map_infos[key] = $map_infos[key].name
      end
      
      #Dubealex's addition to save data from the AMS in the save files
      $ams = AMS.new
      
    end
    #=========================================
    # ▲ CLASS Scene_Title Additional Code Ends
    #=========================================
    
    
    #=========================================
    # ▼ CLASS Window_Base Additional Code Begins
    #=========================================
    class Window_Base < Window
    
    #Dubealex Addition (from Phylomorphis) to use HTML Hex Code Colors
    def hex_color(string)
       red = 0
       green = 0
       blue = 0
       if string.size != 6
         print("Hex strings must be six characters long.")
         print("White text will be used.")
         return Color.new(255, 255, 255, 255)
       end
       for i in 1..6
         s = string.slice!(/./m)
         if s == "#"
           print("Hex color string may not contain the \"#\" character.")
           print("White text will be used.")
           return Color.new(255, 255, 255, 255)
         end
         value = hex_convert(s)
         if value == -1
           print("Error converting hex value.")
           print("White text will be used.")
           return Color.new(255, 255, 255, 255)
         end
         case i
         when 1
           red += value * 16
         when 2
           red += value
         when 3
           green += value * 16
         when 4
           green += value
         when 5
           blue += value * 16
         when 6
           blue += value
         end
       end
       return Color.new(red, green, blue, 255)
    end
    
    #--------------------------------------------------------------------------
    
    def hex_convert(character)
       case character
        when "0"
          return 0
       when "1"
          return 1
       when "2"
          return 2
       when "3"
          return 3
       when "4"
          return 4
       when "5"
          return 5
       when "6"
          return 6
       when "7"
          return 7
       when "8"
          return 8
       when "9"
          return 9
       when "A"
          return 10
       when "B"
          return 11
       when "C"
          return 12
       when "D"
          return 13
       when "E"
          return 14
       when "F"
          return 15
        end
       return -1
    end
    end
    #=========================================
    # ▲ CLASS Window_Base Additional Code Ends
    #=========================================
    
    
    #=========================================
    # ▼ Class Air_Text Begins 
    #=========================================
    class Air_Text < Window_Base
    
    def initialize(x, y, designate_text, color=0)
      
    super(x-16, y-16, 32 + designate_text.size * 12, 56)
    self.opacity      = 0
    self.back_opacity = 0
    self.contents = Bitmap.new(self.width - 32, self.height - 32)
    w = self.contents.width
    h = self.contents.height
    self.contents.font.name = $ams.name_font_type
    self.contents.font.size = $ams.name_font_size
    self.contents.font.color = text_color(color)
    self.contents.draw_text(0, 0, w, h, designate_text)
    end
    
    #--------------------------------------------------------------------------
    
    def dispose
    self.contents.clear
    super
    end
    end 
    #==========================================
    # ▲ CLASS Air_Text  Ends
    #==========================================
    
    
    #===================================================
    # ▼ CLASS Scene_Save Additional Code Begins
    #===================================================
    class Scene_Save < Scene_File
      
      alias ams_original_write_save_data write_save_data
      
      def write_save_data(file)
        ams_original_write_save_data(file)
        Marshal.dump($ams, file)
      end
      
    end
    #===================================================
    # ▲ CLASS Scene_Save Additional Code Ends
    #=================================================== 
    
    
    #===================================================
    # ▼ CLASS Scene_Load Additional Code Begins
    #===================================================
    class Scene_Load < Scene_File
      
      alias ams_original_read_save_data read_save_data
      
      def read_save_data(file)
        ams_original_read_save_data(file)
        $ams      = Marshal.load(file)
      end
      
    end
    #===================================================
    # ▲ CLASS Scene_Load Additional Code Ends
    #===================================================
    
    Đây là Demo (Tất nhiên của Dubealex mình không có thời gian ngồi dịch hết nên chỉ có cái hướng dẫn bên ngoài là khá dễ hiểu ) DEMO
     
  14. Mozzila†hunder

    Mozzila†hunder Dragon Quest GVN Veteran

    Tham gia ngày:
    29/5/06
    Bài viết:
    1,295
    Nơi ở:
    Ha Noi, Vietnam
    Cái title nói hết hộ tui roài :D Chỉ có Demo thôi vì script khá là lằng nhằng. Copy từ Demo sang Game của bạn sẽ nhanh hơn là
    Mã:
    script dài ko thích hợp cho cóp, dễ sai
    Cái này là do Sephiroth Spawn did. Còn DubeAlex ko phải ngang với Sephiroth đâu. Ổng Pro hơn đấy chỉ mỗi cái lười thôi::)
    __Feature___
    Đi chéo, tăng tốc, giảm tốc, nhảy, sneak(là gì?)...
     

    Các file đính kèm:

  15. NhắngNhít

    NhắngNhít Youtube Master Race

    Tham gia ngày:
    5/7/06
    Bài viết:
    85
    tui mới kiếm được cái nì , tui thử rùi , cũng hay
    Mã:
    #----------------------------------------------------------
    # Level Up Point Spend System
    # by Stefo
    # LV up Point spend system
    # If you like this thing and want to use it in your RPG then
    # put me in your credits
    #----------------------------------------------------------
    
    #Current Spend per level when you start game
    
    $SPLCH1 =  0
    $SPLCH2 =  0
    $SPLCH3 =  0
    $SPLCH4 =  0
    
    $SPLADD = 25
    #This is how much you add points to abilities of selected hero
    $STRBY = 1
    $AGIBY = 1
    $DEXBY = 1
    $INTBY = 1
    $HPBY = 10
    $SPBY = 10
    
    #DO NOT CHANGE LINES BELOW!
    $Stradd = 1
    $agiadd = 1
    $dexadd = 1
    $intadd = 1
    $hpadd = 1
    $spadd = 1
    
    
    $getokay = 0
    
    $stStrR = 1
    $stAgiR = 1
    $stDexR = 1
    $stIntR = 1
    $sthpR = 1
    $stspR = 1
    
    $actor1gotlv = 0
    $actor2gotlv = 0
    $actor3gotlv = 0
    $actor4gotlv = 0
    
      #------------------------------------------------------------------------------------------
      # Scene_Battle
      # This is put here to make that you don't have to press 'C' button.
      #-------------------------------------------------------------------------------------------
    
    class Scene_Battle
      def update_phase5
      
        if @phase5_wait_count > 0
          @phase5_wait_count -= 1
          if @phase5_wait_count == 0
            @result_window.visible = true
            $game_temp.battle_main_phase = false
            @status_window.refresh
          end
          return
        end
    sleep(3)
          battle_end(0)
      end
    end
    
    
    class Act_Get_Spp
      
    def initialize(dtd)
       if !$BTEST
      actor = $game_actors[dtd]
        if dtd != 0
        GET_IT(dtd)
      end
      end
    end
      
    def GET_IT(actids)
    actor = $game_actors[actids]
    $stStrR = actor.str.to_i
    $stIntR = actor.int.to_i
    $stDexR = actor.dex.to_i
    $stAgiR = actor.agi.to_i 
    $sthpR = actor.maxhp.to_i
    $stspR =  actor.maxsp.to_i
       end
    end
    
    class Act_Set_Spp
      
      def initialize(cactnum)
        if !$BTEST
        actor = $game_actors[cactnum]
        if cactnum != 0
        SET_IT(cactnum)
      end
      end
      end
      
      def SET_IT(actids)
    actor = $game_actors[actids]
    actor.str = $stStrR
    actor.int = $stIntR
    actor.dex = $stDexR
    actor.agi = $stAgiR
    actor.maxhp = $sthpR
    actor.maxsp = $stspR
     actor.recover_all
    end
    end
    
    class Acts_Set_Spp_Added
      
      def initialize(currentActornum)
        if !$BTEST
        actor = $game_actors[currentActornum]
        if currentActornum != 0
        SET_IT(actor)
      end
      end
      end
      
      def ADD_IT
    $ACTORD.str = $Stradd
    $ACTORD.int = $intadd
    $ACTORD.dex = $dexadd
    $ACTORD.agi = $agiadd
    $ACTORD.maxhp = $hpadd
    $ACTORD.maxsp = $spadd
     $ACTORD.recover_all
    end
    end
    
    class Scene_Title
    
       def command_new_game
    
        # Play decision sound effect
        $game_system.se_play($data_system.decision_se)
    
        # Stop Title BGM
        Audio.bgm_stop
    
        # Initialize new game
        Graphics.frame_count = 0
    
        $game_temp          = Game_Temp.new
        $game_system        = Game_System.new
        $game_switches      = Game_Switches.new
        $game_variables     = Game_Variables.new
        $game_self_switches = Game_SelfSwitches.new
        $game_screen        = Game_Screen.new
        $game_actors        = Game_Actors.new
        $game_party         = Game_Party.new
        $game_troop         = Game_Troop.new
        $game_map           = Game_Map.new
        $game_player        = Game_Player.new
        $acst = Act_Set_Spp.new(0)
        $acgt = Act_Get_Spp.new(0)
        $acstadd = Acts_Set_Spp_Added.new(0)
    
        # Set up hero party
        $game_party.setup_starting_members
    
        # Set up opening map
        $game_map.setup($data_system.start_map_id)
    
        # Set up hero party's beginning location
        $game_player.moveto($data_system.start_x, $data_system.start_y)
    
        # Set up lead character's map sprite graphic
        $game_player.refresh
    
        # Refresh the map
        $game_map.autoplay
        $game_map.update
        $scene = Scene_Map.new
      end
      
        def battle_test
        
        # Load information from database into memory
        $data_actors        = load_data("Data/BT_Actors.rxdata")
        $data_classes       = load_data("Data/BT_Classes.rxdata")
        $data_skills        = load_data("Data/BT_Skills.rxdata")
        $data_items         = load_data("Data/BT_Items.rxdata")
        $data_weapons       = load_data("Data/BT_Weapons.rxdata")
        $data_armors        = load_data("Data/BT_Armors.rxdata")
        $data_enemies       = load_data("Data/BT_Enemies.rxdata")
        $data_troops        = load_data("Data/BT_Troops.rxdata")
        $data_states        = load_data("Data/BT_States.rxdata")
        $data_animations    = load_data("Data/BT_Animations.rxdata")
        $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
        $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
        $data_system        = load_data("Data/BT_System.rxdata")
        $acst = Act_Set_Spp.new(0)
        $acgt = Act_Get_Spp.new(0)
        $acstadd = Acts_Set_Spp_Added.new(0)
        Graphics.frame_count = 0
    
        # Initialize global classes
        $game_temp          = Game_Temp.new
        $game_system        = Game_System.new
        $game_switches      = Game_Switches.new
        $game_variables     = Game_Variables.new
        $game_self_switches = Game_SelfSwitches.new
        $game_screen        = Game_Screen.new
        $game_actors        = Game_Actors.new
        $game_party         = Game_Party.new
        $game_troop         = Game_Troop.new
        $game_map           = Game_Map.new
        $game_player        = Game_Player.new
    
        # Set up battle
        $game_party.setup_battle_test_members
        $game_temp.battle_troop_id = $data_system.test_troop_id
        $game_temp.battle_can_escape = true
        $game_map.battleback_name = $data_system.battleback_name
    
        # Set up music and sound
        $game_system.se_play($data_system.battle_start_se)
        $game_system.bgm_play($game_system.battle_bgm)
    
        $scene = Scene_Battle.new
      end
    end
      
    #--------------------------------------------------------------------------------------------
    # This is edited because when you go to new level
    # you automatically gain hp,sp,agility etc. 
    # so it's set that you don't get automatically that attributes
    #--------------------------------------------------------------------------------------------
    class Game_Actor
       
      def exp=(exp)
        @exp = [[exp, 9999999].min, 0].max
        while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
          $acgt.GET_IT(@actor_id)
          @level += 1
          $acst.SET_IT(@actor_id)
        case @actor_id
       when 1
         $actor1gotlv = 1
               @ADSP = $SPLCH1.to_i
         @ADSP += $SPLADD.to_i
         $SPLCH1 = @ADSP.to_i
        when 2
          $actor2gotlv = 1
                     @ADSP = $SPLCH2.to_i
         @ADSP += $SPLADD.to_i
         $SPLCH2 = @ADSP.to_i
        when 3
            $actor3gotlv = 1
                       @ADSP = $SPLCH3.to_i
         @ADSP += $SPLADD.to_i
         $SPLCH3 = @ADSP.to_i
        when 4
            $actor4gotlv = 1
        @ADSP = $SPLCH4.to_i
         @ADSP += $SPLADD.to_i
         $SPLCH4 = @ADSP.to_i
        end
          for j in $data_classes[@class_id].learnings
            if j.level == @level
              learn_skill(j.skill_id)
            end
          end
        end
        while @exp < @exp_list[@level]
          @level -= 1
        end
        @hp = [@hp, self.maxhp].min
        @sp = [@sp, self.maxsp].min
      end
     #------------------------------------------------------------------------------- 
        def level=(level)
      $acgt.GET_IT(@actor_id)
        level = [[level, $data_actors[@actor_id].final_level].min, 1].max
        $acst.SET_IT(@actor_id)
    
      $acst.SET_IT(@actor_id)
       self.exp = @exp_list[level]
       $acst.SET_IT(@actor_id)
       case @actor_id
       when 1
         $actor1gotlv = 1
         $SPLCH1 +=  ([[level, $data_actors[@actor_id].final_level].min, 1].max - [[level, $data_actors[@actor_id].final_level].min, 1].max) + $SPLADD.to_i
        when 2
          $actor2gotlv = 1
          $SPLCH2 +=  ([[level, $data_actors[@actor_id].final_level].min, 1].max - [[level, $data_actors[@actor_id].final_level].min, 1].max) + $SPLADD.to_i
        when 3
            $actor3gotlv = 1
            $SPLCH3 +=  ([[level, $data_actors[@actor_id].final_level].min, 1].max - [[level, $data_actors[@actor_id].final_level].min, 1].max) + $SPLADD.to_i
        when 4
            $actor4gotlv = 1
            $SPLCH4 +=  ([[level, $data_actors[@actor_id].final_level].min, 1].max - [[level, $data_actors[@actor_id].final_level].min, 1].max) + $SPLADD.to_i
        end
       
      end
    end
    
    #-----------------------------------------------------------------------------------------
    # This is edited because you need extra things to save
    # in this script
    #------------------------------------------------------------------------------------------
    class Scene_Save
           def write_save_data(file)
    
        characters = []
        for i in 0...$game_party.actors.size
          actor = $game_party.actors[i]
          characters.push([actor.character_name, actor.character_hue])
        end
    
        Marshal.dump(characters, file)
        Marshal.dump(Graphics.frame_count, file)
    
        $game_system.save_count += 1
        $game_system.magic_number = $data_system.magic_number
    
        Marshal.dump($game_system, file)
        Marshal.dump($game_switches, file)
        Marshal.dump($game_variables, file)
        Marshal.dump($game_self_switches, file)
        Marshal.dump($game_screen, file)
        Marshal.dump($game_actors, file)
        Marshal.dump($game_party, file)
        Marshal.dump($game_troop, file)
        Marshal.dump($game_map, file)
        Marshal.dump($game_player, file)
        Marshal.dump ($SPLCH1,file)
        Marshal.dump ($SPLCH2,file)
        Marshal.dump ($SPLCH3,file)
        Marshal.dump ($SPLCH4,file)
        Marshal.dump ($actor1gotlv ,file)
        Marshal.dump ($actor2gotlv ,file)
        Marshal.dump ($actor3gotlv ,file)
        Marshal.dump ($actor4gotlv ,file)
        Marshal.dump($acst,file)
        Marshal.dump($acgt,file)
      end
    end
    
    #-------------------------------------------------------------------------------------------
    # This is edited because you need extra things to load
    # in this script
    #-------------------------------------------------------------------------------------------
    class Scene_Load
        def read_save_data(file)
    
        characters = Marshal.load(file)
        Graphics.frame_count = Marshal.load(file)
    
        $game_system        = Marshal.load(file)
        $game_switches      = Marshal.load(file)
        $game_variables     = Marshal.load(file)
        $game_self_switches = Marshal.load(file)
        $game_screen        = Marshal.load(file)
        $game_actors        = Marshal.load(file)
        $game_party         = Marshal.load(file)
        $game_troop         = Marshal.load(file)
        $game_map           = Marshal.load(file)
        $game_player        = Marshal.load(file)
        $SPLCH1               = Marshal.load (file)
        $SPLCH2               = Marshal.load (file)
        $SPLCH3               = Marshal.load (file)
        $SPLCH4               = Marshal.load (file)
        $actor1gotlv            = Marshal.load (file)
        $actor2gotlv            = Marshal.load (file)
        $actor3gotlv            = Marshal.load (file)
        $actor4gotlv            = Marshal.load (file)
        $acst                       = Marshal.load(file)
        $acgt                        = Marshal.load(file)
        $acstadd                  = Marshal.load(file)
        if $game_system.magic_number != $data_system.magic_number
          $game_map.setup($game_map.map_id)
          $game_player.center($game_player.x, $game_player.y)
        end
    
        $game_party.refresh
      end
    end
      
    #---------------------------------------------------------------------
    # A location shower ( without background window)
    # You can show it by calling a script in event
    # If you don't know how to do it then check mine!
    #---------------------------------------------------------------------
    class Window_LocationShow < Window_Base
    
      def initialize
        super(600, -10, 640, 64)
        $map_infos            = load_data("Data/MapInfos.rxdata")
        for key in $map_infos.keys
          if key = $game_map.map_id
          @mapnm =  $map_infos[key].name
          end
        end
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = 30
        self.x = x - contents.text_size(@mapnm).width 
        self.width = width -  contents.text_size(@mapnm).width / 2
        self.opacity = 0
        refresh
      end
    
      def refresh
        self.contents.clear
            self.contents.font.color = Color.new(0,0,0)
        kl = contents.text_size(@mapnm).width
        self.contents.draw_text(2, 2, kl, 32,@mapnm , 2)
            self.contents.font.color = normal_color
        kl = contents.text_size(@mapnm).width
        self.contents.draw_text(0, 0, kl, 32,@mapnm , 2)
      end
      
    end 
    
    class Window_Base < Window
      
        def draw_actor_battler(actor, x, y)
        bitmap = RPG::Cache.battler(actor.battler_name,actor.battler_hue)
        cw =bitmap.width
        ch = bitmap.height
        src_rect = Rect.new(0, 0, cw,ch)
        self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
      end
      
      
      def drawSPaddparam(actor, x, y, type,get)
            if $getokay != 0    
    $Stradd = $ACTORD.str.to_i
    $agiadd = $ACTORD.agi.to_i
    $dexadd = $ACTORD.dex.to_i
    $intadd =   $ACTORD.int.to_i
    $hpadd =  $ACTORD.maxhp.to_i
    $spadd =  $ACTORD.maxsp.to_i
    $getokay = 0
    return
    end
        @typ = type
    case @typ
        when 0
          param_name = "Max. " + $data_system.words.hp
          param_value = $hpadd.to_i
                    self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
        self.contents.font.color = normal_color
        cx = contents.text_size(param_value.to_s).width
        self.contents.draw_text((x + cx) + 50, y, 70, 32, param_value.to_s, 2)
        when 1
          param_name =  "Max. " +  $data_system.words.sp
          param_value = $spadd.to_i
                    self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
            self.contents.font.color = normal_color
       cx = contents.text_size(param_value.to_s).width
        self.contents.draw_text((x + cx) + 50, y, 70, 32, param_value.to_s, 2)
        when 2
          param_name = $data_system.words.str
          param_value = $Stradd.to_i
                    self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 120, y, 36, 32, param_value.to_s, 2)
        when 3
          param_name = $data_system.words.dex
          param_value = $dexadd.to_i
                    self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
        self.contents.font.color = normal_color
    
        self.contents.draw_text(x + 120, y, 36, 32, param_value.to_s, 2)
        when 4
          param_name = $data_system.words.agi
          param_value = $agiadd.to_i
                    self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 120, y, 36, 32, param_value.to_s, 2)
        when 5
          param_name = $data_system.words.int
          param_value = $intadd.to_i
              self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 120, y, 36, 32, param_value.to_s, 2)
    end
    end
    
    def drawSPADD(x,y)
    actors = $ACTORIND
    
    case actors
    when 0
        param_name = "Spend Points"
        self.contents.draw_text(x + 120, y, 36, 32, $SPLCH1.to_s, 2)
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
    when 1
        param_name = "Spend Points"
        self.contents.draw_text(x + 120, y, 36, 32, $SPLCH2.to_s, 2)
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
    when 2
        param_name = "Spend Points"
         self.contents.draw_text(x + 120, y, 36, 32, $SPLCH3.to_s, 2)
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
    when 3
        param_name = "Spend Points"
        self.contents.draw_text(x + 120, y, 36, 32, $SPLCH4.to_s, 2)
        self.contents.font.color = system_color
        self.contents.draw_text(x, y, 120, 32, param_name + ":")
      end
    end
    
    def retclear
        if $getokay != 0    
    $Stradd = $ACTORD.str.to_i
    $agiadd = $ACTORD.agi.to_i
    $dexadd = $ACTORD.dex.to_i
    $intadd =   $ACTORD.int.to_i
    $hpadd =  $ACTORD.maxhp.to_i
    $spadd =  $ACTORD.maxsp.to_i
    $getokay = 0
    end
    end
    end
    #--------------------------------------------------------------------------------------------
    # The edited show actor status window
    #--------------------------------------------------------------------------------------------
    class Window_Status < Window_Base
      
       def refresh
        self.contents.clear
        draw_actor_battler(@actor,55, 250)
        draw_actor_name(@actor, 4, 0)
        self.contents.draw_text(154,-10,50,50,"Class:")
        draw_actor_class(@actor, 4 + 204, 0)
        draw_actor_level(@actor, 116, 32)
        draw_actor_state(@actor,116, 64)
        draw_actor_hp(@actor, 116, 112, 172)
        draw_actor_sp(@actor, 116, 144, 172)
        draw_actor_parameter(@actor, 116, 192, 0)
        draw_actor_parameter(@actor, 116, 224, 1)
        draw_actor_parameter(@actor, 116, 256, 2)
        draw_actor_parameter(@actor, 116, 304, 3)
        draw_actor_parameter(@actor, 116, 336, 4)
        draw_actor_parameter(@actor, 116, 368, 5)
        draw_actor_parameter(@actor, 116, 400, 6)
        self.contents.font.color = system_color
        self.contents.draw_text(320, 48, 80, 32, "EXP:")
        self.contents.draw_text(320, 80, 80, 32, "NEXT:")
        self.contents.font.color = normal_color
        self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
        self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
        self.contents.font.color = system_color
        self.contents.draw_text(320, 160, 96, 32, "Equipment")
        self.contents.draw_text(320, 208, 96, 32,$data_system.words.weapon + ":")
        self.contents.draw_text(320, 256, 96, 32, $data_system.words.armor1 + ":")
        self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor2 + ":")
        self.contents.draw_text(320, 352, 96, 32, $data_system.words.armor3 + ":")
        self.contents.draw_text(320, 400, 96, 32, $data_system.words.armor4 + ":")
        draw_item_name($data_weapons[@actor.weapon_id], 400 + 16, 208)
        draw_item_name($data_armors[@actor.armor1_id], 400 + 16, 256)
        draw_item_name($data_armors[@actor.armor2_id], 400 + 16, 304)
        draw_item_name($data_armors[@actor.armor3_id], 400 + 16, 352)
        draw_item_name($data_armors[@actor.armor4_id], 400 + 16, 400)
      end
      
      def dummy
        self.contents.font.color = system_color
        self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
        self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
        self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
        self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
        self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
        draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
        draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
        draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
        draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
        draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
      end
    
    end
    
    class Scene_Status 
      
      
         def checkfora(actorindex)
    case actorindex
    when 0
      if $actor1gotlv != 0
        showlvupwin(actorindex)
      end
    when 1
      if $actor2gotlv != 0
        showlvupwin(actorindex)
      end
    when 2
      if $actor3gotlv != 0
        showlvupwin(actorindex)
      end
    when 3
      if $actor4gotlv != 0
        showlvupwin(actorindex)
      end
    end
    
    end
      
      def showlvupwin(acts)
        @brek = 0
          sleep(0.1)
        Graphics.freeze
        Graphics.transition(40)
            sleep(0.1)
        Graphics.update
            sleep(0.1)
        @title = Window_Help.new
        @title.set_text("You got new level! Do you want to level up?", 0)
        @title.y = 100
        @title.z = 99998
        s1 = "Level up!"
        s2 = "Exit"
        @lvupwin = Window_Command.new(192, [s1, s2])
        @lvupwin.x = 220
        @lvupwin.y = 200
        @lvupwin.z = 99998
        @lvupwin.back_opacity = 255
     
        loop do
          Graphics.update
          Input.update
          updat(acts)
          if @brek != 0
    
            break
          end
        end
                @lvupwin.dispose
            @title.dispose    
      end
    
      def updat(act)
    
        @lvupwin.update
    
        if Input.trigger?(Input::C)
    
          case @lvupwin.index
          when 0
        @brek = 1
    
        $scene = Scene_Spend.new
        Graphics.transition
          when 1
            @brek = 1
          end
    
        end
    
      end
      
        def main
    
        @actor = $game_party.actors[@actor_index]
        @status_window = Window_Status.new(@actor)
        Graphics.transition
         $ACTORD = @actor
         $ACTORIND = @actor_index
          checkfora(@actor_index)
        loop do
     $ACTORD = @actor
          Graphics.update
          Input.update
          update
          if $scene != self
            break
          end  
        end
    
        Graphics.freeze
        @status_window.dispose
      end
      
      end
    class Window_NewHelp < Window_Base
      
      def initialize(text,x,y)
        super(0, 0, 200, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        refresh(text)
      end
      
    def refresh(text)
          self.contents.clear
          self.contents.font.color = normal_color
          self.contents.draw_text(4, 0, self.width - 40, 32, text)
        end
      end
      
    #-----------------------------------------------------------------------------------------
    # Finally the main thing!
    #-----------------------------------------------------------------------------------------
    class Window_ActorSpp < Window_Base
      
      def initialize(actor,x,y,width,height)
        super(x, y, width, height)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.contents.font.name = $fontface
        self.contents.font.size = $fontsize
        @actor = $ACTORD
        refresh
      end
      
    def refresh
          self.contents.clear
        draw_actor_battler($ACTORD, 220, 200)
        draw_actor_name($ACTORD, 150, 210)
        draw_actor_level($ACTORD, 150, 230)
        drawSPaddparam($ACTORD,150,250,0,0)
        drawSPaddparam($ACTORD,150,270,1,0)
        drawSPaddparam($ACTORD,150,290,2,0)
        drawSPaddparam($ACTORD,150,310,3,0)
        drawSPaddparam($ACTORD,150,330,4,0)
        drawSPaddparam($ACTORD,150,350,5,0)
        drawSPADD(150,400)
      end
    end
    
    class Scene_Spend
    
      
      def main
      @sprite = Spriteset_Map.new
        actsr = $ACTORD
      @kill_it = 0
      @clerSP = 1
        @help_text = Window_NewHelp.new("Choose attribute:",0,0)
        @help_text.x = 0
        @help_text.y = 0
        @help_text.width = 200
        @help_text.z = 99999999
        @help_text.height = 64
        @help_text.opacity = 160
        @acSpend = Window_ActorSpp.new(actsr,200,0,440,480)
    @acSpend.opacity = 160
        @acSpend.z = 999999
        $getokay = 1
        @acSpend.refresh
        s1 = $data_system.words.hp
        s2 = $data_system.words.sp
        s3 = $data_system.words.str
        s4 = $data_system.words.dex
        s5 = $data_system.words.agi
        s6 = $data_system.words.int
        s7 = "OK"
        s8 = "Clear All"
        @AttrSel = Window_Command.new(200, [s1, s2,s3,s4,s5,s6,s7,s8])
        @AttrSel.y = 64
        @AttrSel.height = 416
        @AttrSel.z = 999999
        @AttrSel.opacity = 160
        Graphics.transition
        @clerSP = 1
        
        
    loop do
          Graphics.update
          Input.update
          @acSpend.refresh
          updateATTRSEL
          if @kill_it != 0
            break
          end
        end
    Graphics.freeze
    @AttrSel.dispose
    @acSpend.dispose
    @help_text.dispose
    @sprite.dispose
    Graphics.transition
    $acstadd.ADD_IT
    $scene = Scene_Map.new
    
    actsr  = $ACTORIND
    case actsr
    when 0
      if $actor1gotlv != 0
        $actor1gotlv = 0
      end
    when 1
      if $actor2gotlv != 0
        $actor2gotlv = 0
      end
    when 2
        if $actor3gotlv != 0
        $actor3gotlv = 0
      end
    when 3
        if $actor4gotlv != 0
        $actor4gotlv = 0
      end
    end
    end
    
      
    def updateATTRSEL
        @AttrSel.update
        
        csa = $ACTORIND
        if @clerSP != 0
          @clerSP = 0
    case csa
    when 0
          $SPLRET = $SPLCH1.to_i
    when 1
          $SPLRET = $SPLCH2.to_i
    when 2
          $SPLRET = $SPLCH3.to_i
    when 3
          $SPLRET = $SPLCH4.to_i
        end
        end
        
        
    if Input.repeat?(Input::C)
      case @AttrSel.index
      when 0
        acselt = $ACTORIND
     case acselt
    when 0
        unless $SPLCH1 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $hpadd = $hpadd + $HPBY
        @acSpend.refresh
        @ackill = $SPLCH1
        @ackill -= 1
        $SPLCH1 = @ackill
                unless $SPLCH1 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
        
    when 1
        unless $SPLCH2 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        
        $hpadd = $hpadd + $HPBY
        @acSpend.refresh
            @ackill = $SPLCH2
        @ackill -= 1
        $SPLCH2 = @ackill
        
                unless $SPLCH2 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 2
        unless $SPLCH3 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $hpadd = $hpadd + $HPBY
        @acSpend.refresh
            @ackill = $SPLCH3
        @ackill -= 1
        $SPLCH3 = @ackill
                unless $SPLCH3 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 3
        unless $SPLCH4 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
          $hpadd = $hpadd + $HPBY
        @acSpend.refresh
            @ackill = $SPLCH4
        @ackill -= 1
        $SPLCH4 = @ackill
                unless $SPLCH4 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    end
        
      when 1
    
        
        acselt = $ACTORIND
    case acselt
    when 0
        unless $SPLCH1 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $spadd = $spadd + $SPBY
        @acSpend.refresh
        @ackill = $SPLCH1
        @ackill -= 1
        $SPLCH1 = @ackill
                unless $SPLCH1 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 1
        unless $SPLCH2 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        
        $spadd = $spadd + $SPBY
        @acSpend.refresh
            @ackill = $SPLCH2
        @ackill -= 1
        $SPLCH2 = @ackill
        
                unless $SPLCH2 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 2
        unless $SPLCH3 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $spadd = $spadd + $SPBY
        @acSpend.refresh
            @ackill = $SPLCH3
        @ackill -= 1
        $SPLCH3 = @ackill
                unless $SPLCH3 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 3
        unless $SPLCH4 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $spadd = $spadd + $SPBY
        @acSpend.refresh
            @ackill = $SPLCH4
        @ackill -= 1
        $SPLCH4 = @ackill
                unless $SPLCH4 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
      end
        
      when 2 
    
        
        acselt = $ACTORIND
    case acselt
    when 0
        unless $SPLCH1 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $Stradd = $Stradd + $STRBY
        @acSpend.refresh
        @ackill = $SPLCH1
        @ackill -= 1
        $SPLCH1 = @ackill
                unless $SPLCH1 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 1
        unless $SPLCH2 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        
        $Stradd = $Stradd + $STRBY
        @acSpend.refresh
            @ackill = $SPLCH2
        @ackill -= 1
        $SPLCH2 = @ackill
        
                unless $SPLCH2 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 2
        unless $SPLCH3 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $Stradd = $Stradd + $STRBY
        @acSpend.refresh
            @ackill = $SPLCH3
        @ackill -= 1
        $SPLCH3 = @ackill
                unless $SPLCH3 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 3
        unless $SPLCH4 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $Stradd = $Stradd + $STRBY
        @acSpend.refresh
            @ackill = $SPLCH4
        @ackill -= 1
        $SPLCH4 = @ackill
                unless $SPLCH4 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
      end
      
      when 3
        
    
        
       acselt = $ACTORIND
     case acselt
    when 0
        unless $SPLCH1 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $dexadd = $dexadd + $DEXBY
        @acSpend.refresh
        @ackill = $SPLCH1
        @ackill -= 1
        $SPLCH1 = @ackill
                unless $SPLCH1 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 1
        unless $SPLCH2 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        
        $dexadd = $dexadd + $DEXBY
        @acSpend.refresh
            @ackill = $SPLCH2
        @ackill -= 1
        $SPLCH2 = @ackill
        
                unless $SPLCH2 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 2
        unless $SPLCH3 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $dexadd = $dexadd + $DEXBY
        @acSpend.refresh
            @ackill = $SPLCH3
        @ackill -= 1
        $SPLCH3 = @ackill
                unless $SPLCH3 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 3
        unless $SPLCH4 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $dexadd = $dexadd + $DEXBY
        @acSpend.refresh
            @ackill = $SPLCH4
        @ackill -= 1
        $SPLCH4 = @ackill
                unless $SPLCH4 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
          end
          
      when 4
    
       
       acselt = $ACTORIND
    case acselt
    when 0
        unless $SPLCH1 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $agiadd = $agiadd + $AGIBY
        @acSpend.refresh
        @ackill = $SPLCH1
        @ackill -= 1
        $SPLCH1 = @ackill
                unless $SPLCH1 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 1
        unless $SPLCH2 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        
        $agiadd = $agiadd + $AGIBY
        @acSpend.refresh
            @ackill = $SPLCH2
        @ackill -= 1
        $SPLCH2 = @ackill
        
                unless $SPLCH2 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 2
        unless $SPLCH3 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
        $agiadd = $agiadd + $AGIBY
        @acSpend.refresh
            @ackill = $SPLCH3
        @ackill -= 1
        $SPLCH3 = @ackill
                unless $SPLCH3 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 3
        unless $SPLCH4 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $agiadd = $agiadd + $AGIBY
        @acSpend.refresh
            @ackill = $SPLCH4
        @ackill -= 1
        $SPLCH4 = @ackill
                unless $SPLCH4 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
          end
          
      when 5
     
       acselt = $ACTORIND
    case acselt
    when 0
        unless $SPLCH1 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
       $intadd = $intadd + $INTBY
        @acSpend.refresh
        @ackill = $SPLCH1
        @ackill -= 1
        $SPLCH1 = @ackill
                unless $SPLCH1 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 1
        unless $SPLCH2 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        
       $intadd = $intadd + $INTBY
        @acSpend.refresh
            @ackill = $SPLCH2
        @ackill -= 1
        $SPLCH2 = @ackill
        
                unless $SPLCH2 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 2
        unless $SPLCH3 > 0
          $game_system.se_play($data_system.buzzer_se)
          @AttrSel.disable_item(0)
          return
        end
       $intadd = $intadd + $INTBY
        @acSpend.refresh
            @ackill = $SPLCH3
        @ackill -= 1
        $SPLCH3 = @ackill
                unless $SPLCH3 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
    when 3
        unless $SPLCH4 > 0
          $game_system.se_play($data_system.buzzer_se)
          return
        end
       $intadd = $intadd + $INTBY
        @acSpend.refresh
            @ackill = $SPLCH4
        @ackill -= 1
        $SPLCH4 = @ackill
                unless $SPLCH4 > 0
          @AttrSel.disable_item(0)
          @AttrSel.disable_item(1)
          @AttrSel.disable_item(2)
          @AttrSel.disable_item(3)
          @AttrSel.disable_item(4)
          @AttrSel.disable_item(5)
          return
        end
          end
          
      when 6
    @kill_it = 1
      when 7
        clear
      end
    end
    end
    end
    
    
    def clear
        $getokay = 1
        @acSpend.refresh
          @AttrSel.enable_item(0)
          @AttrSel.enable_item(1)
          @AttrSel.enable_item(2)
          @AttrSel.enable_item(3)
          @AttrSel.enable_item(4)
          @AttrSel.enable_item(5)
    amp = $ACTORIND
    case amp
    when 0
    $SPLCH1 = $SPLRET
    when 1
    $SPLCH2 = $SPLRET
    when 2
    $SPLCH3 = $SPLRET
    when 3
    $SPLCH4 = $SPLRET
    return
    end
    end
    
    class Window_Command < Window_Selectable
      
        def enable_item(index)
        draw_item(index, normal_color)
      end
    end
    
    #THIS IS ALL!!
    
    #--------------------------------------------------------------------------------------------
    # End of the Script!
    # made by Drago del Fato!
    # Last two words : SCREW FLANDERS!
    #--------------------------------------------------------------------------------------------
    
     
  16. NhắngNhít

    NhắngNhít Youtube Master Race

    Tham gia ngày:
    5/7/06
    Bài viết:
    85
  17. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Hèm đề nghị Mod chuyển dùm cái Script và cái Screenshot này qua cái "Hướng dẫn Script..." ấy để cho nó có trật tự
    @Nhắng Nhít :Ông ơi tui Up biết bao nhiêu bài còn chưa được giảm warn huống chi là ông ,thui cố gắng làm việc đi rồi cũng có ngày warn không cánh mà bay à !!
     
  18. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Tui nhớ có một lần có ông nào hỏi tui cách làm 1 Skill giống như Lion Heart phải không .Sau khi ngồi mấy ngày lục lại trong kho Script của mình tui tình cờ tìm lại được cái này .Đó chính là hiển thị Damage mỗi lượt ra đòn tất nhiên mình phải chỉnh chứ .

    Đây là Demo mà có cả 2 loại cần và không cần SDK (Standard Devolopment Kit)
     

    Các file đính kèm:

  19. yeuthatlong_9779

    yeuthatlong_9779 Youtube Master Race

    Tham gia ngày:
    22/7/06
    Bài viết:
    23
    Nơi ở:
    Thành phố Vũ hội
    Em dùng 2 script này,phải không anh Dương?
    RTAB
    Mã:
    # ƒŠƒAƒ‹ƒ^ƒCƒ€EƒAƒNƒeƒBƒuƒoƒgƒ‹(RTAB) Ver 1.07
    # ”z•zŒ³EƒTƒ|[ƒgURL
    # http://members.jcom.home.ne.jp/cogwheel/
    
    class Scene_Battle
      #--------------------------------------------------------------------------
      # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
      #--------------------------------------------------------------------------
      attr_reader   :status_window            # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE
      attr_reader   :spriteset                # ƒoƒgƒ‹ƒXƒvƒ‰ƒCƒg
      attr_reader   :scroll_time              # ƒXƒNƒŠ[ƒ“ˆÚ“®Šî–{ŽžŠÔ
      attr_reader   :zoom_rate                # “Gƒoƒgƒ‰[Šî–{ˆÊ’u
      attr_reader   :drive                    # ƒJƒƒ‰‹ì“®
      attr_accessor :force                    # ƒAƒNƒVƒ‡ƒ“‹­§“x
      attr_accessor :camera                   # Œ»Ý‚̃Jƒƒ‰ŠŽŽÒ
      #--------------------------------------------------------------------------
      # œ ATBŠî‘bƒZƒbƒgƒAƒbƒv
      #--------------------------------------------------------------------------
      def atb_setup
        # ATB‰Šú‰»
        # speed   : ƒoƒgƒ‹ƒXƒs[ƒhŒˆ’èB’l‚ª¬‚³‚¢‚Ù‚Ç‘‚¢
        # @active : ƒAƒNƒeƒBƒu“xÝ’è
        #           3 : í‚ɃAƒNƒeƒBƒuó‘Ô
        #           2 : ƒXƒLƒ‹EƒAƒCƒeƒ€‘I‘𒆂̂݃AƒNƒeƒBƒuƒQ[ƒW‚ªŽ~‚Ü‚é
        #           1 : 2‚̏ó‘ԂɉÁ‚¦Aƒ^[ƒQƒbƒg‘I‘ðŽž‚àƒEƒFƒCƒg‚ªŠ|‚©‚é
        #           0 : 1‚̏ó‘ԂɉÁ‚¦AƒRƒ}ƒ“ƒh“ü—ÍŽž‚É‚àƒEƒFƒCƒg‚ªŠ|‚©‚é
        # @action : ‘¼l‚ªs“®’†‚ÉŽ©•ª‚às“®‚ð‹N‚±‚·‚±‚Æ‚ð‹–‚·‚©
        #           3 : Ž©•ª‚ªs“®•s”\‚Å‚È‚¢ŒÀ‚èŒÀ‚è‹–‚·
        #           2 : Ž©•ª‚ªƒ_ƒ[ƒW‚ðŽó‚¯‚Ä‚¢‚È‚¢ŒÀ‚è‹–‚·
        #           1 : 2‚̏ó‘ԂɉÁ‚¦Aƒ^[ƒQƒbƒg‚ªs“®‚µ‚Ä‚¢‚È‚¢ŒÀ‚è‹–‚·
        #           0 : s“®‚ð‹–‚³‚È‚¢B‡”Ԃɍs“®‚µI‚¦‚é‚Ü‚Å‘Ò‚Â
        # @anime_wait : true‚É‚·‚é‚ƃoƒgƒ‹ƒAƒjƒEƒ_ƒ[ƒW•\Ž¦’†‚̓EƒFƒCƒg‚ªŠ|‚©‚é
        # @damage_wait : ƒ_ƒ[ƒW•\Ž¦‘Ò‚¿ŽžŠÔi’PˆÊ‚̓tƒŒ[ƒ€j
        # @enemy_speed : “G‚ÌŽvl‘¬“xB1‚Ȃ瑦Žžs“®B
        #                1ƒtƒŒ[ƒ€–ˆ‚ɁA1/@enemy_speed‚ÌŠm—¦‚ōs“®‚ð‹N‚±‚·
        # @force : ‹­§ƒAƒNƒVƒ‡ƒ“‚ŃXƒLƒ‹Žg—pŽž‚Ì‹­§‹ï‡
        #          2:ƒXƒLƒ‹‚Í‘S‚ĉr¥‚¹‚¸A•K‚¸‘¦ŽžŽÀs
        #          1:’P“ƃXƒLƒ‹‚͉r¥‚µA˜AŒgƒXƒLƒ‹‚Ì‚Ý‘¦ŽžŽÀs
        #          0:‘SƒXƒLƒ‹‰r¥‚ðs‚¤‚¾‚¯
        # ($scene.force = x ‚Æ‚·‚邱‚Æ‚É‚æ‚èA’ʏíƒCƒxƒ“ƒg‚̃XƒNƒŠƒvƒg‚©‚ç•ÏX‰Â”\j
        # @drive : ƒJƒƒ‰‹ì“®ON/OFFBtrue‚Å‹ì“®ONAfalse‚Å‹ì“®OFF
        # @scroll_time : ƒXƒNƒŠ[ƒ“ˆÚ“®‚É—v‚·‚éŠî–{ŽžŠÔ
        # @zoom_rate = [i, j] : ƒGƒlƒ~[‚̃Y[ƒ€—¦
        #                       i ‚ª‰æ–ʍŏ㕔‚É”z’u‚µ‚½Žž‚ÌŠg‘å—¦
        #                       j ‚ª‰æ–ʍʼnº•”‚É”z’u‚µ‚½Žž‚ÌŠg‘å—¦
        #                       1 ”{‚Æ‚µ‚½‚¢‚Æ‚«‚àA1.0 ‚Æ•K‚¸¬”‚Őݒ肷‚邱‚Æ
        speed = 150
        @active = 1
        @action = 2
        @anime_wait = false
        @damage_wait = 10
        @enemy_speed = 40
        @force = 2
        @drive = true
        @scroll_time = 15
        @zoom_rate = [0.2, 1.0]
        @help_time = 40
        @escape == false
        @camera = nil
        @max = 0
        @turn_cnt = 0
        @help_wait = 0
        @action_battlers = []
        @synthe = []
        @spell_p = {}
        @spell_e = {}
        @command_a = false
        @command = []
        @party = false
        for battler in $game_party.actors + $game_troop.enemies
          spell_reset(battler)
          battler.at = battler.agi * rand(speed / 2)
          battler.damage_pop = {}
          battler.damage = {}
          battler.damage_sp = {}
          battler.critical = {}
          battler.recover_hp = {}
          battler.recover_sp = {}
          battler.state_p = {}
          battler.state_m = {}
          battler.animation = []
          if battler.is_a?(Game_Actor)
            @max += battler.agi
          end
        end
        @max *= speed
        @max /= $game_party.actors.size
        for battler in $game_party.actors + $game_troop.enemies
          battler.atp = 100 * battler.at / @max
        end
      end
      #--------------------------------------------------------------------------
      # œ ATƒQ[ƒWMaxŽžSE
      #--------------------------------------------------------------------------
      def fullat_se
        Audio.se_play("Audio/SE/033-switch02", 80, 100)
      end
      #--------------------------------------------------------------------------
      # œ ƒŒƒxƒ‹ƒAƒbƒvSE
      #--------------------------------------------------------------------------
      def levelup_se
        Audio.se_play("Audio/SE/056-Right02", 80, 100)
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹K“¾SE
      #--------------------------------------------------------------------------
      def skill_se
        Audio.se_play("Audio/SE/056-Right02", 80, 150)
      end
    end
    
    class Window_Base < Window
      #--------------------------------------------------------------------------
      # œ ATG ‚Ì•`‰æ
      #     actor : ƒAƒNƒ^[
      #     x     : •`‰ææ X À•W
      #     y     : •`‰ææ Y À•W
      #     width : •`‰ææ‚Ì•
      #--------------------------------------------------------------------------
      def draw_actor_atg(actor, x, y, width = 144)
        if @at_gauge == nil
          # plus_x:XÀ•W‚̈ʒu•â³ rate_x:XÀ•W‚̈ʒu•â³(%) plus_y:YÀ•W‚̈ʒu•â³
          # plus_width:•‚̕␳ rate_width:•‚̕␳(%) height:c•
          # align1:•`‰æƒ^ƒCƒv1 0:¶‹l‚ß 1:’†‰›‘µ‚¦ 2:‰E‹l‚ß
          # align2:•`‰æƒ^ƒCƒv2 0:ã‹l‚ß 1:’†‰›‘µ‚¦ 2:‰º‹l‚ß
          # align3:ƒQ[ƒWƒ^ƒCƒv 0:¶‹l‚ß 1:‰E‹l‚ß
          @plus_x = 0
          @rate_x = 0
          @plus_y = 16
          @plus_width = 0
          @rate_width = 100
          @width = @plus_width + width * @rate_width / 100
          @height = 16
          @align1 = 0
          @align2 = 1
          @align3 = 0
          # ƒOƒ‰ƒf[ƒVƒ‡ƒ“Ý’è grade1:‹óƒQ[ƒW grade2:ŽÀƒQ[ƒW
          # (0:‰¡‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“ 1:c‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf[ƒVƒ‡ƒ“j
          grade1 = 1
          grade2 = 0
          # FÝ’èBcolor1:ÅŠO˜gCcolor2:’†˜g
          # color3:‹ó˜gƒ_[ƒNƒJƒ‰[Ccolor4:‹ó˜gƒ‰ƒCƒgƒJƒ‰[
          color1 = Color.new(0, 0, 0)
          color2 = Color.new(255, 255, 192)
          color3 = Color.new(0, 0, 0, 192)
          color4 = Color.new(0, 0, 64, 192)
          # ƒQ[ƒW‚̐FÝ’è
          # ’ʏ펞‚̐FÝ’è
          color5 = Color.new(0, 64, 80)
          color6 = Color.new(0, 128, 160)
          # ƒQ[ƒW‚ªMAX‚ÌŽž‚̐FÝ’è
          color7 = Color.new(80, 0, 0)
          color8 = Color.new(240, 0, 0)
          # ˜AŒgƒXƒLƒ‹Žg—pŽž‚̐FÝ’è
          color9 = Color.new(80, 64, 32)
          color10 = Color.new(240, 192, 96)
          # ƒXƒLƒ‹‰r¥Žž‚̐FÝ’è
          color11 = Color.new(80, 0, 64)
          color12 = Color.new(240, 0, 192)
          # ƒQ[ƒW‚Ì•`‰æ
          gauge_rect_at(@width, @height, @align3, color1, color2,
                      color3, color4, color5, color6, color7, color8,
                      color9, color10, color11, color12, grade1, grade2)
        end
        # •Ï”at‚É•`‰æ‚·‚éƒQ[ƒW‚Ì•‚ð‘ã“ü
        if actor.rtp == 0
          at = (width + @plus_width) * actor.atp * @rate_width / 10000
        else
          at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
        end
        if at > width
          at = width
        end
        # ƒQ[ƒW‚̍¶‹lE’†‰›\‚¦“™‚̕␳
        case @align1
        when 1
          x += (@rect_width - width) / 2
        when 2
          x += @rect_width - width
        end
        case @align2
        when 1
          y -= @height / 2
        when 2
          y -= @height
        end
        self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
                          @at_gauge, Rect.new(0, 0, @width, @height))
        if @align3 == 0
          rect_x = 0
        else
          x += @width - at - 1
          rect_x = @width - at - 1
        end
        # ƒQ[ƒW‚̐FÝ’è
        if at == width
            # MAXŽž‚̃Q[ƒW•`‰æ
          self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                            @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
        else
          if actor.rtp == 0
            # ’ʏ펞‚̃Q[ƒW•`‰æ
            self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                              @at_gauge, Rect.new(rect_x, @height, at, @height))
          else
            if actor.spell == true
              # ˜AŒgƒXƒLƒ‹Žg—pŽž‚̃Q[ƒW•`‰æ
              self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                            @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
            else
              # ƒXƒLƒ‹‰r¥Žž‚̃Q[ƒW•`‰æ
              self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
                            @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
            end
          end
        end
      end
    end
    
    #==============================================================================
    # ¡ Scene_Battle (•ªŠ„’è‹` 1)
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
    #==============================================================================
    
    class Scene_Battle
      #--------------------------------------------------------------------------
      # œ ƒƒCƒ“ˆ—
      #--------------------------------------------------------------------------
      def main
        # í“¬—p‚ÌŠeŽíˆêŽžƒf[ƒ^‚ð‰Šú‰»
        $game_temp.in_battle = true
        $game_temp.battle_turn = 0
        $game_temp.battle_event_flags.clear
        $game_temp.battle_abort = false
        $game_temp.battle_main_phase = false
        $game_temp.battleback_name = $game_map.battleback_name
        $game_temp.forcing_battler = nil
        # ƒoƒgƒ‹ƒCƒxƒ“ƒg—pƒCƒ“ƒ^ƒvƒŠƒ^‚ð‰Šú‰»
        $game_system.battle_interpreter.setup(nil, 0)
        # ƒgƒ‹[ƒv‚ð€”õ
        @troop_id = $game_temp.battle_troop_id
        $game_troop.setup(@troop_id)
        atb_setup
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ðì¬
        s1 = $data_system.words.attack
        s2 = $data_system.words.skill
        s3 = $data_system.words.guard
        s4 = $data_system.words.item
        @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
        @actor_command_window.y = 160
        @actor_command_window.back_opacity = 160
        @actor_command_window.active = false
        @actor_command_window.visible = false
        # ‚»‚Ì‘¼‚̃EƒBƒ“ƒhƒE‚ðì¬
        @party_command_window = Window_PartyCommand.new
        @help_window = Window_Help.new
        @help_window.back_opacity = 160
        @help_window.visible = false
        @status_window = Window_BattleStatus.new
        @message_window = Window_Message.new
        # ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚ðì¬
        @spriteset = Spriteset_Battle.new
        # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ð‰Šú‰»
        @wait_count = 0
        # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ŽÀs
        if $data_system.battle_transition == ""
          Graphics.transition(20)
        else
          Graphics.transition(40, "Graphics/Transitions/" +
            $data_system.battle_transition)
        end
        # ƒvƒŒƒoƒgƒ‹ƒtƒF[ƒYŠJŽn
        start_phase1
        # ƒƒCƒ“ƒ‹[ƒv
        loop do
          # ƒQ[ƒ€‰æ–Ê‚ðXV
          Graphics.update
          # “ü—͏î•ñ‚ðXV
          Input.update
          # ƒtƒŒ[ƒ€XV
          update
          # ‰æ–Ê‚ªØ‚è‘Ö‚í‚Á‚½‚烋[ƒv‚ð’†’f
          if $scene != self
            break
          end
        end
        # ƒ}ƒbƒv‚ðƒŠƒtƒŒƒbƒVƒ…
        $game_map.refresh
        # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“€”õ
        Graphics.freeze
        # ƒEƒBƒ“ƒhƒE‚ð‰ð•ú
        @actor_command_window.dispose
        @party_command_window.dispose
        @help_window.dispose
        @status_window.dispose
        @message_window.dispose
        if @skill_window != nil
          @skill_window.dispose
        end
        if @item_window != nil
          @item_window.dispose
        end
        if @result_window != nil
          @result_window.dispose
        end
        # ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚ð‰ð•ú
        @spriteset.dispose
        # ƒ^ƒCƒgƒ‹‰æ–ʂɐ؂è‘Ö‚¦’†‚̏ꍇ
        if $scene.is_a?(Scene_Title)
          # ‰æ–Ê‚ðƒtƒF[ƒhƒAƒEƒg
          Graphics.transition
          Graphics.freeze
        end
        # í“¬ƒeƒXƒg‚©‚çƒQ[ƒ€ƒI[ƒo[‰æ–ʈȊO‚ɐ؂è‘Ö‚¦’†‚̏ꍇ
        if $BTEST and not $scene.is_a?(Scene_Gameover)
          $scene = nil
        end
      end
      #--------------------------------------------------------------------------
      # œ Ÿ”s”»’è
      #--------------------------------------------------------------------------
      def judge
        # ‘S–Å”»’肪^A‚Ü‚½‚̓p[ƒeƒBl”‚ª 0 l‚̏ꍇ
        if $game_party.all_dead? or $game_party.actors.size == 0
          # ”s–k‰Â”\‚̏ꍇ
          if $game_temp.battle_can_lose
            # ƒoƒgƒ‹ŠJŽn‘O‚Ì BGM ‚É–ß‚·
            $game_system.bgm_play($game_temp.map_bgm)
            # ƒoƒgƒ‹I—¹
            battle_end(2)
            # true ‚ð•Ô‚·
            return true
          end
          # ƒQ[ƒ€ƒI[ƒo[ƒtƒ‰ƒO‚ðƒZƒbƒg
          $game_temp.gameover = true
          # true ‚ð•Ô‚·
          return true
        end
        # ƒGƒlƒ~[‚ª 1 ‘Ì‚Å‚à‘¶Ý‚·‚ê‚Î false ‚ð•Ô‚·
        for enemy in $game_troop.enemies
          if enemy.exist?
            return false
          end
        end
        # ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒYŠJŽn (Ÿ—˜)
        start_phase5
        # true ‚ð•Ô‚·
        return true
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV
      #--------------------------------------------------------------------------
      def update
        # ƒoƒgƒ‹ƒCƒxƒ“ƒgŽÀs’†‚̏ꍇ
        if $game_system.battle_interpreter.running?
          if @command.size > 0
            @command_a = false
            @command = []
            command_delete
          end
          @status_window.at_refresh
          # ƒCƒ“ƒ^ƒvƒŠƒ^‚ðXV
          $game_system.battle_interpreter.update
          # ƒAƒNƒVƒ‡ƒ“‚ð‹­§‚³‚ê‚Ä‚¢‚éƒoƒgƒ‰[‚ª‘¶Ý‚µ‚È‚¢ê‡
          if $game_temp.forcing_battler == nil
            # ƒoƒgƒ‹ƒCƒxƒ“ƒg‚ÌŽÀs‚ªI‚í‚Á‚½ê‡
            unless $game_system.battle_interpreter.running?
              # ƒoƒgƒ‹ƒCƒxƒ“ƒg‚̃ZƒbƒgƒAƒbƒv‚ðÄŽÀs
              @status_window.refresh
              setup_battle_event
            end
          end
        end
        # ƒVƒXƒeƒ€ (ƒ^ƒCƒ}[)A‰æ–Ê‚ðXV
        $game_system.update
        $game_screen.update
        # ƒ^ƒCƒ}[‚ª 0 ‚É‚È‚Á‚½ê‡
        if $game_system.timer_working and $game_system.timer == 0
          # ƒoƒgƒ‹’†’f
          $game_temp.battle_abort = true
        end
        # ƒEƒBƒ“ƒhƒE‚ðXV
        @help_window.update
        @party_command_window.update
        @actor_command_window.update
        @status_window.update
        @message_window.update
        # ƒXƒvƒ‰ƒCƒgƒZƒbƒg‚ðXV
        @spriteset.update
        # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ˆ—’†‚̏ꍇ
        if $game_temp.transition_processing
          # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ˆ—’†ƒtƒ‰ƒO‚ðƒNƒŠƒA
          $game_temp.transition_processing = false
          # ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“ŽÀs
          if $game_temp.transition_name == ""
            Graphics.transition(20)
          else
            Graphics.transition(40, "Graphics/Transitions/" +
              $game_temp.transition_name)
          end
        end
        # ƒƒbƒZ[ƒWƒEƒBƒ“ƒhƒE•\Ž¦’†‚̏ꍇ
        if $game_temp.message_window_showing
          return
        end
        # ƒQ[ƒ€ƒI[ƒo[‚̏ꍇ
        if $game_temp.gameover
          # ƒQ[ƒ€ƒI[ƒo[‰æ–ʂɐ؂è‘Ö‚¦
          $scene = Scene_Gameover.new
          return
        end
        # ƒ^ƒCƒgƒ‹‰æ–Ê‚É–ß‚·ê‡
        if $game_temp.to_title
          # ƒ^ƒCƒgƒ‹‰æ–ʂɐ؂è‘Ö‚¦
          $scene = Scene_Title.new
          return
        end
        # ƒoƒgƒ‹’†’f‚̏ꍇ
        if $game_temp.battle_abort
          # ƒoƒgƒ‹ŠJŽn‘O‚Ì BGM ‚É–ß‚·
          $game_system.bgm_play($game_temp.map_bgm)
          # ƒoƒgƒ‹I—¹
          battle_end(1)
          return
        end
        # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE•\Ž¦’†‚̏ꍇ
        if @help_wait > 0
          @help_wait -= 1
          if @help_wait == 0
            # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ð‰B‚·
            @help_window.visible = false
          end
        end
        # ƒtƒF[ƒY‚É‚æ‚Á‚Ä•ªŠò
        case @phase
        when 0  # ATƒQ[ƒWXVƒtƒF[ƒY
          if anime_wait_return
            update_phase0
          end
        when 1  # ƒvƒŒƒoƒgƒ‹ƒtƒF[ƒY
          update_phase1
          return
        when 2  # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY
          update_phase2
          return
        when 5  # ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒY
          update_phase5
          return
        end
        if $scene != self
          return
        end
        if @phase == 0
          if @command.size != 0  # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY
            if @command_a == false
              start_phase3
            end
            update_phase3
          end
          # ƒEƒFƒCƒg’†‚̏ꍇ
          if @wait_count > 0
            # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðŒ¸‚ç‚·
            @wait_count -= 1
            return
          end
          update_phase4
        end
      end
    
    #==============================================================================
    # ¡ Scene_Battle (•ªŠ„’è‹` 2)
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
    #==============================================================================
    
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ATƒQ[ƒWXVƒtƒF[ƒY)
      #--------------------------------------------------------------------------
      def update_phase0
        if $game_temp.battle_turn == 0
          $game_temp.battle_turn = 1
        end
        # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if @command_a == false and @party == false
          if Input.trigger?(Input::B)
            # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
            $game_system.se_play($data_system.cancel_se)
            @party = true
          end
        end
        if @party == true and
            ((@action > 0 and @action_battlers.empty?) or (@action == 0 and 
            (@action_battlers.empty? or @action_battlers[0].phase == 1)))
          # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY‚Ö
          start_phase2
          return
        end
        # ATƒQ[ƒW‘‰Áˆ—
        cnt = 0
        for battler in $game_party.actors + $game_troop.enemies
          active?(battler)
          if battler.rtp == 0
            if battler.at >= @max
              if battler.is_a?(Game_Actor)
                if battler.inputable?
                  unless @action_battlers.include?(battler) or
                      @command.include?(battler) or @escape == true
                    if battler.current_action.forcing
                      fullat_se
                      force_action(battler)
                      action_start(battler)
                    else
                      fullat_se
                      @command.push(battler)
                    end
                  end
                else
                  unless @action_battlers.include?(battler) or
                          battler == @command[0]
                    battler.current_action.clear
                    if @command.include?(battler)
                      @command.delete(battler)
                    else
                      if battler.movable?
                        fullat_se
                      end
                    end
                    action_start(battler)
                  end
                end
              else
                unless @action_battlers.include?(battler)
                  if battler.current_action.forcing
                    force_action(battler)
                    action_start(battler)
                  else
                    if @enemy_speed != 0
                      if rand(@enemy_speed) == 0
                        number = cnt - $game_party.actors.size
                        enemy_action(number)
                      end
                    else
                      number = cnt - $game_party.actors.size
                      enemy_action(number)
                    end
                  end
                end
              end
            else
              battler.at += battler.agi
              if battler.guarding?
                battler.at += battler.agi
              end
              if battler.movable?
                battler.atp = 100 * battler.at / @max
              end
            end
          else
            if battler.rt >= battler.rtp
              speller = synthe?(battler)
              if speller != nil
                battler = speller[0]
              end
              unless @action_battlers.include?(battler)
                if battler.is_a?(Game_Actor)
                  fullat_se
                end
                battler.rt = battler.rtp
                action_start(battler)
              end
            else
              battler.rt += battler.agi
              speller = synthe?(battler)
              if speller != nil
                for spell in speller
                  if spell != battler
                    spell.rt += battler.agi
                  end
                end
              end
            end
          end
          cnt += 1
        end
        # ATƒQ[ƒW‚ðƒŠƒtƒŒƒbƒVƒ…
        @status_window.at_refresh
        # “¦‘–ˆ—
        if @escape == true and
            ((@action > 0 and @action_battlers.empty?) or (@action == 0 and 
            (@action_battlers.empty? or @action_battlers[0].phase == 1)))
          temp = false
          for battler in $game_party.actors
            if battler.inputable?
              temp = true
            end
          end
          if temp == true
            for battler in $game_party.actors
              if battler.at < @max and battler.inputable?
                temp = false
                break
              end
            end
            if temp == true
              @escape = false
              for battler in $game_party.actors
                battler.at %= @max
              end
              $game_temp.battle_main_phase = false
              update_phase2_escape
            end
          end
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒYŠJŽn
      #--------------------------------------------------------------------------
      def start_phase2
        # ƒtƒF[ƒY 2 ‚Ɉڍs
        @phase = 2
        @party = false
        # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ð—LŒø‰»
        @party_command_window.active = true
        @party_command_window.visible = true
        # ƒAƒNƒ^[‚ð”ñ‘I‘ðó‘Ԃɐݒè
        @actor_index = -1
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @actor_command_window.active = false
        @actor_command_window.visible = false
        if @command.size != 0
          # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
          if @active_actor != nil
            @active_actor.blink = false
          end
        end
        # ƒJƒƒ‰ƒZƒbƒg
        @camera == "party"
        @spriteset.screen_target(0, 0, 1)
        # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒNƒŠƒA
        $game_temp.battle_main_phase = false
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY)
      #--------------------------------------------------------------------------
      def update_phase2
        # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::C)
          # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̃J[ƒ\ƒ‹ˆÊ’u‚Å•ªŠò
          case @party_command_window.index
          when 0  # í‚¤
            # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
            @party_command_window.active = false
            @party_command_window.visible = false
            # Œˆ’è SE ‚ð‰‰‘t
            $game_system.se_play($data_system.decision_se)
            @escape = false
            @phase = 0
            if $game_temp.battle_turn == 0
              $game_temp.battle_turn = 1
            end
            if @command_a == true
              # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒYŠJŽn
              start_phase3
            else
              $game_temp.battle_main_phase = true
            end
          when 1  # “¦‚°‚é
            # “¦‘–‰Â”\‚Å‚Í‚È‚¢ê‡
            if $game_temp.battle_can_escape == false
              # ƒuƒU[ SE ‚ð‰‰‘t
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Œˆ’è SE ‚ð‰‰‘t
            $game_system.se_play($data_system.decision_se)
            @phase = 0
            # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
            @party_command_window.active = false
            @party_command_window.visible = false
            $game_temp.battle_main_phase = true
            if $game_temp.battle_turn == 0
              update_phase2_escape
              $game_temp.battle_turn = 1
              for battler in $game_party.actors
                battler.at -= @max / 2
              end
              return
            end
            # Œˆ’è SE ‚ð‰‰‘t
            $game_system.se_play($data_system.decision_se)
            @escape = true
            for battler in $game_party.actors
              @command_a = false
              @command.delete(battler)
              @action_battlers.delete(battler)
              skill_reset(battler)
            end
          end
          return
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒYŠJŽn
      #--------------------------------------------------------------------------
      def start_phase5
        # ƒtƒF[ƒY 5 ‚Ɉڍs
        @phase = 5
        # ƒoƒgƒ‹I—¹ ME ‚ð‰‰‘t
        $game_system.me_play($game_system.battle_end_me)
        # ƒoƒgƒ‹ŠJŽn‘O‚Ì BGM ‚É–ß‚·
        $game_system.bgm_play($game_temp.map_bgm)
        # EXPAƒS[ƒ‹ƒhAƒgƒŒƒWƒƒ[‚ð‰Šú‰»
        exp = 0
        gold = 0
        treasures = []
        if @active_actor != nil
          @active_actor.blink = false
        end
        # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
        $game_temp.battle_main_phase = true
        # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @party_command_window.active = false
        @party_command_window.visible = false
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @actor_command_window.active = false
        @actor_command_window.visible = false
        if @skill_window != nil
          # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ð‰ð•ú
          @skill_window.dispose
          @skill_window = nil
        end
        if @item_window != nil
          # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ð‰ð•ú
          @item_window.dispose
          @item_window = nil
        end
        # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ð‰B‚·
        @help_window.visible = false
        # ƒ‹[ƒv
        for enemy in $game_troop.enemies
          # ƒGƒlƒ~[‚ª‰B‚êó‘Ô‚Å‚È‚¢ê‡
          unless enemy.hidden
            # Šl“¾ EXPAƒS[ƒ‹ƒh‚ð’ljÁ
            exp += enemy.exp
            gold += enemy.gold
            # ƒgƒŒƒWƒƒ[oŒ»”»’è
            if rand(100) < enemy.treasure_prob
              if enemy.item_id > 0
                treasures.push($data_items[enemy.item_id])
              end
              if enemy.weapon_id > 0
                treasures.push($data_weapons[enemy.weapon_id])
              end
              if enemy.armor_id > 0
                treasures.push($data_armors[enemy.armor_id])
              end
            end
          end
        end
        # ƒgƒŒƒWƒƒ[‚̐”‚ð 6 ŒÂ‚Ü‚Å‚ÉŒÀ’è
        treasures = treasures[0..5]
        # EXP Šl“¾
        for i in 0...$game_party.actors.size
          actor = $game_party.actors[i]
          if actor.cant_get_exp? == false
            last_level = actor.level
            actor.exp += exp
            if actor.level > last_level
              @status_window.level_up(i)
              actor.damage[[actor, -1]] = "Level up!"
              actor.up_level = actor.level - last_level
            end
          end
        end
        # ƒS[ƒ‹ƒhŠl“¾
        $game_party.gain_gold(gold)
        # ƒgƒŒƒWƒƒ[Šl“¾
        for item in treasures
          case item
          when RPG::Item
            $game_party.gain_item(item.id, 1)
          when RPG::Weapon
            $game_party.gain_weapon(item.id, 1)
          when RPG::Armor
            $game_party.gain_armor(item.id, 1)
          end
        end
        # ƒoƒgƒ‹ƒŠƒUƒ‹ƒgƒEƒBƒ“ƒhƒE‚ðì¬
        @result_window = Window_BattleResult.new(exp, gold, treasures)
        # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðÝ’è
        @phase5_wait_count = 100
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒY)
      #--------------------------------------------------------------------------
      def update_phase5
        # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ª 0 ‚æ‚è‘å‚«‚¢ê‡
        if @phase5_wait_count > 0
          # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðŒ¸‚ç‚·
          @phase5_wait_count -= 1
          # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ª 0 ‚É‚È‚Á‚½ê‡
          if @phase5_wait_count == 0
            # ƒŠƒUƒ‹ƒgƒEƒBƒ“ƒhƒE‚ð•\Ž¦
            @result_window.visible = true
            # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒNƒŠƒA
            $game_temp.battle_main_phase = false
            # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
            @status_window.refresh
            for actor in $game_party.actors
              if actor.damage.include?([actor, 0])
                @phase5_wait_count = 20
                actor.damage_pop[[actor, 0]] = true
              end
              if actor.damage.include?([actor, -1])
                @phase5_wait_count = 20
                actor.damage_pop[[actor, -1]] = true
                for level in actor.level - actor.up_level + 1..actor.level
                  for skill in $data_classes[actor.class_id].learnings
                    if level == skill.level and not actor.skill_learn?(skill.id)
                      actor.damage[[actor, 0]] = "New Skill!"
                      break
                    end
                  end
                end
              end
            end
          end
          return
        end
        # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::C)
          # ƒoƒgƒ‹I—¹
          battle_end(0)
        end
      end
    
    #==============================================================================
    # ¡ Scene_Battle (•ªŠ„’è‹` 3)
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
    #==============================================================================
    
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒYŠJŽn
      #--------------------------------------------------------------------------
      def start_phase3
        # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒNƒŠƒA
        $game_temp.battle_main_phase = false
        @command_a = true
        @active_actor = @command[0]
        cnt = 0
        for actor in $game_party.actors
          if actor == @active_actor
            @actor_index = cnt
          end
          cnt += 1
        end
        @active_actor.blink = true
        unless @active_actor.inputable?
          @active_actor.current_action.clear
          phase3_next_actor
          return
        end
        phase3_setup_command_window
        # ƒJƒƒ‰‚̐ݒè
        @camera = "command"
        plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
        y = [(plus.abs - 1.5) * 10 , 0].min
        @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—͏I—¹
      #--------------------------------------------------------------------------
      def phase3_next_actor
        @command.shift
        @command_a = false
        # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
        $game_temp.battle_main_phase = true
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @actor_command_window.active = false
        @actor_command_window.visible = false
        # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
        if @active_actor != nil
          @active_actor.blink = false
        end
        action_start(@active_actor)
        # ƒJƒƒ‰‚ðŒ³‚É–ß‚·
        if @camera == "command"
          @spriteset.screen_target(0, 0, 1)
        end
        return
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̃ZƒbƒgƒAƒbƒv
      #--------------------------------------------------------------------------
      def phase3_setup_command_window
        # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @party_command_window.active = false
        @party_command_window.visible = false
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ð—LŒø‰»
        @actor_command_window.active = true
        @actor_command_window.visible = true
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̈ʒu‚ðÝ’è
        @actor_command_window.x = @actor_index * 160 +
                                  (4 - $game_party.actors.size) * 80
        # ƒCƒ“ƒfƒbƒNƒX‚ð 0 ‚ɐݒè
        @actor_command_window.index = 0
      end
      #--------------------------------------------------------------------------
      # œ ƒGƒlƒ~[ƒAƒNƒVƒ‡ƒ“ì¬
      #--------------------------------------------------------------------------
      def enemy_action(number)
        enemy = $game_troop.enemies[number]
        unless enemy.current_action.forcing
          enemy.make_action
        end
        action_start(enemy)
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : Šî–{ƒRƒ}ƒ“ƒh)
      #--------------------------------------------------------------------------
      def update_phase3_basic_command
        unless @active_actor.inputable?
          @active_actor.current_action.clear
          phase3_next_actor
          return
        end
        # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::B) and @party == false
          # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.cancel_se)
          @party = true
        end
        if @party == true and
            ((@action > 0 and @action_battlers.empty?) or (@action == 0 and 
            (@action_battlers.empty? or @action_battlers[0].phase == 1)))
          # ƒp[ƒeƒBƒRƒ}ƒ“ƒhƒtƒF[ƒY‚Ö
          start_phase2
          return
        end
        # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::C)
          @party = false
          # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚̃J[ƒ\ƒ‹ˆÊ’u‚Å•ªŠò
          case @actor_command_window.index
          when 0  # UŒ‚
            if victory?
              # ƒuƒU[ SE ‚ð‰‰‘t
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Œˆ’è SE ‚ð‰‰‘t
            $game_system.se_play($data_system.decision_se)
            # ƒGƒlƒ~[‚Ì‘I‘ð‚ðŠJŽn
            start_enemy_select
          when 1  # ƒXƒLƒ‹
            # Œˆ’è SE ‚ð‰‰‘t
            $game_system.se_play($data_system.decision_se)
            # ƒXƒLƒ‹‚Ì‘I‘ð‚ðŠJŽn
            start_skill_select
          when 2  # –hŒä
            # Œˆ’è SE ‚ð‰‰‘t
            $game_system.se_play($data_system.decision_se)
            # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
            @active_actor.current_action.kind = 0
            @active_actor.current_action.basic = 1
            # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
            phase3_next_actor
          when 3  # ƒAƒCƒeƒ€
            # Œˆ’è SE ‚ð‰‰‘t
            $game_system.se_play($data_system.decision_se)
            # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðŠJŽn
            start_item_select
          end
          return
        end
        # ƒLƒƒƒ‰ƒ`ƒFƒ“ƒW
        if @command.size > 1
          # R ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
          if Input.trigger?(Input::R)
            $game_system.se_play($data_system.cursor_se)
            @party = false
            # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
            if @active_actor != nil
              @active_actor.blink = false
            end
            @command.push(@command[0])
            @command.shift
            @command_a = false
            # V‚½‚ȃRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚Ì—§‚¿ã‚°
            start_phase3
          end
          # L ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
          if Input.trigger?(Input::L)
            $game_system.se_play($data_system.cursor_se)
            @party = false
            # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
            if @active_actor != nil
              @active_actor.blink = false
            end
            @command.unshift(@command[@command.size - 1])
            @command.delete_at(@command.size - 1)
            @command_a = false
            # V‚½‚ȃRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚Ì—§‚¿ã‚°
            start_phase3
          end
          # ‰E ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
          if Input.trigger?(Input::RIGHT)
            $game_system.se_play($data_system.cursor_se)
            @party = false
            # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
            if @active_actor != nil
              @active_actor.blink = false
            end
            actor = $game_party.actors[@actor_index]
            while actor == @command[0] or (not @command.include?(actor))
              @actor_index += 1
              @actor_index %= $game_party.actors.size
              actor = $game_party.actors[@actor_index]
              if actor == @command[0]
                break
              end
            end
            while actor != @command[0]
              @command.push(@command.shift)
            end
            @command_a = false
            # V‚½‚ȃRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚Ì—§‚¿ã‚°
            start_phase3
          end
          # ¶ ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
          if Input.trigger?(Input::LEFT)
            $game_system.se_play($data_system.cursor_se)
            @party = false
            # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
            if @active_actor != nil
              @active_actor.blink = false
            end
            actor = $game_party.actors[@actor_index]
            while actor == @command[0] or (not @command.include?(actor))
              @actor_index -= 1
              @actor_index %= $game_party.actors.size
              actor = $game_party.actors[@actor_index]
              if actor == @command[0]
                break
              end
            end
            while actor != @command[0]
              @command.push(@command.shift)
            end
            @command_a = false
            # V‚½‚ȃRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚Ì—§‚¿ã‚°
            start_phase3
          end
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒXƒLƒ‹‘I‘ð)
      #--------------------------------------------------------------------------
      def update_phase3_skill_select
        # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”\‚É‚È‚Á‚½ê‡
        unless @active_actor.inputable?
          @active_actor.current_action.clear
          command_delete
          # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
          phase3_next_actor
          return
        end
        # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ð‰ÂŽ‹ó‘Ô‚É‚·‚é
        @skill_window.visible = true
        # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ðXV
        @skill_window.update
        # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::B)
          # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.cancel_se)
          # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
          end_skill_select
          return
        end
        # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::C)
          # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ÅŒ»Ý‘I‘ð‚³‚ê‚Ä‚¢‚éƒf[ƒ^‚ðŽæ“¾
          @skill = @skill_window.skill
          # Žg—p‚Å‚«‚È‚¢ê‡
          if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
            # ƒuƒU[ SE ‚ð‰‰‘t
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          if @skill.scope == 1 or @skill.scope == 2
            if victory?
              # ƒuƒU[ SE ‚ð‰‰‘t
              $game_system.se_play($data_system.buzzer_se)
              return
            end
          end        
          # Œˆ’è SE ‚ð‰‰‘t
          $game_system.se_play($data_system.decision_se)
          # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
          @active_actor.current_action.skill_id = @skill.id
          # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ð•s‰ÂŽ‹ó‘Ô‚É‚·‚é
          @skill_window.visible = false
          # Œø‰Ê”͈͂ª“G’P‘̂̏ꍇ
          if @skill.scope == 1
            # ƒGƒlƒ~[‚Ì‘I‘ð‚ðŠJŽn
            start_enemy_select
          # Œø‰Ê”͈͂ª–¡•û’P‘̂̏ꍇ
          elsif @skill.scope == 3 or @skill.scope == 5
            # ƒAƒNƒ^[‚Ì‘I‘ð‚ðŠJŽn
            start_actor_select
          # Œø‰Ê”͈͂ª’P‘Ì‚Å‚Í‚È‚¢ê‡
          else
            # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
            @active_actor.current_action.kind = 1
            # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
            end_skill_select
            # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
            phase3_next_actor
          end
          return
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒAƒCƒeƒ€‘I‘ð)
      #--------------------------------------------------------------------------
      def update_phase3_item_select
        # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”\‚É‚È‚Á‚½ê‡
        unless @active_actor.inputable?
          @active_actor.current_action.clear
          command_delete
          # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
          phase3_next_actor
          return
        end
        # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ð‰ÂŽ‹ó‘Ô‚É‚·‚é
        @item_window.visible = true
        # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ðXV
        @item_window.update
        # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::B)
          # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.cancel_se)
          # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
          end_item_select
          return
        end
        # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::C)
          # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ÅŒ»Ý‘I‘ð‚³‚ê‚Ä‚¢‚éƒf[ƒ^‚ðŽæ“¾
          @item = @item_window.item
          # Žg—p‚Å‚«‚È‚¢ê‡
          unless $game_party.item_can_use?(@item.id)
            # ƒuƒU[ SE ‚ð‰‰‘t
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          if @item.scope == 1 or @item.scope == 2
            if victory?
              # ƒuƒU[ SE ‚ð‰‰‘t
              $game_system.se_play($data_system.buzzer_se)
              return
            end
          end
          # Œˆ’è SE ‚ð‰‰‘t
          $game_system.se_play($data_system.decision_se)
          # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
          @active_actor.current_action.item_id = @item.id
          # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ð•s‰ÂŽ‹ó‘Ô‚É‚·‚é
          @item_window.visible = false
          # Œø‰Ê”͈͂ª“G’P‘̂̏ꍇ
          if @item.scope == 1
            # ƒGƒlƒ~[‚Ì‘I‘ð‚ðŠJŽn
            start_enemy_select
          # Œø‰Ê”͈͂ª–¡•û’P‘̂̏ꍇ
          elsif @item.scope == 3 or @item.scope == 5
            # ƒAƒNƒ^[‚Ì‘I‘ð‚ðŠJŽn
            start_actor_select
          # Œø‰Ê”͈͂ª’P‘Ì‚Å‚Í‚È‚¢ê‡
          else
            # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
            @active_actor.current_action.kind = 2
            # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
            end_item_select
            # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
            phase3_next_actor
          end
          return
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒGƒlƒ~[‘I‘ð)
      #--------------------------------------------------------------------------
      def update_phase3_enemy_select
        if victory?
          # ƒJƒƒ‰‚ðŒ³‚É–ß‚·
          if @camera == "select"
            @spriteset.screen_target(0, 0, 1)
          end
          # ƒGƒlƒ~[‚Ì‘I‘ð‚ðI—¹
          end_enemy_select
          return
        end
        # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”\‚É‚È‚Á‚½ê‡
        unless @active_actor.inputable?
          # ƒJƒƒ‰‚ðŒ³‚É–ß‚·
          if @camera == "select"
            @spriteset.screen_target(0, 0, 1)
          end
          @active_actor.current_action.clear
          command_delete
          # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
          phase3_next_actor
          return
        end
        # ƒGƒlƒ~[ƒAƒ[‚ðXV
        @enemy_arrow.update
        # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::B)
          # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.cancel_se)
          # ƒJƒƒ‰‚ðŒ³‚É–ß‚·
          if @camera == "select"
            # ƒJƒƒ‰‚̐ݒè
            @camera = "command"
            plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
            y = [(plus.abs - 1.5) * 10 , 0].min
            @spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
          end
          # ƒGƒlƒ~[‚Ì‘I‘ð‚ðI—¹
          end_enemy_select
          return
        end
        # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::C)
          # Œˆ’è SE ‚ð‰‰‘t
          $game_system.se_play($data_system.decision_se)
          # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
          @active_actor.current_action.kind = 0
          @active_actor.current_action.basic = 0
          @active_actor.current_action.target_index = @enemy_arrow.index
          # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE•\Ž¦’†‚̏ꍇ
          if @skill_window != nil
            # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
            @active_actor.current_action.kind = 1
            # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
            end_skill_select
          end
          # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE•\Ž¦’†‚̏ꍇ
          if @item_window != nil
            # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
            @active_actor.current_action.kind = 2
            # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
            end_item_select
          end
          # ƒGƒlƒ~[‚Ì‘I‘ð‚ðI—¹
          end_enemy_select
          # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
          phase3_next_actor
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒtƒF[ƒY : ƒAƒNƒ^[‘I‘ð)
      #--------------------------------------------------------------------------
      def update_phase3_actor_select
        # ƒRƒ}ƒ“ƒh‘I‘𒆂ɍs“®•s”\‚É‚È‚Á‚½ê‡
        unless @active_actor.inputable?
          @active_actor.current_action.clear
          command_delete
          # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
          phase3_next_actor
          return
        end
        # ƒAƒNƒ^[ƒAƒ[‚ðXV
        @actor_arrow.update
        # B ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::B)
          # ƒLƒƒƒ“ƒZƒ‹ SE ‚ð‰‰‘t
          $game_system.se_play($data_system.cancel_se)
          # ƒAƒNƒ^[‚Ì‘I‘ð‚ðI—¹
          end_actor_select
          return
        end
        # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
        if Input.trigger?(Input::C)
          # Œˆ’è SE ‚ð‰‰‘t
          $game_system.se_play($data_system.decision_se)
          # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
          @active_actor.current_action.kind = 0
          @active_actor.current_action.basic = 0
          @active_actor.current_action.target_index = @actor_arrow.index
          # ƒAƒNƒ^[‚Ì‘I‘ð‚ðI—¹
          end_actor_select
          # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE•\Ž¦’†‚̏ꍇ
          if @skill_window != nil
            # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
            @active_actor.current_action.kind = 1
            # ƒXƒLƒ‹‚Ì‘I‘ð‚ðI—¹
            end_skill_select
          end
          # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE•\Ž¦’†‚̏ꍇ
          if @item_window != nil
            # ƒAƒNƒVƒ‡ƒ“‚ðÄÝ’è
            @active_actor.current_action.kind = 2
            # ƒAƒCƒeƒ€‚Ì‘I‘ð‚ðI—¹
            end_item_select
          end
          # ŽŸ‚̃AƒNƒ^[‚̃Rƒ}ƒ“ƒh“ü—Í‚Ö
          phase3_next_actor
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒGƒlƒ~[‘I‘ðŠJŽn
      #--------------------------------------------------------------------------
      alias :start_enemy_select_rtab :start_enemy_select
      def start_enemy_select
        @camera = "select"
        for enemy in $game_troop.enemies
          if enemy.exist?
            zoom = 1 / enemy.zoom
            @spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
                                      enemy.attack_y(zoom) * 0.75, zoom)
            break
          end
        end
        # ƒIƒŠƒWƒiƒ‹‚̏ˆ—
        start_enemy_select_rtab
      end
      #--------------------------------------------------------------------------
      # œ ƒGƒlƒ~[‘I‘ðI—¹
      #--------------------------------------------------------------------------
      alias :end_enemy_select_rtab :end_enemy_select
      def end_enemy_select
        # ƒIƒŠƒWƒiƒ‹‚̏ˆ—
        end_enemy_select_rtab
        if (@action == 0 and not @action_battlers.empty?) or
              (@camera == "select" and (@active_actor.current_action.kind != 0 or
                                                @active_actor.animation1_id != 0))
          @spriteset.screen_target(0, 0, 1)
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹‘I‘ðŠJŽn
      #--------------------------------------------------------------------------
      def start_skill_select
        # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ðì¬
        @skill_window = Window_Skill.new(@active_actor)
        # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚ðŠÖ˜A•t‚¯
        @skill_window.help_window = @help_window
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
        @actor_command_window.active = false
        @actor_command_window.visible = false
      end
    
    #==============================================================================
    # ¡ Scene_Battle (•ªŠ„’è‹` 4)
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
    #==============================================================================
    
      #--------------------------------------------------------------------------
      # œ ƒƒCƒ“ƒtƒF[ƒYŠJŽn
      #--------------------------------------------------------------------------
      def start_phase4
        $game_temp.battle_main_phase = true
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY)
      #--------------------------------------------------------------------------
      def update_phase4
        # ƒAƒNƒVƒ‡ƒ“‚ð‹­§‚³‚ê‚Ä‚¢‚éƒoƒgƒ‰[‚ª‘¶Ý‚·‚éê‡
        if $game_temp.forcing_battler != nil
          battler = $game_temp.forcing_battler
          if battler.current_action.forcing == false
            if @action_battlers.include?(battler)
              if @action > 0 or @action_battlers[0].phase == 1
                @action_battlers.delete(battler)
                @action_battlers.push(battler)
              end
              if battler.phase == 1 
                battler.current_action.forcing = true
                force_action(battler)
              end
            else
              battler.current_action.forcing = true
              force_action(battler)
              action_start(battler)
              @action_battlers.delete(battler)
              @action_battlers.push(battler)
            end
            battler.at = @max
            battler.atp = 100 * battler.at / @max
          end
        end
        # action ‚ª1ˆÈã‚̏ꍇAˆêÄ‚ɍs“®‚ð‹N‚±‚·
        for battler in @action_battlers.reverse
          # ƒEƒFƒCƒg’†‚̏ꍇ
          if battler.wait > 0
            # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðŒ¸‚ç‚·
            battler.wait -= 1
            break if @action == 0
            next
          end
          unless fin? and battler.phase < 3 and
              not $game_system.battle_interpreter.running?
            action_phase(battler)
          end
          break if @action == 0
        end
        # ƒAƒNƒVƒ‡ƒ“‚ð‹­§‚³‚ê‚Ä‚¢‚éƒoƒgƒ‰[‚ª‘¶Ý‚µ‚È‚¢ê‡
        if $game_temp.forcing_battler == nil
          # ƒoƒgƒ‹ƒCƒxƒ“ƒg‚ðƒZƒbƒgƒAƒbƒv
          setup_battle_event
          # ƒoƒgƒ‹ƒCƒxƒ“ƒgŽÀs’†‚̏ꍇ
          if $game_system.battle_interpreter.running?
            return
          end
        end
        for battler in @action_battlers.reverse
          if fin? and battler.phase < 3 and 
              not $game_system.battle_interpreter.running?
            # í“¬‚ªI—¹‚µA‚©‚ƒAƒNƒ^[‚ªs“®’¼‘O‚̏ꍇ‚̓AƒNƒ^[‚̍s“®‚ðÁ‹Ž
            @action_battlers.delete(battler)
          end
        end
        if @action_battlers.empty? and not $game_system.battle_interpreter.running?
          # Ÿ”s”»’è
          judge
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒVƒ‡ƒ“XV (ƒƒCƒ“ƒtƒF[ƒY)
      #--------------------------------------------------------------------------
      def action_phase(battler)
        # action ‚ª 1 ‚̏ꍇAƒoƒgƒ‰[‚ªs“®’†‚©‚Ç‚¤‚©Šm”F
        if @action == 1 and battler.phase < 3
          for target in battler.target
            speller = synthe?(target)
            if speller == nil
              # ƒ^[ƒQƒbƒg‚ª’ʏís“®’†‚̏ꍇ
              if @action_battlers.include?(target)
                if target.phase > 2
                  return
                end
              end
            else
              # ƒ^[ƒQƒbƒg‚ª˜AŒgƒXƒLƒ‹”­“®’†‚̏ꍇ
              for spell in speller
                if @action_battlers.include?(spell)
                  if spell.phase > 2
                    return
                  end
                end
              end
            end
          end
        end
        case battler.phase
        when 1
          update_phase4_step1(battler)
        when 2
          update_phase4_step2(battler)
        when 3
          update_phase4_step3(battler)
        when 4
          update_phase4_step4(battler)
        when 5
          update_phase4_step5(battler)
        when 6
          update_phase4_step6(battler)
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 1 : ƒAƒNƒVƒ‡ƒ“€”õ)
      #--------------------------------------------------------------------------
      def update_phase4_step1(battler)
        # ‚·‚łɐ퓬‚©‚çŠO‚³‚ê‚Ä‚¢‚éê‡
        if battler.index == nil
          @action_battlers.delete(battler)
          anime_wait_return
          return
        end
        speller = synthe?(battler)
        if speller == nil
          # ƒ_ƒ[ƒWH‚ç‚¢’†‚̏ꍇ
          unless battler.damage.empty? or @action > 2
            return
          end
          # s“®‰Â”\‚©‚Ç‚¤‚©”»’è
          unless battler.movable?
            battler.phase = 6
            return
          end
        else
          # ƒ_ƒ[ƒWH‚ç‚¢’†‚̏ꍇ
          for spell in speller
            unless spell.damage.empty? or @action > 2
              return
            end
            # s“®‰Â”\‚©‚Ç‚¤‚©”»’è
            unless spell.movable?
              battler.phase = 6
              return
            end
          end
        end
        # ƒXƒLƒ‹Žg—pŽžA‰r¥ŽžŠÔÝ’è
        # ‹­§ƒAƒNƒVƒ‡ƒ“‚©‚ @force ‚ª 2 ‚ÌŽž‚̓XƒLƒ‹‚𑦎ž”­“®
        if battler.current_action.kind == 1 and
          (not battler.current_action.forcing or @force != 2)
          if battler.rtp == 0
            # ƒXƒLƒ‹‰r¥’†‚È‚ç‚΁A‰ðœ
            skill_reset(battler)
            # ƒXƒLƒ‹‰r¥ŽžŠÔÝ’è
            recite_time(battler)
            # ˜AŒg‹ZÝ’è
            synthe_spell(battler)
            # ƒXƒLƒ‹‚ð‰r¥‚·‚éê‡
            if battler.rtp > 0
              # ‹­§ƒAƒNƒVƒ‡ƒ“‚©‚ @force ‚ª 1 ‚ÌŽž‚͘AŒgƒXƒLƒ‹‚Ì‚Ý‘¦Žž”­“®
              speller = synthe?(battler)
              if battler.current_action.forcing and @force > 0 and speller != nil
                for spell in speller
                  spell.rt = spell.rtp
                end
              else
                battler.blink = true
                if battler.current_action.forcing
                  $game_temp.forcing_battler = nil
                  battler.current_action.forcing = false
                end
                @action_battlers.delete(battler)
                return
              end
            end
          end
        end
        # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
        if battler != nil
          battler.blink = false
        end
        speller = synthe?(battler)
        if speller == nil
          @spell_p.delete(battler)
          @spell_e.delete(battler)
        else
          for spell in speller
            spell.blink = false
            @spell_p.delete(spell)
            @spell_e.delete(spell)
          end
        end
        # ƒXƒeƒbƒv 2 ‚Ɉڍs
        battler.phase = 2
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 2 : ƒAƒNƒVƒ‡ƒ“ŠJŽn)
      #--------------------------------------------------------------------------
      def update_phase4_step2(battler)
        # ‹­§ƒAƒNƒVƒ‡ƒ“‚Å‚È‚¯‚ê‚Î
        unless battler.current_action.forcing
          # §–ñ‚ª [“G‚ð’ʏíUŒ‚‚·‚é] ‚© [–¡•û‚ð’ʏíUŒ‚‚·‚é] ‚̏ꍇ
          if battler.restriction == 2 or battler.restriction == 3
            # ƒAƒNƒVƒ‡ƒ“‚ɍUŒ‚‚ðÝ’è
            battler.current_action.kind = 0
            battler.current_action.basic = 0
          end
        end
        # ƒAƒNƒVƒ‡ƒ“‚ÌŽí•Ê‚Å•ªŠò
        case battler.current_action.kind
        when 0  # Šî–{
          if fin?
            battler.phase = 6
            return
          end
          make_basic_action_result(battler)
        when 1  # ƒXƒLƒ‹
          if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
            battler.phase = 6
            return
          end
          make_skill_action_result(battler)
        when 2  # ƒAƒCƒeƒ€
          if fin? and $data_items[battler.current_action.item_id].scope == 1..2
            battler.phase = 6
            return
          end
          make_item_action_result(battler)
        end
        if battler.phase == 2
          # ƒXƒeƒbƒv 3 ‚Ɉڍs
          battler.phase = 3
        end
      end
      #--------------------------------------------------------------------------
      # œ Šî–{ƒAƒNƒVƒ‡ƒ“ Œ‹‰Êì¬
      #--------------------------------------------------------------------------
      def make_basic_action_result(battler)
        # UŒ‚‚̏ꍇ
        if battler.current_action.basic == 0
          # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ðÝ’è
          battler.anime1 = battler.animation1_id
          battler.anime2 = battler.animation2_id
          # s“®‘¤ƒoƒgƒ‰[‚ªƒGƒlƒ~[‚̏ꍇ
          if battler.is_a?(Game_Enemy)
            if battler.restriction == 3
              target = $game_troop.random_target_enemy
            elsif battler.restriction == 2
              target = $game_party.random_target_actor
            else
              index = battler.current_action.target_index
              target = $game_party.smooth_target_actor(index)
            end
          end
          # s“®‘¤ƒoƒgƒ‰[‚ªƒAƒNƒ^[‚̏ꍇ
          if battler.is_a?(Game_Actor)
            if battler.restriction == 3
              target = $game_party.random_target_actor
            elsif battler.restriction == 2
              target = $game_troop.random_target_enemy
            else
              index = battler.current_action.target_index
              target = $game_troop.smooth_target_enemy(index)
            end
          end
          # ‘Ώۑ¤ƒoƒgƒ‰[‚Ì”z—ñ‚ðÝ’è
          battler.target = [target]
          # ’ʏíUŒ‚‚ÌŒø‰Ê‚ð“K—p
          for target in battler.target
            target.attack_effect(battler)
          end
          return
        end
        # –hŒä‚̏ꍇ
        if battler.current_action.basic == 1
          return
        end
        # “¦‚°‚é‚̏ꍇ
        if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
          # “¦‚°‚é
          battler.escape
          return
        end
        # ‰½‚à‚µ‚È‚¢‚̏ꍇ
        if battler.current_action.basic == 3
          # ƒXƒeƒbƒv 6 ‚Ɉڍs
          battler.phase = 6
          return
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹‚Ü‚½‚̓AƒCƒeƒ€‚̑Ώۑ¤ƒoƒgƒ‰[Ý’è
      #     scope : ƒXƒLƒ‹‚Ü‚½‚̓AƒCƒeƒ€‚ÌŒø‰Ê”͈Í
      #--------------------------------------------------------------------------
      def set_target_battlers(scope, battler)
        # s“®‘¤ƒoƒgƒ‰[‚ªƒGƒlƒ~[‚̏ꍇ
        if battler.is_a?(Game_Enemy)
          # Œø‰Ê”͈͂ŕªŠò
          case scope
          when 1  # “G’P‘Ì
            index =battler.current_action.target_index
            battler.target.push($game_party.smooth_target_actor(index))
          when 2  # “G‘S‘Ì
            for actor in $game_party.actors
              if actor.exist?
                battler.target.push(actor)
              end
            end
          when 3  # –¡•û’P‘Ì
            index = battler.current_action.target_index
            battler.target.push($game_troop.smooth_target_enemy(index))
          when 4  # –¡•û‘S‘Ì
            for enemy in $game_troop.enemies
              if enemy.exist?
                battler.target.push(enemy)
              end
            end
          when 5  # –¡•û’P‘Ì (HP 0) 
            index = battler.current_action.target_index
            enemy = $game_troop.enemies[index]
            if enemy != nil and enemy.hp0?
              battler.target.push(enemy)
            end
          when 6  # –¡•û‘S‘Ì (HP 0) 
            for enemy in $game_troop.enemies
              if enemy != nil and enemy.hp0?
                battler.target.push(enemy)
              end
            end
          when 7  # Žg—pŽÒ
            battler.target.push(battler)
          end
        end
        # s“®‘¤ƒoƒgƒ‰[‚ªƒAƒNƒ^[‚̏ꍇ
        if battler.is_a?(Game_Actor)
          # Œø‰Ê”͈͂ŕªŠò
          case scope
          when 1  # “G’P‘Ì
            index = battler.current_action.target_index
            battler.target.push($game_troop.smooth_target_enemy(index))
          when 2  # “G‘S‘Ì
            for enemy in $game_troop.enemies
              if enemy.exist?
                battler.target.push(enemy)
              end
            end
          when 3  # –¡•û’P‘Ì
            index = battler.current_action.target_index
            battler.target.push($game_party.smooth_target_actor(index))
          when 4  # –¡•û‘S‘Ì
            for actor in $game_party.actors
              if actor.exist?
                battler.target.push(actor)
              end
            end
          when 5  # –¡•û’P‘Ì (HP 0) 
            index = battler.current_action.target_index
            actor = $game_party.actors[index]
            if actor != nil and actor.hp0?
              battler.target.push(actor)
            end
          when 6  # –¡•û‘S‘Ì (HP 0) 
            for actor in $game_party.actors
              if actor != nil and actor.hp0?
                battler.target.push(actor)
              end
            end
          when 7  # Žg—pŽÒ
            battler.target.push(battler)
          end
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹ƒAƒNƒVƒ‡ƒ“ Œ‹‰Êì¬
      #--------------------------------------------------------------------------
      def make_skill_action_result(battler)
        # ƒXƒLƒ‹‚ðŽæ“¾
        @skill = $data_skills[battler.current_action.skill_id]
        # ˜AŒgƒXƒLƒ‹‚Å‚ ‚é‚©‚Ç‚¤‚©Šm”F
        speller = synthe?(battler)
        # ‹­§ƒAƒNƒVƒ‡ƒ“‚Å‚È‚¯‚ê‚Î
        unless battler.current_action.forcing
          # SP Ø‚ê‚È‚Ç‚ÅŽg—p‚Å‚«‚È‚­‚È‚Á‚½ê‡
          if speller == nil
            unless battler.skill_can_use?(@skill.id)
              # ƒXƒeƒbƒv 6 ‚Ɉڍs
              battler.phase = 6
             return
            end
          end
        end
        # SP Á”ï
        temp = false
        if speller != nil
          for spell in speller
            if spell.current_action.spell_id == 0
              spell.sp -= @skill.sp_cost
            else
              spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
            end
            # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
            status_refresh(spell)
          end
        else
          battler.sp -= @skill.sp_cost
          # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
          status_refresh(battler)
        end
        # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ðÝ’è
        battler.anime1 = @skill.animation1_id
        battler.anime2 = @skill.animation2_id
        # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ðÝ’è
        battler.event = @skill.common_event_id
        # ‘Ώۑ¤ƒoƒgƒ‰[‚ðÝ’è
        set_target_battlers(@skill.scope, battler)
        # ƒXƒLƒ‹‚ÌŒø‰Ê‚ð“K—p
        for target in battler.target
          if speller != nil
            damage = 0
            effective = false
            state_p = []
            state_m = []
            for spell in speller
              if spell.current_action.spell_id != 0
                @skill = $data_skills[spell.current_action.spell_id]
              end
              effective |= target.skill_effect(spell, @skill)
              if target.damage[spell].class != String
                damage += target.damage[spell]
              elsif effective == true
                effect = target.damage[spell]
              end
              state_p += target.state_p[spell]
              state_m += target.state_m[spell]
              target.damage.delete(spell)
              target.state_p.delete(spell)
              target.state_m.delete(spell)
            end
            if damage != 0
              target.damage[battler] = damage
            elsif effective = true
              target.damage[battler] = effect
            end
            target.state_p[battler] = state_p
            target.state_m[battler] = state_m
          else
            target.skill_effect(battler, @skill)
          end
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒCƒeƒ€ƒAƒNƒVƒ‡ƒ“ Œ‹‰Êì¬
      #--------------------------------------------------------------------------
      def make_item_action_result(battler)
        # ƒAƒCƒeƒ€‚ðŽæ“¾
        @item = $data_items[battler.current_action.item_id]
        # ƒAƒCƒeƒ€Ø‚ê‚È‚Ç‚ÅŽg—p‚Å‚«‚È‚­‚È‚Á‚½ê‡
        unless $game_party.item_can_use?(@item.id)
          # ƒXƒeƒbƒv 6 ‚Ɉڍs
          battler.phase = 6
          return
        end
        # Á–Õ•i‚̏ꍇ
        if @item.consumable
          # Žg—p‚µ‚½ƒAƒCƒeƒ€‚ð 1 Œ¸‚ç‚·
          $game_party.lose_item(@item.id, 1)
        end
        # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ðÝ’è
        battler.anime1 = @item.animation1_id
        battler.anime2 = @item.animation2_id
        # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ðÝ’è
        battler.event = @item.common_event_id
        # ‘ÎÛ‚ðŒˆ’è
        index = battler.current_action.target_index
        target = $game_party.smooth_target_actor(index)
        # ‘Ώۑ¤ƒoƒgƒ‰[‚ðÝ’è
        set_target_battlers(@item.scope, battler)
        # ƒAƒCƒeƒ€‚ÌŒø‰Ê‚ð“K—p
        for target in battler.target
          target.item_effect(@item, battler)
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 3 : s“®‘¤ƒAƒjƒ[ƒVƒ‡ƒ“)
      #--------------------------------------------------------------------------
      def update_phase4_step3(battler)
        # ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚̍XVBƒAƒNƒVƒ‡ƒ“‚ÌŽí•Ê‚Å•ªŠò
        case battler.current_action.kind
        when 0  # Šî–{
          if battler.current_action.basic == 1
            @help_window.set_text($data_system.words.guard, 1)
            @help_wait = @help_time
          end
          if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
            @help_window.set_text("“¦‚°‚é", 1)
            @help_wait = @help_time
          end
        when 1  # ƒXƒLƒ‹
          skill =  $data_skills[battler.current_action.skill_id]
          @help_window.set_text(skill.name, 1)
          @help_wait = @help_time
        when 2  # ƒAƒCƒeƒ€
          item = $data_items[battler.current_action.item_id]
          @help_window.set_text(item.name, 1)
          @help_wait = @help_time
        end
        # s“®‘¤ƒAƒjƒ[ƒVƒ‡ƒ“ (ID ‚ª 0 ‚̏ꍇ‚Í”’ƒtƒ‰ƒbƒVƒ…)
        if battler.anime1 == 0
          battler.white_flash = true
          battler.wait = 5
          # ƒJƒƒ‰Ý’è
          if battler.target[0].is_a?(Game_Enemy)
            camera_set(battler)
          end
        else
          battler.animation.push([battler.anime1, true])
          speller = synthe?(battler)
          if speller != nil
            for spell in speller
              if spell != battler
                if spell.current_action.spell_id == 0
                  spell.animation.push([battler.anime1, true])
                else
                  skill = spell.current_action.spell_id
                  spell.animation.push([$data_skills[skill].animation1_id, true])
                  spell.current_action.spell_id = 0
                end
              end
            end
          end
          battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
        end
        # ƒXƒeƒbƒv 4 ‚Ɉڍs
        battler.phase = 4
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 4 : ‘Ώۑ¤ƒAƒjƒ[ƒVƒ‡ƒ“)
      #--------------------------------------------------------------------------
      def update_phase4_step4(battler)
        # ƒJƒƒ‰Ý’è
        if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
           camera_set(battler)
        end
        # ‘Ώۑ¤ƒAƒjƒ[ƒVƒ‡ƒ“
        for target in battler.target
          target.animation.push([battler.anime2,
                                              (target.damage[battler] != "Miss")])
          unless battler.anime2 == 0
            battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
          end
        end
        # ƒXƒeƒbƒv 5 ‚Ɉڍs
        battler.phase = 5
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 5 : ƒ_ƒ[ƒW•\Ž¦)
      #--------------------------------------------------------------------------
      def update_phase4_step5(battler)
        # ƒ_ƒ[ƒW•\Ž¦
        for target in battler.target
          if target.damage[battler] != nil
            target.damage_pop[battler] = true
            target.damage_effect(battler, battler.current_action.kind)
            battler.wait = @damage_wait
            # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
            status_refresh(target)
          end
        end
        # ƒXƒeƒbƒv 6 ‚Ɉڍs
        battler.phase = 6
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV (ƒƒCƒ“ƒtƒF[ƒY ƒXƒeƒbƒv 6 : ƒŠƒtƒŒƒbƒVƒ…)
      #--------------------------------------------------------------------------
      def update_phase4_step6(battler)
        # ƒJƒƒ‰‚ð–ß‚·
        if battler.target[0].is_a?(Game_Enemy) and @camera == battler
          @spriteset.screen_target(0, 0, 1)
        end
        # ƒXƒLƒ‹ƒ‰[ƒjƒ“ƒO
        if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
          for target in battler.target
            skill_learning(target, target.class_id,
                            battler.current_action.skill_id)
          end
        end
        # ƒAƒNƒVƒ‡ƒ“‹­§‘Ώۂ̃oƒgƒ‰[‚ðƒNƒŠƒA
        if battler.current_action.forcing == true and
            battler.current_action.force_kind == 0 and
            battler.current_action.force_basic == 0 and
            battler.current_action.force_skill_id == 0
          $game_temp.forcing_battler = nil
          battler.current_action.forcing = false
        end
        refresh_phase(battler)
        speller = synthe?(battler)
        if speller != nil
          for spell in speller
            if spell != battler
              refresh_phase(spell)
            end
          end
          synthe_delete(speller)
        end
        # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚̏ꍇ
        if battler.event > 0
          # ƒCƒxƒ“ƒg‚ðƒZƒbƒgƒAƒbƒv
          common_event = $data_common_events[battler.event]
          $game_system.battle_interpreter.setup(common_event.list, 0)
        end
        act = 0
        for actor in $game_party.actors + $game_troop.enemies
          if actor.movable?
            act += 1
          end
        end
        if @turn_cnt >= act and act > 0
          @turn_cnt %= act
          $game_temp.battle_turn += 1
          # ƒoƒgƒ‹ƒCƒxƒ“ƒg‚Ì‘Sƒy[ƒW‚ðŒŸõ
          for index in 0...$data_troops[@troop_id].pages.size
            # ƒCƒxƒ“ƒgƒy[ƒW‚ðŽæ“¾
            page = $data_troops[@troop_id].pages[index]
            # ‚±‚̃y[ƒW‚̃Xƒpƒ“‚ª [ƒ^[ƒ“] ‚̏ꍇ
            if page.span == 1
              # ŽÀsÏ‚݃tƒ‰ƒO‚ðƒNƒŠƒA
              $game_temp.battle_event_flags[index] = false
            end
          end
        end
        battler.phase = 1
        @action_battlers.delete(battler)
      end
      #--------------------------------------------------------------------------
      # œ ƒŠƒtƒŒƒbƒVƒ…
      #--------------------------------------------------------------------------
      def refresh_phase(battler)
        battler.at %= @max
        if battler.movable?
          battler.atp = 100 * battler.at / @max
        end
        spell_reset(battler)
        # ƒXƒŠƒbƒvƒ_ƒ[ƒW
        if battler.hp > 0 and battler.slip_damage?
          battler.slip_damage_effect
          battler.damage_pop["slip"] = true
        end
        # ƒXƒe[ƒgŽ©‘R‰ðœ
        battler.remove_states_auto
        # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
        status_refresh(battler, true)
        unless battler.movable?
          return
        end
        # ƒ^[ƒ“”ƒJƒEƒ“ƒg
        @turn_cnt += 1
      end
      #--------------------------------------------------------------------------
      # œ ƒoƒgƒ‰[ƒAƒNƒVƒ‡ƒ“ƒXƒ^[ƒg
      #--------------------------------------------------------------------------
      def action_start(battler)
        battler.phase = 1
        battler.anime1 = 0
        battler.anime2 = 0
        battler.target = []
        battler.event = 0
        @action_battlers.unshift(battler)
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
      #--------------------------------------------------------------------------
      def status_refresh(battler, at = false)
        if battler.is_a?(Game_Actor)
          for i in 0...$game_party.actors.size
            if battler == $game_party.actors[i]
              number = i + 1
            end
          end
          @status_window.refresh(number)
          if at == true
            @status_window.at_refresh(number)
          end
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒjƒƒEƒFƒCƒg”»’fˆ—
      #--------------------------------------------------------------------------
      def anime_wait_return
        if (@action_battlers.empty? or @anime_wait == false) and
            not $game_system.battle_interpreter.running? and not fin?
          # ƒGƒlƒ~[ƒAƒ[‚ª—LŒø‚̏ꍇ
          if @enemy_arrow != nil
            return [@active - 2, 0].min == 0
          # ƒAƒNƒ^[ƒAƒ[‚ª—LŒø‚̏ꍇ
          elsif @actor_arrow != nil
            return [@active - 2, 0].min == 0
          # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
          elsif @skill_window != nil
            return [@active - 3, 0].min == 0
          # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
          elsif @item_window != nil
            return [@active - 3, 0].min == 0
          # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
          elsif @actor_command_window.active
            return [@active - 1, 0].min == 0
          else
            return true
          end
        else
          return false
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒhÁ‹Ž”»’f
      #--------------------------------------------------------------------------
      def command_delete
        # ƒGƒlƒ~[ƒAƒ[‚ª—LŒø‚̏ꍇ
        if @enemy_arrow != nil
          end_enemy_select
        # ƒAƒNƒ^[ƒAƒ[‚ª—LŒø‚̏ꍇ
        elsif @actor_arrow != nil
          end_actor_select
        end
        # ƒXƒLƒ‹ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
        if @skill_window != nil
          end_skill_select
        # ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
        elsif @item_window != nil
          end_item_select
        end
        # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚ª—LŒø‚̏ꍇ
        if @actor_command_window.active
          @command.shift
          @command_a = false
          # ƒƒCƒ“ƒtƒF[ƒYƒtƒ‰ƒO‚ðƒZƒbƒg
          $game_temp.battle_main_phase = true
          # ƒAƒNƒ^[ƒRƒ}ƒ“ƒhƒEƒBƒ“ƒhƒE‚𖳌ø‰»
          @actor_command_window.active = false
          @actor_command_window.visible = false
          # ƒAƒNƒ^[‚Ì–¾–ŃGƒtƒFƒNƒg OFF
          if @active_actor != nil
            @active_actor.blink = false
          end
        end
      end
      #--------------------------------------------------------------------------
      # œ ‹­§ƒAƒNƒVƒ‡ƒ“Ý’è
      #--------------------------------------------------------------------------
      def force_action(battler)
        battler.current_action.kind = battler.current_action.force_kind
        battler.current_action.basic = battler.current_action.force_basic
        battler.current_action.skill_id = battler.current_action.force_skill_id
        battler.current_action.force_kind = 0
        battler.current_action.force_basic = 0
        battler.current_action.force_skill_id = 0
      end
      #--------------------------------------------------------------------------
      # œ ƒJƒƒ‰ƒZƒbƒg
      #--------------------------------------------------------------------------
      def camera_set(battler)
        @camera = battler
        if battler.target.size == 1
          if battler.current_action.kind == 0
            zoom = 1.2 / battler.target[0].zoom
          elsif synthe?(battler) == nil
            zoom = 1.5 / battler.target[0].zoom
          else
            zoom = 2.0 / battler.target[0].zoom
          end
          @spriteset.screen_target(battler.target[0].attack_x(zoom),
                                    battler.target[0].attack_y(zoom), zoom)
        else
          @spriteset.screen_target(0, 0, 0.75)
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹‰r¥ƒ^ƒCƒ€ì¬
      #--------------------------------------------------------------------------
      def recite_time(battler)
      end
      #--------------------------------------------------------------------------
      # œ ˜AŒgƒXƒLƒ‹”»•Ê
      #--------------------------------------------------------------------------
      def synthe_spell(battler)
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹ƒ‰[ƒjƒ“ƒOƒVƒXƒeƒ€
      #--------------------------------------------------------------------------
      def skill_learning(actor, class_id, skill_id)
      end
      #--------------------------------------------------------------------------
      # œ s“®‰Â”\”»’è
      #--------------------------------------------------------------------------
      def active?(battler)
        speller = synthe?(battler)
        if speller != nil
          if synthe_delete?(speller)
            return false
          end
        else
          unless battler.inputable?
            spell_reset(battler)
            unless battler.movable?
              battler.atp = 0
              return false
            end
          end
          if battler.current_action.forcing
            spell_reset(battler)
          end
        end
        return true
      end
      #--------------------------------------------------------------------------
      # œ ‡¬ƒXƒLƒ‹‰r¥’†‚©H
      #--------------------------------------------------------------------------
      def synthe?(battler)
        for speller in @synthe
          if speller.include?(battler)
            return speller
          end
        end
        return nil
      end
      #--------------------------------------------------------------------------
      # œ ‡¬ƒXƒLƒ‹Á‹Ž”»’f
      #--------------------------------------------------------------------------
      def synthe_delete?(speller)
        for battler in speller
          if not battler.inputable? and dead_ok?(battler)
            synthe_delete(speller)
            return true
          end
        end
        return false
      end
      #--------------------------------------------------------------------------
      # œ ‡¬ƒXƒLƒ‹Á‹Ž
      #--------------------------------------------------------------------------
      def synthe_delete(speller)
        for battler in speller
          spell_reset(battler)
          if dead_ok?(battler)
            @action_battlers.delete(battler)
          end
        end
        @synthe.delete(speller)
      end
      #--------------------------------------------------------------------------
      # œ ˜AŒgŠÜ‚ÞƒXƒLƒ‹‰r¥‰ðœ
      #--------------------------------------------------------------------------
      def skill_reset(battler)
        speller = synthe?(battler)
        if speller != nil
          synthe_delete(speller)
        else
          spell_reset(battler)
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹‰r¥‰ðœ
      #--------------------------------------------------------------------------
      def spell_reset(battler)
        battler.rt = 0
        battler.rtp = 0
        battler.blink = false
        battler.spell = false
        battler.current_action.spell_id = 0
        @spell_p.delete(battler)
        @spell_e.delete(battler)
      end
      #--------------------------------------------------------------------------
      # œ í“¬I—¹”»’è
      #--------------------------------------------------------------------------
      def fin?
       return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
      end
      #--------------------------------------------------------------------------
      # œ “G‘S–Å”»’è
      #--------------------------------------------------------------------------
      def victory?
        for battler in $game_troop.enemies
          if battler.exist?
            return false
          end
        end
        return true
      end
      #--------------------------------------------------------------------------
      # œ Ž€–S‹–‰Â”»’è
      #--------------------------------------------------------------------------
      def dead_ok?(battler)
        speller = synthe?(battler)
        if speller == nil
          if @action_battlers.include?(battler)
            if battler.phase > 2
              return false
            end
          end
        else
          for battler in speller
            if @action_battlers.include?(battler)
              if battler.phase > 2
                return false
              end
            end
          end
        end
        return true
      end
    end
    
    #==============================================================================
    # ¡ Game_Actor
    #------------------------------------------------------------------------------
    # @ƒAƒNƒ^[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Actors ƒNƒ‰ƒX ($game_actors)
    # ‚Ì“à•”‚ÅŽg—p‚³‚êAGame_Party ƒNƒ‰ƒX ($game_party) ‚©‚ç‚àŽQÆ‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Game_Actor < Game_Battler
      #--------------------------------------------------------------------------
      # œ ƒoƒgƒ‹‰æ–Ê X À•W‚̎擾
      #--------------------------------------------------------------------------
      def screen_x
        # ƒp[ƒeƒB“à‚Ì•À‚я‡‚©‚ç X À•W‚ðŒvŽZ‚µ‚Ä•Ô‚·
        if self.index != nil
          return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
        else
          return 0
        end
      end
    end
    
    #==============================================================================
    # ¡ Spriteset_Battle
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂ̃Xƒvƒ‰ƒCƒg‚ð‚Ü‚Æ‚ß‚½ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Scene_Battle ƒNƒ‰
    # ƒX‚Ì“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Spriteset_Battle
      #--------------------------------------------------------------------------
      # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
      #--------------------------------------------------------------------------
      attr_reader   :real_x                   # xÀ•W•â³iŒ»Ý’lj
      attr_reader   :real_y                   # yÀ•W•â³iŒ»Ý’lj
      attr_reader   :real_zoom                # Šg‘å—¦iŒ»Ý’lj
      #--------------------------------------------------------------------------
      # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
      #--------------------------------------------------------------------------
      def initialize
        # ƒrƒ…[ƒ|[ƒg‚ðì¬
        @viewport1 = Viewport.new(0, 0, 640, 480)
        @viewport2 = Viewport.new(0, 0, 640, 480)
        @viewport3 = Viewport.new(0, 0, 640, 480)
        @viewport4 = Viewport.new(0, 0, 640, 480)
        @viewport2.z = 101
        @viewport3.z = 200
        @viewport4.z = 5000
        @wait = 0
        @real_x = 0
        @real_y = 0
        @real_zoom = 1.0
        @target_x = 0
        @target_y = 0
        @target_zoom = 1.0
        @gap_x = 0
        @gap_y = 0
        @gap_zoom = 0.0
        # ƒoƒgƒ‹ƒoƒbƒNƒXƒvƒ‰ƒCƒg‚ðì¬
        @battleback_sprite = Sprite.new(@viewport1)
        # ƒGƒlƒ~[ƒXƒvƒ‰ƒCƒg‚ðì¬
        @enemy_sprites = []
        for enemy in $game_troop.enemies.reverse
          @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
        end
        # ƒAƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ðì¬
        @actor_sprites = []
        @actor_sprites.push(Sprite_Battler.new(@viewport2))
        @actor_sprites.push(Sprite_Battler.new(@viewport2))
        @actor_sprites.push(Sprite_Battler.new(@viewport2))
        @actor_sprites.push(Sprite_Battler.new(@viewport2))
        # “VŒó‚ðì¬
        @weather = RPG::Weather.new(@viewport1)
        # ƒsƒNƒ`ƒƒƒXƒvƒ‰ƒCƒg‚ðì¬
        @picture_sprites = []
        for i in 51..100
          @picture_sprites.push(Sprite_Picture.new(@viewport3,
            $game_screen.pictures[i]))
        end
        # ƒ^ƒCƒ}[ƒXƒvƒ‰ƒCƒg‚ðì¬
        @timer_sprite = Sprite_Timer.new
        # ƒtƒŒ[ƒ€XV
        update
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV
      #--------------------------------------------------------------------------
      def update
        # ƒAƒNƒ^[ƒXƒvƒ‰ƒCƒg‚Ì“à—e‚ðXV (ƒAƒNƒ^[‚Ì“ü‚ê‘Ö‚¦‚ɑΉž)
        @actor_sprites[0].battler = $game_party.actors[0]
        @actor_sprites[1].battler = $game_party.actors[1]
        @actor_sprites[2].battler = $game_party.actors[2]
        @actor_sprites[3].battler = $game_party.actors[3]
        # ƒoƒgƒ‹ƒoƒbƒN‚̃tƒ@ƒCƒ‹–¼‚ªŒ»Ý‚Ì‚à‚̂ƈႤê‡
        if @battleback_name != $game_temp.battleback_name
          make_battleback
        end
        # ‰æ–ʂ̃XƒNƒ[ƒ‹
        screen_scroll
        # ƒ‚ƒ“ƒXƒ^[‚̈ʒu•â³
        for enemy in $game_troop.enemies
          enemy.real_x = @real_x
          enemy.real_y = @real_y
          enemy.real_zoom = @real_zoom
        end
        # ƒoƒgƒ‰[ƒXƒvƒ‰ƒCƒg‚ðXV
        for sprite in @enemy_sprites + @actor_sprites
          sprite.update
        end
        # “VŒóƒOƒ‰ƒtƒBƒbƒN‚ðXV
        @weather.type = $game_screen.weather_type
        @weather.max = $game_screen.weather_max
        @weather.update
        # ƒsƒNƒ`ƒƒƒXƒvƒ‰ƒCƒg‚ðXV
        for sprite in @picture_sprites
          sprite.update
        end
        # ƒ^ƒCƒ}[ƒXƒvƒ‰ƒCƒg‚ðXV
        @timer_sprite.update
        # ‰æ–ʂ̐F’²‚ƃVƒFƒCƒNˆÊ’u‚ðÝ’è
        @viewport1.tone = $game_screen.tone
        @viewport1.ox = $game_screen.shake
        # ‰æ–ʂ̃tƒ‰ƒbƒVƒ…F‚ðÝ’è
        @viewport4.color = $game_screen.flash_color
        # ƒrƒ…[ƒ|[ƒg‚ðXV
        @viewport1.update
        @viewport2.update
        @viewport4.update
      end
      #--------------------------------------------------------------------------
      # œ ƒoƒgƒ‹”wŒi‚̐ݒè
      #--------------------------------------------------------------------------
      def make_battleback
        @battleback_name = $game_temp.battleback_name
        if @battleback_sprite.bitmap != nil
          @battleback_sprite.bitmap.dispose
        end
        @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
        if @battleback_sprite.bitmap.width == 640 and
           @battleback_sprite.bitmap.height == 320
          @battleback_sprite.src_rect.set(0, 0, 1280, 640)
          @base_zoom = 2.0
          @battleback_sprite.zoom_x = @base_zoom
          @battleback_sprite.zoom_y = @base_zoom
          @real_y = 4
          @battleback_sprite.x = 320
          @battleback_sprite.y = @real_y
          @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
          @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
        elsif @battleback_sprite.bitmap.width == 640 and
              @battleback_sprite.bitmap.height == 480
          @battleback_sprite.src_rect.set(0, 0, 960, 720)
          @base_zoom = 1.5
          @battleback_sprite.zoom_x = @base_zoom
          @battleback_sprite.zoom_y = @base_zoom
          @battleback_sprite.x = 320
          @battleback_sprite.y = 0
          @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
          @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
        else
          @battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
                                          @battleback_sprite.bitmap.height)
          @base_zoom = 1.0
          @battleback_sprite.zoom_x = @base_zoom
          @battleback_sprite.zoom_y = @base_zoom
          @battleback_sprite.x = 320
          @battleback_sprite.y = 0
          @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
          @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
        end
      end
      #--------------------------------------------------------------------------
      # œ ‰æ–ʂ̃XƒNƒ[ƒ‹–Ú•W‚̈ʒuEŠg‘å—¦Ý’è
      #--------------------------------------------------------------------------
      def screen_target(x, y, zoom)
        return unless $scene.drive
        @wait = $scene.scroll_time
        @target_x = x
        @target_y = y
        @target_zoom = zoom
        screen_over
        @gap_x = @target_x - @real_x
        @gap_y = @target_y - @real_y
        @gap_zoom = @target_zoom - @real_zoom
      end
      #--------------------------------------------------------------------------
      # œ ‰æ–ʂ̃XƒNƒ[ƒ‹
      #--------------------------------------------------------------------------
      def screen_scroll
        if @wait > 0
          @real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
          @real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
          @real_zoom = @target_zoom -
                        @gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
          @battleback_sprite.x = 320 + @real_x
          @battleback_sprite.y = @real_y
          @battleback_sprite.zoom_x = @base_zoom * @real_zoom
          @battleback_sprite.zoom_y = @base_zoom * @real_zoom
          @battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
          @battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
          @wait -= 1
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒNƒŠ[ƒ“‚ª‰æ–ÊŠO‚ɏo‚½Žž‚̕␳ˆ—
      #--------------------------------------------------------------------------
      def screen_over
        width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
        unless 324 + @target_x > width and 324 - @target_x > width
          if 324 + @target_x > width
            @target_x = width - 324
          elsif 324 - @target_x > width
            @target_x = 324 - width
          end
        end
        height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
        unless @target_y > height - 4 and 484 - @target_y > 3 * height
          if @target_y > height - 4
            @target_y = height - 4
          elsif 484 - @target_y > 3 * height
            @target_y = 484 - 3 * height
          end
        end
      end
    end
    
    #==============================================================================
    # ¡ Game_Battler (•ªŠ„’è‹` 1)
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‰[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Actor ƒNƒ‰ƒX‚Æ Game_Enemy ƒNƒ‰
    # ƒX‚̃X[ƒp[ƒNƒ‰ƒX‚Æ‚µ‚ÄŽg—p‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Game_Battler
      #--------------------------------------------------------------------------
      # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”’ljÁ
      #--------------------------------------------------------------------------
      attr_accessor :up_level                  # ƒŒƒxƒ‹ƒAƒbƒv”
      attr_accessor :at                        # ATiƒ^ƒCƒ€ƒQ[ƒWj
      attr_accessor :atp                       # ATi•\Ž¦—pj
      attr_accessor :rt                        # RPi‰r¥ƒQ[ƒWj
      attr_accessor :rtp                       # RPi‰r¥•K—v—ʁj
      attr_accessor :spell                     # ‡¬ƒXƒLƒ‹”­“®’†
      attr_accessor :recover_hp                # HP‰ñ•œ—Ê
      attr_accessor :recover_sp                # SP‰ñ•œ—Ê
      attr_accessor :state_p                   # ƒXƒe[ƒ^ƒXˆÙí”z—ñ
      attr_accessor :state_m                   # ƒXƒe[ƒ^ƒXˆÙí”z—ñ
      attr_accessor :damage_sp                 # SPƒ_ƒ[ƒW•\Ž¦ƒtƒ‰ƒO
      attr_accessor :animation                 # ƒAƒjƒ[ƒVƒ‡ƒ“ ID, Hit‚Ì”z—ñ
      attr_accessor :phase
      attr_accessor :wait
      attr_accessor :target
      attr_accessor :anime1
      attr_accessor :anime2
      attr_accessor :event
      #--------------------------------------------------------------------------
      # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
      #--------------------------------------------------------------------------
      alias :initialize_rtab :initialize
      def initialize
        initialize_rtab
        @damage_pop = {}
        @damage = {}
        @damage_sp = {}
        @critical = {}
        @recover_hp = {}
        @recover_sp = {}
        @state_p = {}
        @state_m = {}
        @animation = []
        @phase = 1
        @wait = 0
        @target = []
        @anime1 = 0
        @anime2 = 0
        @event = 0
      end
      #--------------------------------------------------------------------------
      # œ ‘¶Ý”»’è
      #--------------------------------------------------------------------------
      def exist?
        return (not @hidden and (@hp > 0 or @immortal or @damage_pop.size > 0))
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒe[ƒg‚̉ðœ
      #     state_id : ƒXƒe[ƒg ID
      #     force    : ‹­§‰ðœƒtƒ‰ƒO (ƒI[ƒgƒXƒe[ƒg‚̏ˆ—‚ÅŽg—p)
      #--------------------------------------------------------------------------
      def remove_state(state_id, force = false)
        # ‚±‚̃Xƒe[ƒg‚ª•t‰Á‚³‚ê‚Ä‚¢‚éê‡
        if state?(state_id)
          # ‹­§•t‰Á‚³‚ꂽƒXƒe[ƒg‚ŁA‚©‚Â‰ðœ‚ª‹­§‚Å‚Í‚È‚¢ê‡
          if @states_turn[state_id] == -1 and not force
            # ƒƒ\ƒbƒhI—¹
            return
          end
          # Œ»Ý‚Ì HP ‚ª 0 ‚©‚ ƒIƒvƒVƒ‡ƒ“ [HP 0 ‚̏ó‘Ô‚Æ‚Ý‚È‚·] ‚ª—LŒø‚̏ꍇ
          if @hp == 0 and $data_states[state_id].zero_hp
            # ‚Ù‚©‚É [HP 0 ‚̏ó‘Ô‚Æ‚Ý‚È‚·] ƒXƒe[ƒg‚ª‚ ‚é‚©‚Ç‚¤‚©”»’è
            zero_hp = false
            for i in @states
              if i != state_id and $data_states[i].zero_hp
                zero_hp = true
              end
            end
            # í“¬•s”\‚ð‰ðœ‚µ‚Ă悯‚ê‚΁AHP ‚ð 1 ‚ɕύX
            if zero_hp == false
              @hp = 1
            end
          end
          unless self.movable?
            # ƒXƒe[ƒg ID ‚ð @states ”z—ñ‚¨‚æ‚Ñ @states_turn ƒnƒbƒVƒ…‚©‚çíœ
            @states.delete(state_id)
            @states_turn.delete(state_id)
            if self.movable?
              self.at = 0
            end
          else
            # ƒXƒe[ƒg ID ‚ð @states ”z—ñ‚¨‚æ‚Ñ @states_turn ƒnƒbƒVƒ…‚©‚çíœ
            @states.delete(state_id)
            @states_turn.delete(state_id)
          end
        end
        # HP ‚¨‚æ‚Ñ SP ‚̍őå’lƒ`ƒFƒbƒN
        @hp = [@hp, self.maxhp].min
        @sp = [@sp, self.maxsp].min
      end
      #--------------------------------------------------------------------------
      # œ ’ʏíUŒ‚‚ÌŒø‰Ê“K—p
      #     attacker : UŒ‚ŽÒ (ƒoƒgƒ‰[)
      #--------------------------------------------------------------------------
      def attack_effect(attacker)
        # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
        self.critical[attacker] = false
        state_p[attacker] = []
        state_m[attacker] = []
        # ‘æˆê–½’†”»’è
        hit_result = (rand(100) < attacker.hit)
        # –½’†‚̏ꍇ
        if hit_result == true
          # Šî–{ƒ_ƒ[ƒW‚ðŒvŽZ
          atk = [attacker.atk - self.pdef / 2, 0].max
          self.damage[attacker] = atk * (20 + attacker.str) / 20
          # ‘®«C³
          self.damage[attacker] *= elements_correct(attacker.element_set)
          self.damage[attacker] /= 100
          # ƒ_ƒ[ƒW‚Ì•„†‚ª³‚̏ꍇ
          if self.damage[attacker] > 0
            # ƒNƒŠƒeƒBƒJƒ‹C³
            if rand(100) < 4 * attacker.dex / self.agi
              self.damage[attacker] *= 2
              self.critical[attacker] = true
            end
            # –hŒäC³
            if self.guarding?
              self.damage[attacker] /= 2
            end
          end
          # •ªŽU
          if self.damage[attacker].abs > 0
            amp = [self.damage[attacker].abs * 15 / 100, 1].max
            self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
          end
          # ‘æ“ñ–½’†”»’è
          eva = 8 * self.agi / attacker.dex + self.eva
          hit = self.damage[attacker] < 0 ? 100 : 100 - eva
          hit = self.cant_evade? ? 100 : hit
          hit_result = (rand(100) < hit)
        end
        # –½’†‚̏ꍇ
        if hit_result == true
          # ƒXƒe[ƒgÕŒ‚‰ðœ
          remove_states_shock
          # HP ‚©‚çƒ_ƒ[ƒW‚ðŒ¸ŽZ
          # ƒXƒe[ƒg•Ï‰»
          @state_changed = false
          states_plus(attacker, attacker.plus_state_set)
          states_minus(attacker, attacker.minus_state_set)
        # ƒ~ƒX‚̏ꍇ
        else
          # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
          self.damage[attacker] = "Miss"
          # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
          self.critical[attacker] = false
        end
        # ƒƒ\ƒbƒhI—¹
        return true
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒLƒ‹‚ÌŒø‰Ê“K—p
      #     user  : ƒXƒLƒ‹‚ÌŽg—pŽÒ (ƒoƒgƒ‰[)
      #     skill : ƒXƒLƒ‹
      #--------------------------------------------------------------------------
      def skill_effect(user, skill)
        # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
        self.critical[user] = false
        state_p[user] = []
        state_m[user] = []
        # ƒXƒLƒ‹‚ÌŒø‰Ê”͈͂ª HP 1 ˆÈã‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 0A
        # ‚Ü‚½‚̓XƒLƒ‹‚ÌŒø‰Ê”͈͂ª HP 0 ‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 1 ˆÈã‚̏ꍇ
        if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
           ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
          # ƒƒ\ƒbƒhI—¹
          return false
        end
        # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
        effective = false
        # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
        effective |= skill.common_event_id > 0
        # ‘æˆê–½’†”»’è
        hit = skill.hit
        if skill.atk_f > 0
          hit *= user.hit / 100
        end
        hit_result = (rand(100) < hit)
        # •sŠmŽÀ‚ȃXƒLƒ‹‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
        effective |= hit < 100
        # –½’†‚̏ꍇ
        if hit_result == true
          # ˆÐ—Í‚ðŒvŽZ
          power = skill.power + user.atk * skill.atk_f / 100
          if power > 0
            power -= self.pdef * skill.pdef_f / 200
            power -= self.mdef * skill.mdef_f / 200
            power = [power, 0].max
          end
          # ”{—¦‚ðŒvŽZ
          rate = 20
          rate += (user.str * skill.str_f / 100)
          rate += (user.dex * skill.dex_f / 100)
          rate += (user.agi * skill.agi_f / 100)
          rate += (user.int * skill.int_f / 100)
          # Šî–{ƒ_ƒ[ƒW‚ðŒvŽZ
          self.damage[user] = power * rate / 20
          # ‘®«C³
          self.damage[user] *= elements_correct(skill.element_set)
          self.damage[user] /= 100
          # ƒ_ƒ[ƒW‚Ì•„†‚ª³‚̏ꍇ
          if self.damage[user] > 0
            # –hŒäC³
            if self.guarding?
              self.damage[user] /= 2
            end
          end
          # •ªŽU
          if skill.variance > 0 and self.damage[user].abs > 0
            amp = [self.damage[user].abs * skill.variance / 100, 1].max
            self.damage[user] += rand(amp+1) + rand(amp+1) - amp
          end
          # ‘æ“ñ–½’†”»’è
          eva = 8 * self.agi / user.dex + self.eva
          hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
          hit = self.cant_evade? ? 100 : hit
          hit_result = (rand(100) < hit)
          # •sŠmŽÀ‚ȃXƒLƒ‹‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
          effective |= hit < 100
        end
        # –½’†‚̏ꍇ
        if hit_result == true
          # ˆÐ—Í 0 ˆÈŠO‚Ì•¨—UŒ‚‚̏ꍇ
          if skill.power != 0 and skill.atk_f > 0
            # ƒXƒe[ƒgÕŒ‚‰ðœ
            remove_states_shock
            # —LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
            effective = true
          end
          # HP ‚Ì•Ï“®”»’è
          last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
          # Œø‰Ê”»’è
          effective |= self.hp != last_hp
          # ƒXƒe[ƒg•Ï‰»
          @state_changed = false
          effective |= states_plus(user, skill.plus_state_set)
          effective |= states_minus(user, skill.minus_state_set)
          unless $game_temp.in_battle
            self.damage_effect(user, 1)
          end
          # ˆÐ—Í‚ª 0 ‚̏ꍇ
          if skill.power == 0
            # ƒ_ƒ[ƒW‚ɋ󕶎š—ñ‚ðÝ’è
            self.damage[user] = ""
            # ƒXƒe[ƒg‚ɕω»‚ª‚È‚¢ê‡
            unless @state_changed
              # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
              self.damage[user] = "Miss"
            end
          end
        # ƒ~ƒX‚̏ꍇ
        else
          # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
          self.damage[user] = "Miss"
        end
        # í“¬’†‚Å‚È‚¢ê‡
        unless $game_temp.in_battle
          # ƒ_ƒ[ƒW‚É nil ‚ðÝ’è
          self.damage[user] = nil
        end
        # ƒƒ\ƒbƒhI—¹
        return effective
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒCƒeƒ€‚ÌŒø‰Ê“K—p
      #     item : ƒAƒCƒeƒ€
      #--------------------------------------------------------------------------
      def item_effect(item, user = $game_party.actors[0])
        # ƒNƒŠƒeƒBƒJƒ‹ƒtƒ‰ƒO‚ðƒNƒŠƒA
        self.critical[user] = false
        state_p[user] = []
        state_m[user] = []
        self.recover_hp[user] = 0
        self.recover_sp[user] = 0
        # ƒAƒCƒeƒ€‚ÌŒø‰Ê”͈͂ª HP 1 ˆÈã‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 0A
        # ‚Ü‚½‚̓AƒCƒeƒ€‚ÌŒø‰Ê”͈͂ª HP 0 ‚Ì–¡•û‚ŁAŽ©•ª‚Ì HP ‚ª 1 ˆÈã‚̏ꍇ
        if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
           ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
          # ƒƒ\ƒbƒhI—¹
          return false
        end
        # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
        effective = false
        # ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ª—LŒø‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
        effective |= item.common_event_id > 0
        # –½’†”»’è
        hit_result = (rand(100) < item.hit)
        # •sŠmŽÀ‚ȃXƒLƒ‹‚̏ꍇ‚Í—LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
        effective |= item.hit < 100
        # –½’†‚̏ꍇ
        if hit_result == true
          # ‰ñ•œ—Ê‚ðŒvŽZ
          self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
                                  item.recover_hp
          self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
                                  item.recover_sp
          if self.recover_hp[user] < 0
            self.recover_hp[user] += self.pdef * item.pdef_f / 20
            self.recover_hp[user] += self.mdef * item.mdef_f / 20
            self.recover_hp[user] = [self.recover_hp[user], 0].min
          end
          # ‘®«C³
          self.recover_hp[user] *= elements_correct(item.element_set)
          self.recover_hp[user] /= 100
          self.recover_sp[user] *= elements_correct(item.element_set)
          self.recover_sp[user] /= 100
          # •ªŽU
          if item.variance > 0 and self.recover_hp[user].abs > 0
            amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
            self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
          end
          if item.variance > 0 and self.recover_sp[user].abs > 0
            amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
            self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
          end
          # ‰ñ•œ—Ê‚Ì•„†‚ª•‰‚̏ꍇ
          if self.recover_hp[user] < 0
            # –hŒäC³
            if self.guarding?
              self.recover_hp[user] /= 2
            end
          end
          # HP ‰ñ•œ—Ê‚Ì•„†‚𔽓]‚µAƒ_ƒ[ƒW‚Ì’l‚ɐݒè
          self.damage[user] = -self.recover_hp[user]
          # HP ‚¨‚æ‚Ñ SP ‚Ì•Ï“®”»’è
          last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
          last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
          effective |= self.hp != last_hp
          effective |= self.sp != last_sp
          # ƒXƒe[ƒg•Ï‰»
          @state_changed = false
          effective |= states_plus(user, item.plus_state_set)
          effective |= states_minus(user, item.minus_state_set)
          unless $game_temp.in_battle
            self.damage_effect(user, 2)
          end
          # ƒpƒ‰ƒ[ƒ^ã¸’l‚ª—LŒø‚̏ꍇ
          if item.parameter_type > 0 and item.parameter_points != 0
            # ƒpƒ‰ƒ[ƒ^‚Å•ªŠò
            case item.parameter_type
            when 1  # MaxHP
              @maxhp_plus += item.parameter_points
            when 2  # MaxSP
              @maxsp_plus += item.parameter_points
            when 3  # ˜r—Í
              @str_plus += item.parameter_points
            when 4  # Ší—p‚³
              @dex_plus += item.parameter_points
            when 5  # ‘f‘‚³
              @agi_plus += item.parameter_points
            when 6  # –‚—Í
              @int_plus += item.parameter_points
            end
            # —LŒøƒtƒ‰ƒO‚ðƒZƒbƒg
            effective = true
          end
          # HP ‰ñ•œ—¦‚Ɖñ•œ—Ê‚ª 0 ‚̏ꍇ
          if item.recover_hp_rate == 0 and item.recover_hp == 0
            # ƒ_ƒ[ƒW‚ɋ󕶎š—ñ‚ðÝ’è
            self.damage[user] = ""
            # SP ‰ñ•œ—¦‚Ɖñ•œ—Ê‚ª 0Aƒpƒ‰ƒ[ƒ^ã¸’l‚ª–³Œø‚̏ꍇ
            if item.recover_sp_rate == 0 and item.recover_sp == 0 and
               (item.parameter_type == 0 or item.parameter_points == 0)
              # ƒXƒe[ƒg‚ɕω»‚ª‚È‚¢ê‡
              unless @state_changed
                # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
                self.damage[user] = "Miss"
              end
            end
          end
        # ƒ~ƒX‚̏ꍇ
        else
          # ƒ_ƒ[ƒW‚É "Miss" ‚ðÝ’è
          self.damage[user] = "Miss"
        end
        # í“¬’†‚Å‚È‚¢ê‡
        unless $game_temp.in_battle
          # ƒ_ƒ[ƒW‚É nil ‚ðÝ’è
          self.damage[user] = nil
        end
        # ƒƒ\ƒbƒhI—¹
        return effective
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒe[ƒg•Ï‰» (+) ‚Ì“K—p
      #     plus_state_set  : ƒXƒe[ƒg•Ï‰» (+)
      #--------------------------------------------------------------------------
      def states_plus(battler, plus_state_set)
        # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
        effective = false
        # ƒ‹[ƒv (•t‰Á‚·‚éƒXƒe[ƒg)
        for i in plus_state_set
          # ‚±‚̃Xƒe[ƒg‚ª–hŒä‚³‚ê‚Ä‚¢‚È‚¢ê‡
          unless self.state_guard?(i)
            # ‚±‚̃Xƒe[ƒg‚ªƒtƒ‹‚Å‚È‚¯‚ê‚ΗLŒøƒtƒ‰ƒO‚ðƒZƒbƒg
            effective |= self.state_full?(i) == false
            # ƒXƒe[ƒg‚ª [’ïR‚µ‚È‚¢] ‚̏ꍇ
            if $data_states[i].nonresistance
              # ƒXƒe[ƒg•Ï‰»ƒtƒ‰ƒO‚ðƒZƒbƒg
              @state_changed = true
              # ƒXƒe[ƒg‚ð•t‰Á
              add_state(i)
            # ‚±‚̃Xƒe[ƒg‚ªƒtƒ‹‚Å‚Í‚È‚¢ê‡
            elsif self.state_full?(i) == false
              # ƒXƒe[ƒg—LŒø“x‚ðŠm—¦‚É•ÏŠ·‚µA—”‚Æ”äŠr
              if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
                # ƒXƒe[ƒg•Ï‰»ƒtƒ‰ƒO‚ðƒZƒbƒg
                @state_changed = true
                # ƒXƒe[ƒg‚ð•t‰Á
                self.state_p[battler].push(i)
              end
            end
          end
        end
        # ƒƒ\ƒbƒhI—¹
        return effective
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒe[ƒg•Ï‰» (-) ‚Ì“K—p
      #     minus_state_set : ƒXƒe[ƒg•Ï‰» (-)
      #--------------------------------------------------------------------------
      def states_minus(battler, minus_state_set)
        # —LŒøƒtƒ‰ƒO‚ðƒNƒŠƒA
        effective = false
        # ƒ‹[ƒv (‰ðœ‚·‚éƒXƒe[ƒg)
        for i in minus_state_set
          # ‚±‚̃Xƒe[ƒg‚ª•t‰Á‚³‚ê‚Ä‚¢‚ê‚ΗLŒøƒtƒ‰ƒO‚ðƒZƒbƒg
          effective |= self.state?(i)
          # ƒXƒe[ƒg•Ï‰»ƒtƒ‰ƒO‚ðƒZƒbƒg
          @state_changed = true
          # ƒXƒe[ƒg‚ð‰ðœ
          self.state_m[battler].push(i)
        end
        # ƒƒ\ƒbƒhI—¹
        return effective
      end
      #--------------------------------------------------------------------------
      # œ ƒ_ƒ[ƒW‰‰ŽZ
      #--------------------------------------------------------------------------
      def damage_effect(battler, item)
        if item == 2
          self.hp += self.recover_hp[battler]
          self.sp += self.recover_sp[battler]
          if self.recover_sp[battler] != 0
            self.damage_sp[battler] = -self.recover_sp[battler]
          end
          self.recover_hp.delete(battler)
          self.recover_sp.delete(battler)
        else
          if self.damage[battler].class != String
            self.hp -= self.damage[battler]
          end
        end
        for i in self.state_p[battler]
          add_state(i)
        end
        for i in self.state_m[battler]
          remove_state(i)
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒŠƒbƒvƒ_ƒ[ƒW‚ÌŒø‰Ê“K—p
      #--------------------------------------------------------------------------
      def slip_damage_effect
        # ƒ_ƒ[ƒW‚ðÝ’è
        self.damage["slip"] = self.maxhp / 10
        # •ªŽU
        if self.damage["slip"].abs > 0
          amp = [self.damage["slip"].abs * 15 / 100, 1].max
          self.damage["slip"] += rand(amp+1) + rand(amp+1) - amp
        end
        # HP ‚©‚çƒ_ƒ[ƒW‚ðŒ¸ŽZ
        self.hp -= self.damage["slip"]
        # ƒƒ\ƒbƒhI—¹
        return true
      end
    end
    
    #==============================================================================
    # ¡ Game_BattleAction
    #------------------------------------------------------------------------------
    # @ƒAƒNƒVƒ‡ƒ“ (í“¬’†‚̍s“®) ‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Battler ƒNƒ‰
    # ƒX‚Ì“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Game_BattleAction
      #--------------------------------------------------------------------------
      # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
      #--------------------------------------------------------------------------
      attr_accessor :spell_id                 # ‡‘Ì–‚–@—pƒXƒLƒ‹ ID
      attr_accessor :force_kind               # Ží•Ê (Šî–{ / ƒXƒLƒ‹ / ƒAƒCƒeƒ€)
      attr_accessor :force_basic              # Šî–{ (UŒ‚ / –hŒä / “¦‚°‚é)
      attr_accessor :force_skill_id           # ƒXƒLƒ‹ ID
      #--------------------------------------------------------------------------
      # œ —LŒø”»’è
      #--------------------------------------------------------------------------
      def valid?
        return (not (@force_kind == 0 and @force_basic == 3))
      end
    end
    
    #==============================================================================
    # ¡ Game_Actor
    #------------------------------------------------------------------------------
    # @ƒAƒNƒ^[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Actors ƒNƒ‰ƒX ($game_actors)
    # ‚Ì“à•”‚ÅŽg—p‚³‚êAGame_Party ƒNƒ‰ƒX ($game_party) ‚©‚ç‚àŽQÆ‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Game_Actor < Game_Battler
      def skill_can_use?(skill_id)
        return super
      end
    end
    
    #==============================================================================
    # ¡ Game_Enemy
    #------------------------------------------------------------------------------
    # @ƒGƒlƒ~[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_Troop ƒNƒ‰ƒX ($game_troop) ‚Ì
    # “à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Game_Enemy < Game_Battler
      #--------------------------------------------------------------------------
      # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
      #--------------------------------------------------------------------------
      attr_accessor :height                  # ‰æ‘œ‚̍‚‚³
      attr_accessor :real_x                  # XÀ•W•â³
      attr_accessor :real_y                  # YÀ•W•â³
      attr_accessor :real_zoom               # Šg‘å—¦
      #--------------------------------------------------------------------------
      # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
      #     troop_id     : ƒgƒ‹[ƒv ID
      #     member_index : ƒgƒ‹[ƒvƒƒ“ƒo[‚̃Cƒ“ƒfƒbƒNƒX
      #--------------------------------------------------------------------------
      def initialize(troop_id, member_index)
        super()
        @troop_id = troop_id
        @member_index = member_index
        troop = $data_troops[@troop_id]
        @enemy_id = troop.members[@member_index].enemy_id
        enemy = $data_enemies[@enemy_id]
        @battler_name = enemy.battler_name
        @battler_hue = enemy.battler_hue
        @hp = maxhp
        @sp = maxsp
        @real_x = 0
        @real_y = 0
        @real_zoom = 1.0
        @fly = 0
        enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
        @hidden = troop.members[@member_index].hidden
        @immortal = troop.members[@member_index].immortal
      end
      alias :true_x :screen_x
      alias :true_y :screen_y
      #--------------------------------------------------------------------------
      # œ ƒoƒgƒ‹‰æ–Ê X À•W‚̎擾
      #--------------------------------------------------------------------------
      def screen_x
        return 320 + (true_x - 320) * @real_zoom + @real_x
      end
      #--------------------------------------------------------------------------
      # œ ƒoƒgƒ‹‰æ–Ê Y À•W‚̎擾
      #--------------------------------------------------------------------------
      def screen_y
        return true_y * @real_zoom + @real_y
      end
      #--------------------------------------------------------------------------
      # œ ƒoƒgƒ‹‰æ–Ê Z À•W‚̎擾
      #--------------------------------------------------------------------------
      def screen_z
        return true_y + @fly
      end
      #--------------------------------------------------------------------------
      # œ ƒoƒgƒ‹‰æ–Ê Šg‘å—¦‚̎擾
      #--------------------------------------------------------------------------
      def zoom
        return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
                              (true_y + @fly) / 320 + $scene.zoom_rate[0]
      end
      #--------------------------------------------------------------------------
      # œ UŒ‚—pAƒoƒgƒ‹‰æ–Ê X À•W‚̎擾
      #--------------------------------------------------------------------------
      def attack_x(z)
        return (320 - true_x) * z * 0.75
      end
      #--------------------------------------------------------------------------
      # œ UŒ‚—pAƒoƒgƒ‹‰æ–Ê Y À•W‚̎擾
      #--------------------------------------------------------------------------
      def attack_y(z)
        return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒVƒ‡ƒ“ì¬
      #--------------------------------------------------------------------------
      def make_action
        # ƒJƒŒƒ“ƒgƒAƒNƒVƒ‡ƒ“‚ðƒNƒŠƒA
        self.current_action.clear
        # “®‚¯‚È‚¢ê‡
        unless self.inputable?
          # ƒƒ\ƒbƒhI—¹
          return
        end
        # Œ»Ý—LŒø‚ȃAƒNƒVƒ‡ƒ“‚𒊏o
        available_actions = []
        rating_max = 0
        for action in self.actions
          # ƒ^[ƒ“ ðŒŠm”F
          n = $game_temp.battle_turn
          a = action.condition_turn_a
          b = action.condition_turn_b
          if (b == 0 and n != a) or
             (b > 0 and (n < 1 or n < a or n % b != a % b))
            next
          end
          # HP ðŒŠm”F
          if self.hp * 100.0 / self.maxhp > action.condition_hp
            next
          end
          # ƒŒƒxƒ‹ ðŒŠm”F
          if $game_party.max_level < action.condition_level
            next
          end
          # ƒXƒCƒbƒ` ðŒŠm”F
          switch_id = action.condition_switch_id
          if switch_id > 0 and $game_switches[switch_id] == false
            next
          end
          # ƒXƒLƒ‹Žg—p‰Â”\ ðŒŠm”F
          if action.kind == 1
            unless self.skill_can_use?(action.skill_id)
              next
            end
          end
          # ðŒ‚ÉŠY“– : ‚±‚̃AƒNƒVƒ‡ƒ“‚ð’ljÁ
          available_actions.push(action)
          if action.rating > rating_max
            rating_max = action.rating
          end
        end
        # Å‘å‚̃Œ[ƒeƒBƒ“ƒO’l‚ð 3 ‚Æ‚µ‚č‡Œv‚ðŒvŽZ (0 ˆÈ‰º‚͏œŠO)
        ratings_total = 0
        for action in available_actions
          if action.rating > rating_max - 3
            ratings_total += action.rating - (rating_max - 3)
          end
        end
        # ƒŒ[ƒeƒBƒ“ƒO‚̍‡Œv‚ª 0 ‚Å‚Í‚È‚¢ê‡
        if ratings_total > 0
          # —”‚ðì¬
          value = rand(ratings_total)
          # ì¬‚µ‚½—”‚ɑΉž‚·‚é‚à‚Ì‚ðƒJƒŒƒ“ƒgƒAƒNƒVƒ‡ƒ“‚ɐݒè
          for action in available_actions
            if action.rating > rating_max - 3
              if value < action.rating - (rating_max - 3)
                self.current_action.kind = action.kind
                self.current_action.basic = action.basic
                self.current_action.skill_id = action.skill_id
                self.current_action.decide_random_target_for_enemy
                return
              else
                value -= action.rating - (rating_max - 3)
              end
            end
          end
        end
      end
    end
    
    #==============================================================================
    # ¡ Game_Party
    #------------------------------------------------------------------------------
    # @ƒp[ƒeƒB‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·BƒS[ƒ‹ƒh‚âƒAƒCƒeƒ€‚Ȃǂ̏î•ñ‚ªŠÜ‚Ü‚ê‚Ü‚·B‚±‚̃N
    # ƒ‰ƒX‚̃Cƒ“ƒXƒ^ƒ“ƒX‚Í $game_party ‚ÅŽQÆ‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Game_Party
      #--------------------------------------------------------------------------
      # œ ‘S–Å”»’è
      #--------------------------------------------------------------------------
      def all_dead?
        # ƒp[ƒeƒBl”‚ª 0 l‚̏ꍇ
        if $game_party.actors.size == 0
          return false
        end
        # HP 0 ˆÈã‚̃AƒNƒ^[‚ªƒp[ƒeƒB‚É‚¢‚éê‡
        for actor in @actors
          if actor.hp > 0 or actor.damage.size > 0
            return false
          end
        end
        # ‘S–Å
        return true
      end
    end
    
    #==============================================================================
    # ¡ Sprite_Battler
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‰[•\Ž¦—p‚̃Xƒvƒ‰ƒCƒg‚Å‚·BGame_Battler ƒNƒ‰ƒX‚̃Cƒ“ƒXƒ^ƒ“ƒX‚ðŠÄŽ‹‚µA
    # ƒXƒvƒ‰ƒCƒg‚̏ó‘Ô‚ðŽ©“®“I‚ɕω»‚³‚¹‚Ü‚·B
    #==============================================================================
    
    class Sprite_Battler < RPG::Sprite
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV
      #--------------------------------------------------------------------------
      def update
        super
        # ƒoƒgƒ‰[‚ª nil ‚̏ꍇ
        if @battler == nil
          self.bitmap = nil
          loop_animation(nil)
          return
        end
        # ƒtƒ@ƒCƒ‹–¼‚©F‘Š‚ªŒ»Ý‚Ì‚à‚̂ƈقȂéê‡
        if @battler.battler_name != @battler_name or
           @battler.battler_hue != @battler_hue
          # ƒrƒbƒgƒ}ƒbƒv‚ðŽæ“¾AÝ’è
          @battler_name = @battler.battler_name
          @battler_hue = @battler.battler_hue
          self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
          @width = bitmap.width
          @height = bitmap.height
          self.ox = @width / 2
          self.oy = @height
          if @battler.is_a?(Game_Enemy)
            @battler.height = @height
          end
          # í“¬•s”\‚Ü‚½‚͉B‚êó‘Ô‚È‚ç•s“§–¾“x‚ð 0 ‚É‚·‚é
          if @battler.dead? or @battler.hidden
            self.opacity = 0
          end
        end
        # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ªŒ»Ý‚Ì‚à‚̂ƈقȂéê‡
        if @battler.state_animation_id != @state_animation_id
          @state_animation_id = @battler.state_animation_id
          loop_animation($data_animations[@state_animation_id])
        end
        # •\Ž¦‚³‚ê‚é‚ׂ«ƒAƒNƒ^[‚̏ꍇ
        if @battler.is_a?(Game_Actor) and @battler_visible
          # ƒƒCƒ“ƒtƒF[ƒY‚Å‚È‚¢‚Æ‚«‚Í•s“§–¾“x‚ð‚â‚≺‚°‚é
          if $game_temp.battle_main_phase
            self.opacity += 3 if self.opacity < 255
          else
            self.opacity -= 3 if self.opacity > 207
          end
        end
        # –¾–Å
        if @battler.blink
          blink_on
        else
          blink_off
        end
        # •s‰ÂŽ‹‚̏ꍇ
        unless @battler_visible
          # oŒ»
          if not @battler.hidden and not @battler.dead? and
             (@battler.damage.size < 2 or @battler.damage_pop.size < 2)
            appear
            @battler_visible = true
          end
        end
        # ƒ_ƒ[ƒW
        for battler in @battler.damage_pop
          if battler[0].class == Array
            if battler[0][1] >= 0
              $scene.skill_se
            else
              $scene.levelup_se
            end
            damage(@battler.damage[battler[0]], false, 2)
          else
            damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
          end
          if @battler.damage_sp.include?(battler[0])
            damage(@battler.damage_sp[battler[0]],
                    @battler.critical[battler[0]], 1)
            @battler.damage_sp.delete(battler[0])
          end
          @battler.damage_pop.delete(battler[0])
          @battler.damage.delete(battler[0])
          @battler.critical.delete(battler[0])
        end
        # ‰ÂŽ‹‚̏ꍇ
        if @battler_visible
          # “¦‘–
          if @battler.hidden
            $game_system.se_play($data_system.escape_se)
            escape
            @battler_visible = false
          end
          # ”’ƒtƒ‰ƒbƒVƒ…
          if @battler.white_flash
            whiten
            @battler.white_flash = false
          end
          # ƒAƒjƒ[ƒVƒ‡ƒ“
          unless @battler.animation.empty?
            for animation in @battler.animation.reverse
              animation($data_animations[animation[0]], animation[1])
              @battler.animation.delete(animation)
            end
          end
          # ƒRƒ‰ƒvƒX
          if @battler.damage.empty? and @battler.dead?
            if $scene.dead_ok?(@battler)
              if @battler.is_a?(Game_Enemy)
                $game_system.se_play($data_system.enemy_collapse_se)
              else
                $game_system.se_play($data_system.actor_collapse_se)
              end
              collapse
              @battler_visible = false
            end
          end
        end
        # ƒXƒvƒ‰ƒCƒg‚̍À•W‚ðÝ’è
        self.x = @battler.screen_x
        self.y = @battler.screen_y
        self.z = @battler.screen_z
        if @battler.is_a?(Game_Enemy)
          self.zoom_x = @battler.real_zoom * @battler.zoom
          self.zoom_y = @battler.real_zoom * @battler.zoom
        end
      end
    end
    
    #==============================================================================
    # ¡ Window_Base
    #------------------------------------------------------------------------------
    # @ƒQ[ƒ€’†‚Ì‚·‚ׂẴEƒBƒ“ƒhƒE‚̃X[ƒp[ƒNƒ‰ƒX‚Å‚·B
    #==============================================================================
    
    class Window_Base < Window
      #--------------------------------------------------------------------------
      # œ ƒQ[ƒW‚Ì•`‰æ
      #--------------------------------------------------------------------------
      def gauge_rect_at(width, height, align3,
                        color1, color2, color3, color4, color5, color6, color7,
                        color8, color9, color10, color11, color12, grade1, grade2)
        # ˜g•`‰æ
        @at_gauge = Bitmap.new(width, height * 5)
        @at_gauge.fill_rect(0, 0, width, height, color1)
        @at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
        if (align3 == 1 and grade1 == 0) or grade1 > 0
          color = color3
          color3 = color4
          color4 = color
        end
        if (align3 == 1 and grade2 == 0) or grade2 > 0
          color = color5
          color5 = color6
          color6 = color
          color = color7
          color7 = color8
          color8 = color
          color = color9
          color9 = color10
          color10 = color
          color = color11
          color11 = color12
          color12 = color
        end
        if align3 == 0
          if grade1 == 2
            grade1 = 3
          end
          if grade2 == 2
            grade2 = 3
          end
        end
        # ‹óƒQ[ƒW‚Ì•`‰æ c‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“•\Ž¦
        @at_gauge.gradation_rect(2, 2, width - 4, height - 4,
                                      color3, color4, grade1)
        # ŽÀƒQ[ƒW‚Ì•`‰æ
        @at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
                                      color5, color6, grade2)
        @at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
                                      color7, color8, grade2)
        @at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
                                      color9, color10, grade2)
        @at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
                                      color11, color12, grade2)
      end
    end
    
    #==============================================================================
    # ¡ Window_Help
    #------------------------------------------------------------------------------
    # @ƒXƒLƒ‹‚âƒAƒCƒeƒ€‚Ìà–¾AƒAƒNƒ^[‚̃Xƒe[ƒ^ƒX‚È‚Ç‚ð•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
    #==============================================================================
    
    class Window_Help < Window_Base
      #--------------------------------------------------------------------------
      # œ ƒGƒlƒ~[Ý’è
      #     enemy : –¼‘O‚ƃXƒe[ƒg‚ð•\Ž¦‚·‚éƒGƒlƒ~[
      #--------------------------------------------------------------------------
      def set_enemy(enemy)
        text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
        state_text = make_battler_state_text(enemy, 112, false)
        if state_text != ""
          text += "  " + state_text
        end
        set_text(text, 1)
      end
    end
    
    #==============================================================================
    # ¡ Window_BattleStatus
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂŃp[ƒeƒBƒƒ“ƒo[‚̃Xƒe[ƒ^ƒX‚ð•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
    #==============================================================================
    
    class Window_BattleStatus < Window_Base
      #--------------------------------------------------------------------------
      # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
      #--------------------------------------------------------------------------
      def initialize
        x = (4 - $game_party.actors.size) * 80
        width = $game_party.actors.size * 160
        super(x, 320, width, 160)
        self.back_opacity = 160
        @actor_window = []
        for i in 0...$game_party.actors.size
          @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
        end
        @level_up_flags = [false, false, false, false]
        refresh
      end
      #--------------------------------------------------------------------------
      # œ ‰ð•ú
      #--------------------------------------------------------------------------
      def dispose
        for window in @actor_window
          window.dispose
        end
        super
      end
      #--------------------------------------------------------------------------
      # œ ƒŠƒtƒŒƒbƒVƒ…
      #--------------------------------------------------------------------------
      def refresh(number = 0)
        if number == 0
          cnt = 0
          for window in @actor_window
            window.refresh(@level_up_flags[cnt])
            cnt += 1
          end
        else
          @actor_window[number - 1].refresh(@level_up_flags[number - 1])
        end
      end
      #--------------------------------------------------------------------------
      # œ ATƒQ[ƒWƒŠƒtƒŒƒbƒVƒ…
      #--------------------------------------------------------------------------
      def at_refresh(number = 0)
        if number == 0
          for window in @actor_window
            window.at_refresh
          end
        else
          @actor_window[number - 1].at_refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV
      #--------------------------------------------------------------------------
      def update
        super
        if self.x != (4 - $game_party.actors.size) * 80
          self.x = (4 - $game_party.actors.size) * 80
          self.width = $game_party.actors.size * 160
          for window in @actor_window
            window.dispose
          end
          @actor_window = []
          for i in 0...$game_party.actors.size
            @actor_window.push(Window_ActorStatus.new(i, x + i * 160))
          end
          refresh
        end
        for window in @actor_window
          window.update
        end
      end
    end
    
    #==============================================================================
    # ¡ Window_ActorStatus
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂŃp[ƒeƒBƒƒ“ƒo[‚̃Xƒe[ƒ^ƒX‚ð‚»‚ê‚¼‚ê•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
    #==============================================================================
    
    class Window_ActorStatus < Window_Base
      #--------------------------------------------------------------------------
      # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
      #--------------------------------------------------------------------------
      def initialize(id, x)
        @actor_num = id
        super(x, 320, 160, 160)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.opacity = 0
        self.back_opacity = 0
        actor = $game_party.actors[@actor_num]
        @actor_nm = actor.name
        @actor_mhp = actor.maxhp
        @actor_msp = actor.maxsp
        @actor_hp = actor.hp
        @actor_sp = actor.sp
        @actor_st = make_battler_state_text(actor, 120, true)
        @status_window = []
        for i in 0...5
          @status_window.push(Window_DetailsStatus.new(actor, i, x))
        end
        refresh(false)
      end
      #--------------------------------------------------------------------------
      # œ ‰ð•ú
      #--------------------------------------------------------------------------
      def dispose
        for i in 0...5
          @status_window[i].dispose
        end
        super
      end
      #--------------------------------------------------------------------------
      # œ ƒŠƒtƒŒƒbƒVƒ…
      #--------------------------------------------------------------------------
      def refresh(level_up_flags)
        self.contents.clear
        actor = $game_party.actors[@actor_num]
        @status_window[0].refresh(actor) if @actor_nm != actor.name
        @status_window[1].refresh(actor) if
          @actor_mhp != actor.maxhp or @actor_hp != actor.hp
        @status_window[2].refresh(actor) if
          @actor_msp != actor.maxsp or @actor_sp != actor.sp
        @status_window[3].refresh(actor, level_up_flags) if
          @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
        @actor_nm = actor.name
        @actor_mhp = actor.maxhp
        @actor_msp = actor.maxsp
        @actor_hp = actor.hp
        @actor_sp = actor.sp
        @actor_st = make_battler_state_text(actor, 120, true)
      end
      #--------------------------------------------------------------------------
      # œ ATƒQ[ƒWƒŠƒtƒŒƒbƒVƒ…
      #--------------------------------------------------------------------------
      def at_refresh
        @status_window[4].refresh($game_party.actors[@actor_num])
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV
      #--------------------------------------------------------------------------
      def update
        for window in @status_window
          window.update
        end
      end
    end
    
    #==============================================================================
    # ¡ Window_DetailsStatus
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–ʂŃAƒNƒ^[‚̃Xƒe[ƒ^ƒX‚ðŒÂX‚É•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
    #==============================================================================
    
    class Window_DetailsStatus < Window_Base
      #--------------------------------------------------------------------------
      # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
      #--------------------------------------------------------------------------
      def initialize(actor, id, x)
        @status_id = id
        super(x, 320 + id * 26, 160, 64)
        self.contents = Bitmap.new(width - 32, height - 32)
        self.opacity = 0
        self.back_opacity = 0
        refresh(actor, false)
      end
      #--------------------------------------------------------------------------
      # œ ‰ð•ú
      #--------------------------------------------------------------------------
      def dispose
        super
      end
      #--------------------------------------------------------------------------
      # œ ƒŠƒtƒŒƒbƒVƒ…
      #--------------------------------------------------------------------------
      def refresh(actor, level_up_flags = false)
        self.contents.clear
        case @status_id
        when 0
          draw_actor_name(actor, 4, 0)
        when 1
          draw_actor_hp(actor, 4, 0, 120)
        when 2
          draw_actor_sp(actor, 4, 0, 120)
        when 3
          if level_up_flags
            self.contents.font.color = normal_color
            self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
          else
            draw_actor_state(actor, 4, 0)
          end
        when 4
          draw_actor_atg(actor, 4, 0, 120)
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV
      #--------------------------------------------------------------------------
      def update
        # ƒƒCƒ“ƒtƒF[ƒY‚Ì‚Æ‚«‚Í•s“§–¾“x‚ð‚â‚≺‚°‚é
        if $game_temp.battle_main_phase
          self.contents_opacity -= 4 if self.contents_opacity > 191
        else
          self.contents_opacity += 4 if self.contents_opacity < 255
        end
      end
    end
    
    #==============================================================================
    # ¡ Arrow_Base
    #------------------------------------------------------------------------------
    # @ƒoƒgƒ‹‰æ–Ê‚ÅŽg—p‚·‚éƒAƒ[ƒJ[ƒ\ƒ‹•\Ž¦—p‚̃Xƒvƒ‰ƒCƒg‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í
    # Arrow_Enemy ƒNƒ‰ƒX‚Æ Arrow_Actor ƒNƒ‰ƒX‚̃X[ƒp[ƒNƒ‰ƒX‚Æ‚µ‚ÄŽg—p‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Arrow_Base < Sprite
      #--------------------------------------------------------------------------
      # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
      #     viewport : ƒrƒ…[ƒ|[ƒg
      #--------------------------------------------------------------------------
      def initialize(viewport)
        super(viewport)
        self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
        self.ox = 16
        self.oy = 32
        self.z = 2500
        @blink_count = 0
        @index = 0
        @help_window = nil
        update
      end
    end
    
    #==============================================================================
    # ¡ Arrow_Enemy
    #------------------------------------------------------------------------------
    # @ƒGƒlƒ~[‚ð‘I‘ð‚³‚¹‚邽‚߂̃Aƒ[ƒJ[ƒ\ƒ‹‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Arrow_Base ƒNƒ‰
    # ƒX‚ðŒp³‚µ‚Ü‚·B
    #==============================================================================
    
    class Arrow_Enemy < Arrow_Base
      #--------------------------------------------------------------------------
      # œ ƒtƒŒ[ƒ€XV
      #--------------------------------------------------------------------------
      def update
        super
        # ‘¶Ý‚µ‚È‚¢ƒGƒlƒ~[‚ðŽw‚µ‚Ä‚¢‚½‚ç”ò‚΂·
        $game_troop.enemies.size.times do
          break if self.enemy.exist?
          @index += 1
          @index %= $game_troop.enemies.size
        end
        # ƒJ[ƒ\ƒ‹‰E
        if Input.repeat?(Input::RIGHT)
          $game_system.se_play($data_system.cursor_se)
          $game_troop.enemies.size.times do
            @index += 1
            @index %= $game_troop.enemies.size
            break if self.enemy.exist?
          end
          $scene.camera = "select"
          zoom = 1 / self.enemy.zoom
          $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
                                          self.enemy.attack_y(zoom) * 0.75, zoom)
        end
        # ƒJ[ƒ\ƒ‹¶
        if Input.repeat?(Input::LEFT)
          $game_system.se_play($data_system.cursor_se)
          $game_troop.enemies.size.times do
            @index += $game_troop.enemies.size - 1
            @index %= $game_troop.enemies.size
            break if self.enemy.exist?
          end
          $scene.camera = "select"
          zoom = 1 / self.enemy.zoom
          $scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
                                          self.enemy.attack_y(zoom) * 0.75, zoom)
        end
        # ƒXƒvƒ‰ƒCƒg‚̍À•W‚ðÝ’è
        if self.enemy != nil
          self.x = self.enemy.screen_x
          self.y = self.enemy.screen_y
        end
      end
    end
    
    #==============================================================================
    # ¡ Interpreter
    #------------------------------------------------------------------------------
    # @ƒCƒxƒ“ƒgƒRƒ}ƒ“ƒh‚ðŽÀs‚·‚éƒCƒ“ƒ^ƒvƒŠƒ^‚Å‚·B‚±‚̃Nƒ‰ƒX‚Í Game_System ƒNƒ‰
    # ƒX‚â Game_Event ƒNƒ‰ƒX‚Ì“à•”‚ÅŽg—p‚³‚ê‚Ü‚·B
    #==============================================================================
    
    class Interpreter
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒ^[‚Ì“ü‚ê‘Ö‚¦
      #--------------------------------------------------------------------------
      def command_129
        # ƒAƒNƒ^[‚ðŽæ“¾
        actor = $game_actors[@parameters[0]]
        # ƒAƒNƒ^[‚ª—LŒø‚̏ꍇ
        if actor != nil
          # ‘€ì‚Å•ªŠò
          if @parameters[1] == 0
            if @parameters[2] == 1
              $game_actors[@parameters[0]].setup(@parameters[0])
            end
            $game_party.add_actor(@parameters[0])
            if $game_temp.in_battle
              $game_actors[@parameters[0]].at = 0
              $game_actors[@parameters[0]].atp = 0
              $scene.spell_reset($game_actors[@parameters[0]])
              $game_actors[@parameters[0]].damage_pop = {}
              $game_actors[@parameters[0]].damage = {}
              $game_actors[@parameters[0]].damage_sp = {}
              $game_actors[@parameters[0]].critical = {}
              $game_actors[@parameters[0]].recover_hp = {}
              $game_actors[@parameters[0]].recover_sp = {}
              $game_actors[@parameters[0]].state_p = {}
              $game_actors[@parameters[0]].state_m = {}
              $game_actors[@parameters[0]].animation = []
            end
          else
            $game_party.remove_actor(@parameters[0])
          end
        end
        if $game_temp.in_battle
          $scene.status_window.update
        end
        # Œp‘±
        return true
      end
      #--------------------------------------------------------------------------
      # œ HP ‚Ì‘Œ¸
      #--------------------------------------------------------------------------
      alias :command_311_rtab :command_311
      def command_311
        command_311_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ SP ‚Ì‘Œ¸
      #--------------------------------------------------------------------------
      alias :command_312_rtab :command_312
      def command_312
        command_312_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒXƒe[ƒg‚̕ύX
      #--------------------------------------------------------------------------
      alias :command_313_rtab :command_313
      def command_313
        command_313_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ‘S‰ñ•œ
      #--------------------------------------------------------------------------
      alias :command_314_rtab :command_314
      def command_314
        command_314_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ EXP ‚Ì‘Œ¸
      #--------------------------------------------------------------------------
      alias :command_315_rtab :command_315
      def command_315
        command_315_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒŒƒxƒ‹‚Ì‘Œ¸
      #--------------------------------------------------------------------------
      alias :command_316_rtab :command_316
      def command_316
        command_316_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒpƒ‰ƒ[ƒ^‚Ì‘Œ¸
      #--------------------------------------------------------------------------
      alias :command_317_rtab :command_317
      def command_317
        command_317_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ‘•”õ‚̕ύX
      #--------------------------------------------------------------------------
      alias :command_319_rtab :command_319
      def command_319
        command_319_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒ^[‚Ì–¼‘O•ÏX
      #--------------------------------------------------------------------------
      alias :command_320_rtab :command_320
      def command_320
        command_320_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒ^[‚̃Nƒ‰ƒX•ÏX
      #--------------------------------------------------------------------------
      alias :command_321_rtab :command_321
      def command_321
        command_321_rtab
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒjƒ[ƒVƒ‡ƒ“‚Ì•\Ž¦
      #--------------------------------------------------------------------------
      def command_337
        # ƒCƒeƒŒ[ƒ^‚ŏˆ—
        iterate_battler(@parameters[0], @parameters[1]) do |battler|
          # ƒoƒgƒ‰[‚ª‘¶Ý‚·‚éê‡
          if battler.exist?
            # ƒAƒjƒ[ƒVƒ‡ƒ“ ID ‚ðÝ’è
            battler.animation.push([@parameters[2], true])
          end
        end
        # Œp‘±
        return true
      end
      #--------------------------------------------------------------------------
      # œ ƒ_ƒ[ƒW‚̏ˆ—
      #--------------------------------------------------------------------------
      def command_338
        # ‘€ì‚·‚é’l‚ðŽæ“¾
        value = operate_value(0, @parameters[2], @parameters[3])
        # ƒCƒeƒŒ[ƒ^‚ŏˆ—
        iterate_battler(@parameters[0], @parameters[1]) do |battler|
          # ƒoƒgƒ‰[‚ª‘¶Ý‚·‚éê‡
          if battler.exist?
            # HP ‚ð•ÏX
            battler.hp -= value
            # í“¬’†‚È‚ç
            if $game_temp.in_battle
              # ƒ_ƒ[ƒW‚ðÝ’è
              battler.damage["event"] = value
              battler.damage_pop["event"] = true
            end
          end
        end
        if $game_temp.in_battle
          $scene.status_window.refresh
        end
        # Œp‘±
        return true
      end
      #--------------------------------------------------------------------------
      # œ ƒAƒNƒVƒ‡ƒ“‚Ì‹­§
      #--------------------------------------------------------------------------
      def command_339
        # í“¬’†‚Å‚È‚¯‚ê‚Ζ³Ž‹
        unless $game_temp.in_battle
          return true
        end
        # ƒ^[ƒ“”‚ª 0 ‚È‚ç–³Ž‹
        if $game_temp.battle_turn == 0
          return true
        end
        # ƒCƒeƒŒ[ƒ^‚ŏˆ— (•Ö‹X“I‚È‚à‚̂ŁA•¡”‚ɂȂ邱‚Æ‚Í‚È‚¢)
        iterate_battler(@parameters[0], @parameters[1]) do |battler|
          # ƒoƒgƒ‰[‚ª‘¶Ý‚·‚éê‡
          if battler.exist?
            # ƒAƒNƒVƒ‡ƒ“‚ðÝ’è
            battler.current_action.force_kind = @parameters[2]
            if battler.current_action.force_kind == 0
              battler.current_action.force_basic = @parameters[3]
            else
              battler.current_action.force_skill_id = @parameters[3]
            end
            # s“®‘ΏۂðÝ’è
            if @parameters[4] == -2
              if battler.is_a?(Game_Enemy)
                battler.current_action.decide_last_target_for_enemy
              else
                battler.current_action.decide_last_target_for_actor
              end
            elsif @parameters[4] == -1
              if battler.is_a?(Game_Enemy)
                battler.current_action.decide_random_target_for_enemy
              else
                battler.current_action.decide_random_target_for_actor
              end
            elsif @parameters[4] >= 0
              battler.current_action.target_index = @parameters[4]
            end
            # ƒAƒNƒVƒ‡ƒ“‚ª—LŒø‚©‚ [‚·‚®‚ÉŽÀs] ‚̏ꍇ
            if battler.current_action.valid? and @parameters[5] == 1
              # ‹­§‘Ώۂ̃oƒgƒ‰[‚ðÝ’è
              $game_temp.forcing_battler = battler
              # ƒCƒ“ƒfƒbƒNƒX‚ði‚ß‚é
              @index += 1
              # I—¹
              return false
            elsif battler.current_action.valid? and @parameters[5] == 0
              battler.current_action.forcing = true
            end
          end
        end
        # Œp‘±
        return true
      end
    end
    
    #==============================================================================
    # ¡ Spriteƒ‚ƒWƒ…[ƒ‹
    #------------------------------------------------------------------------------
    # @ƒAƒjƒ[ƒVƒ‡ƒ“‚ÌŠÇ—‚ðs‚¤ƒ‚ƒWƒ…[ƒ‹‚Å‚·B
    #==============================================================================
    
    module RPG
      class Sprite < ::Sprite
        def initialize(viewport = nil)
          super(viewport)
          @_whiten_duration = 0
          @_appear_duration = 0
          @_escape_duration = 0
          @_collapse_duration = 0
          @_damage = []
          @_animation = []
          @_animation_duration = 0
          @_blink = false
        end
        def damage(value, critical, type = 0)
          if value.is_a?(Numeric)
            damage_string = value.abs.to_s
          else
            damage_string = value.to_s
          end
          bitmap = Bitmap.new(160, 48)
          bitmap.font.name = "Arial Black"
          bitmap.font.size = 32
          bitmap.font.color.set(0, 0, 0)
          bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
          bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
          bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
          bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
          if value.is_a?(Numeric) and value < 0
            if type == 0
              bitmap.font.color.set(176, 255, 144)
            else
              bitmap.font.color.set(176, 144, 255)
            end
          else
            if type == 0
              bitmap.font.color.set(255, 255, 255)
            else
              bitmap.font.color.set(255, 176, 144)
            end
          end
          if type == 2
            bitmap.font.color.set(255, 224, 128)
          end
          bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
          if critical
            string = "CRITICAL"
            bitmap.font.size = 20
            bitmap.font.color.set(0, 0, 0)
            bitmap.draw_text(-1, -1, 160, 20, string, 1)
            bitmap.draw_text(+1, -1, 160, 20, string, 1)
            bitmap.draw_text(-1, +1, 160, 20, string, 1)
            bitmap.draw_text(+1, +1, 160, 20, string, 1)
            bitmap.font.color.set(255, 255, 255)
            bitmap.draw_text(0, 0, 160, 20, string, 1)
          end
          num = @_damage.size
          if type != 2
            @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
          else
            @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
          end
          @_damage[num][0].bitmap = bitmap
          @_damage[num][0].ox = 80 + self.viewport.ox
          @_damage[num][0].oy = 20 + self.viewport.oy
          if self.battler.is_a?(Game_Actor)
            @_damage[num][0].x = self.x
            @_damage[num][0].y = self.y - self.oy / 2
          else
            @_damage[num][0].x = self.x + self.viewport.rect.x -
                                self.ox + self.src_rect.width / 2
            @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
                                self.viewport.rect.y
            @_damage[num][0].zoom_x = self.zoom_x
            @_damage[num][0].zoom_y = self.zoom_y
            @_damage[num][0].z = 3000
          end
        end
        def animation(animation, hit)
          return if animation == nil
          num = @_animation.size
          @_animation.push([animation, hit, animation.frame_max, []])
          bitmap = RPG::Cache.animation(animation.animation_name,
                                        animation.animation_hue)
          if @@_reference_count.include?(bitmap)
            @@_reference_count[bitmap] += 1
          else
            @@_reference_count[bitmap] = 1
          end
          if @_animation[num][0] != 3 or not @@_animations.include?(animation)
            for i in 0..15
              sprite = ::Sprite.new
              sprite.bitmap = bitmap
              sprite.visible = false
              @_animation[num][3].push(sprite)
            end
            unless @@_animations.include?(animation)
              @@_animations.push(animation)
            end
          end
          update_animation(@_animation[num])
        end
        def loop_animation(animation)
          return if animation == @_loop_animation
          dispose_loop_animation
          @_loop_animation = animation
          return if @_loop_animation == nil
          @_loop_animation_index = 0
          animation_name = @_loop_animation.animation_name
          animation_hue = @_loop_animation.animation_hue
          bitmap = RPG::Cache.animation(animation_name, animation_hue)
          if @@_reference_count.include?(bitmap)
            @@_reference_count[bitmap] += 1
          else
            @@_reference_count[bitmap] = 1
          end
          @_loop_animation_sprites = []
          for i in 0..15
            sprite = ::Sprite.new
            sprite.bitmap = bitmap
            sprite.visible = false
            @_loop_animation_sprites.push(sprite)
          end
          update_loop_animation
        end
        def dispose_damage
          for damage in @_damage.reverse
            damage[0].bitmap.dispose
            damage[0].dispose
            @_damage.delete(damage)
          end
        end
        def dispose_animation
          for anime in @_animation.reverse
            sprite = anime[3][0]
            if sprite != nil
              @@_reference_count[sprite.bitmap] -= 1
              if @@_reference_count[sprite.bitmap] == 0
                sprite.bitmap.dispose
              end
            end
            for sprite in anime[3]
              sprite.dispose
            end
            @_animation.delete(anime)
          end
        end
        def effect?
          @_whiten_duration > 0 or
          @_appear_duration > 0 or
          @_escape_duration > 0 or
          @_collapse_duration > 0 or
          @_damage.size == 0 or
          @_animation.size == 0
        end
        def update
          super
          if @_whiten_duration > 0
            @_whiten_duration -= 1
            self.color.alpha = 128 - (16 - @_whiten_duration) * 10
          end
          if @_appear_duration > 0
            @_appear_duration -= 1
            self.opacity = (16 - @_appear_duration) * 16
          end
          if @_escape_duration > 0
            @_escape_duration -= 1
            self.opacity = 256 - (32 - @_escape_duration) * 10
          end
          if @_collapse_duration > 0
            @_collapse_duration -= 1
            self.opacity = 256 - (48 - @_collapse_duration) * 6
          end
          for damage in @_damage
            if damage[1] > 0
              damage[1] -= 1
              damage[4] -= 3
              damage[2] -= damage[4]
              if self.battler.is_a?(Game_Actor)
                damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
                damage[0].y = self.y - self.oy / 2 + damage[2] / 10
              else
                damage[0].x = self.x + self.viewport.rect.x -
                              self.ox + self.src_rect.width / 2 +
                              (40 - damage[1]) * damage[3] / 10
                damage[0].y = self.y - self.oy * self.zoom_y / 2 +
                              self.viewport.rect.y + damage[2] / 10
                damage[0].zoom_x = self.zoom_x
                damage[0].zoom_y = self.zoom_y
              end
              damage[0].z = 2960 + damage[1]
              damage[0].opacity = 256 - (12 - damage[1]) * 32
              if damage[1] == 0
                damage[0].bitmap.dispose
                damage[0].dispose
                @_damage.delete(damage)
              end
            end
          end
          for anime in @_animation
            if (Graphics.frame_count % 2 == 0)
              anime[2] -= 1
              update_animation(anime)
            end
          end
          if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
            update_loop_animation
            @_loop_animation_index += 1
            @_loop_animation_index %= @_loop_animation.frame_max
          end
          if @_blink
            @_blink_count = (@_blink_count + 1) % 32
            if @_blink_count < 16
              alpha = (16 - @_blink_count) * 6
            else
              alpha = (@_blink_count - 16) * 6
            end
            self.color.set(255, 255, 255, alpha)
          end
          @@_animations.clear
        end
        def update_animation(anime)
          if anime[2] > 0
            frame_index = anime[0].frame_max - anime[2]
            cell_data = anime[0].frames[frame_index].cell_data
            position = anime[0].position
            animation_set_sprites(anime[3], cell_data, position)
            for timing in anime[0].timings
              if timing.frame == frame_index
                animation_process_timing(timing, anime[1])
              end
            end
          else
            @@_reference_count[anime[3][0].bitmap] -= 1
            if @@_reference_count[anime[3][0].bitmap] == 0
                anime[3][0].bitmap.dispose
            end
            for sprite in anime[3]
              sprite.dispose
            end
            @_animation.delete(anime)
          end
        end
        def animation_set_sprites(sprites, cell_data, position)
          for i in 0..15
            sprite = sprites[i]
            pattern = cell_data[i, 0]
            if sprite == nil or pattern == nil or pattern == -1
              sprite.visible = false if sprite != nil
              next
            end
            sprite.visible = true
            sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
            if position == 3
              if self.viewport != nil
                sprite.x = self.viewport.rect.width / 2
                if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
                  sprite.y = self.viewport.rect.height - 320
                else
                  sprite.y = self.viewport.rect.height - 160
                end
              else
                sprite.x = 320
                sprite.y = 240
              end
            else
              sprite.x = self.x + self.viewport.rect.x -
                          self.ox + self.src_rect.width / 2
              if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
                sprite.y = self.y - self.oy * self.zoom_y / 2 +
                            self.viewport.rect.y
                if position == 0
                  sprite.y -= self.src_rect.height * self.zoom_y / 4
                elsif position == 2
                  sprite.y += self.src_rect.height * self.zoom_y / 4
                end
              else
                sprite.y = self.y + self.viewport.rect.y -
                            self.oy + self.src_rect.height / 2
                sprite.y -= self.src_rect.height / 4 if position == 0
                sprite.y += self.src_rect.height / 4 if position == 2
              end
            end
            sprite.x += cell_data[i, 1]
            sprite.y += cell_data[i, 2]
            sprite.z = 2000
            sprite.ox = 96
            sprite.oy = 96
            sprite.zoom_x = cell_data[i, 3] / 100.0
            sprite.zoom_y = cell_data[i, 3] / 100.0
            if position != 3
              sprite.zoom_x *= self.zoom_x
              sprite.zoom_y *= self.zoom_y
            end
            sprite.angle = cell_data[i, 4]
            sprite.mirror = (cell_data[i, 5] == 1)
            sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
            sprite.blend_type = cell_data[i, 7]
          end
        end
        def x=(x)
          sx = x - self.x
          if sx != 0
            for anime in @_animation
              if anime[3] != nil
                for i in 0..15
                  anime[3][i].x += sx
                end
              end
            end
            if @_loop_animation_sprites != nil
              for i in 0..15
                @_loop_animation_sprites[i].x += sx
              end
            end
          end
          super
        end
        def y=(y)
          sy = y - self.y
          if sy != 0
            for anime in @_animation
              if anime[3] != nil
                for i in 0..15
                  anime[3][i].y += sy
                end
              end
            end
            if @_loop_animation_sprites != nil
              for i in 0..15
                @_loop_animation_sprites[i].y += sy
              end
            end
          end
          super
        end
      end
    end
    
    #------------------------------------------------------------------------------
    # @BitmapƒNƒ‰ƒX‚ɐV‚½‚È‹@”\‚ð’ljÁ‚µ‚Ü‚·B
    #==============================================================================
    
    class Bitmap
      #--------------------------------------------------------------------------
      # œ ‹éŒ`‚ðƒOƒ‰ƒf[ƒVƒ‡ƒ“•\Ž¦
      #     color1 : ƒXƒ^[ƒgƒJƒ‰[
      #     color2 : ƒGƒ“ƒhƒJƒ‰[
      #     align  :  0:‰¡‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
      #               1:c‚ɃOƒ‰ƒf[ƒVƒ‡ƒ“
      #               2:ŽÎ‚߂ɃOƒ‰ƒf[ƒVƒ‡ƒ“iŒƒd‚ɂ‚«’ˆÓj
      #--------------------------------------------------------------------------
      def gradation_rect(x, y, width, height, color1, color2, align = 0)
        if align == 0
          for i in x...x + width
            red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
            green = color1.green +
                    (color2.green - color1.green) * (i - x) / (width - 1)
            blue  = color1.blue +
                    (color2.blue - color1.blue) * (i - x) / (width - 1)
            alpha = color1.alpha +
                    (color2.alpha - color1.alpha) * (i - x) / (width - 1)
            color = Color.new(red, green, blue, alpha)
            fill_rect(i, y, 1, height, color)
          end
        elsif align == 1
          for i in y...y + height
            red   = color1.red +
                    (color2.red - color1.red) * (i - y) / (height - 1)
            green = color1.green +
                    (color2.green - color1.green) * (i - y) / (height - 1)
            blue  = color1.blue +
                    (color2.blue - color1.blue) * (i - y) / (height - 1)
            alpha = color1.alpha +
                    (color2.alpha - color1.alpha) * (i - y) / (height - 1)
            color = Color.new(red, green, blue, alpha)
            fill_rect(x, i, width, 1, color)
          end
        elsif align == 2
          for i in x...x + width
            for j in y...y + height
              red   = color1.red + (color2.red - color1.red) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              green = color1.green + (color2.green - color1.green) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              blue  = color1.blue + (color2.blue - color1.blue) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              alpha = color1.alpha + (color2.alpha - color1.alpha) *
                      ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              color = Color.new(red, green, blue, alpha)
              set_pixel(i, j, color)
            end
          end
        elsif align == 3
          for i in x...x + width
            for j in y...y + height
              red   = color1.red + (color2.red - color1.red) *
                  ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              green = color1.green + (color2.green - color1.green) *
                  ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              blue  = color1.blue + (color2.blue - color1.blue) *
                  ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              alpha = color1.alpha + (color2.alpha - color1.alpha) *
                  ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
              color = Color.new(red, green, blue, alpha)
              set_pixel(i, j, color)
            end
          end
        end
      end
    end
    và Limit break
    Mã:
    #==============================================================================
    # Advanced Limit Break Script
    #==============================================================================
    # SephirothSpawn
    # Version 1
    # 29.11.05
    #==============================================================================
    
    #------------------------------------------------------------------------------
    # * SDK Log Script
    #------------------------------------------------------------------------------
    SDK.log("Advanced Limit Break", "SephirothSpawn", 1, "12.17.05")
    
    #------------------------------------------------------------------------------
    # * Begin SDK Enable Test
    #------------------------------------------------------------------------------
    if SDK.state("Advanced Limit Break") == true
      
      #==============================================================================
      # ** Game_Actor
      #==============================================================================
      class Game_Actor < Game_Battler
        #--------------------------------------------------------------------------
        # * Public Instance Variables
        #--------------------------------------------------------------------------
        attr_reader :limit
        attr_accessor :limit_type
        #------------------------------------------------------------------------------
        # * Alias Listings
        #------------------------------------------------------------------------------
        alias seph_limitbreak_gameactor_setup setup
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def setup(actor_id)
          seph_limitbreak_gameactor_setup(actor_id)
          @limit = 0
          @limit_type = 0
        end
        #--------------------------------------------------------------------------
        # * Set Limit
        #--------------------------------------------------------------------------
        def limit=(limit)
          @limit = limit
          @limit = 1000 if @limit > 1000
        end
      end
    
      #==============================================================================
      # ** Window_Base
      #==============================================================================
      class Window_Base < Window
        #--------------------------------------------------------------------------
        # Alias Listings
        #--------------------------------------------------------------------------
        alias seph_limitbreak_windowbase_drawactorname draw_actor_name
        #--------------------------------------------------------------------------
        # Draw Actor Name
        #--------------------------------------------------------------------------
        def draw_actor_name(actor, x, y)
          ox = $game_temp.in_battle ? 4 : 16
          draw_slant_bar(x + ox, y + 32, actor.limit, 1000.0, 120)
          seph_limitbreak_windowbase_drawactorname(actor, x, y)
        end
        #--------------------------------------------------------------------------
        # Draw Slant Bar
        #--------------------------------------------------------------------------
        def draw_slant_bar(x, y, min, max, width = 152, height = 6, bar_color = Color.new(150, 0, 0, 255))
          # Draw Border
          for i in 0..height
            self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
          end
          # Draw Background
          for i in 1..(height - 1)
            r = 100 * (height - i) / height + 0 * i / height
            g = 100 * (height - i) / height + 0 * i / height
            b = 100 * (height - i) / height + 0 * i / height
            a = 255 * (height - i) / height + 255 * i / height
            self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
          end
          # Color Values
          if min == max
            bar_color = Color.new(200, 0, 0, 255) 
          end
          # Draws Bar
          for i in 1..( (min / max) * width - 1)
            for j in 1..(height - 1)
              r = bar_color.red * (width - i) / width + 255 * i / width
              g = bar_color.green * (width - i) / width + 255 * i / width
              b = bar_color.blue * (width - i) / width + 60 * i / width
              a = bar_color.alpha * (width - i) / width + 255 * i / width
              self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
            end
          end
        end
      end
      
      #==============================================================================
      # Window Horizontal Command
      #==============================================================================
      class Window_HorizCommand < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize(commands, width = 640, height = 64)
          super(0, 0, width, height)
          self.contents = Bitmap.new(width - 32, height - 32)
          @commands = commands
          @item_max = @commands.size
          @column_max = @commands.size
          refresh
          self.index = 0
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          self.contents.clear
          for i in 0...@item_max
            draw_item(i, normal_color)
          end
        end
        #--------------------------------------------------------------------------
        # * Draw Item
        #     index : item number
        #--------------------------------------------------------------------------
        def draw_item(index, color)
          self.contents.font.color = color
          x = width / @item_max * index
          off = width / @item_max - 32
          self.contents.draw_text(x, 0, off, 32, @commands[index], 1)
        end
        #--------------------------------------------------------------------------
        # * Disable Item
        #     index : item number
        #--------------------------------------------------------------------------
        def disable_item(index)
          draw_item(index, disabled_color)
        end
      end
      
      #==============================================================================
      # ** Window_Skill
      #==============================================================================
      class Window_Skill < Window_Selectable
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh(seperation = true, overdrive_skills = false)
          if self.contents != nil
            self.contents.dispose
            self.contents = nil
          end
          @data = []
          unless @actor == nil
            for i in 0...@actor.skills.size
              skill = $data_skills[@actor.skills[i]]
              unless skill == nil
                if seperation
                  if overdrive_skills
                    @data.push(skill) if skill.element_set.include?(20)
                  else
                    @data.push(skill) unless skill.element_set.include?(20)
                  end
                else
                  @data.push(skill)
                end
              end
            end
          end
          # If item count is not 0, make a bit map and draw all items
          @item_max = @data.size
          if @item_max > 0
            self.contents = Bitmap.new(width - 32, row_max * 32)
            for i in 0...@item_max
              draw_item(i)
            end
          end
        end
        #--------------------------------------------------------------------------
        # * Check Data
        #--------------------------------------------------------------------------
        def data
          return @data
        end
      end
      
      #==============================================================================
      # ** Window_Limit_Types
      #==============================================================================
      class Window_Limit_Types < Window_Selectable
        #--------------------------------------------------------------------------
        # * Object Initialization
        #--------------------------------------------------------------------------
        def initialize
          super(0, 128, 640, 288)
          @column_max = 2
          refresh
          self.index = 0
        end
        #--------------------------------------------------------------------------
        # * Get Type
        #--------------------------------------------------------------------------
        def get_type
          return @data[self.index]
        end
        #--------------------------------------------------------------------------
        # * Help Text
        #--------------------------------------------------------------------------
        def help_text
          case index
          when 0    ; text = 'Warrior - Gains When Hero Damages Enemy'
          when 1    ; text = 'Stotic - Gains When Hero Recieves Damage'
          when 2    ; text = 'Healer - Gains When Hero uses Restoriative Magic'
          when 3    ; text = 'Comrade - Gains When Allies Hit'
          when 4    ; text = 'Slayer - Gains When Hero Kills Enemy'
          when 5    ; text = 'Victor - Gains When Party Wins Battle'
          when 6    ; text = 'Tactician - Gains When Hero Inflicts Status Effect on Enemy'
          when 7    ; text = 'Hero - Gains When Hero Destroys Enemy with more than 10,000 HP'
          when 8    ; text = "Ally - Gains When Hero's Turn Comes"
          when 9    ; text = "Daredevil - Gains When Hero's Turn Comes and in Critical Condition"
          when 10  ; text = 'Solo - Gains When Hero Is Only Member in Party'
          when 11  ; text = 'Coward - Gains When Hero Escapes Battle'
          when 12  ; text = 'Dancer - Gains When Hero Evades Enemy Attack'
          when 13  ; text = 'Rook - Gains When Hero Guards Enemy Elemental or Status Attack'
          when 14  ; text = 'Sufferer - Gains When Hero is Inflicted with Status Effect'
          when 15  ; text = "Victim - Gains When Hero's Turn comes, and is inflicted by Status"
          when 16  ; text = 'Avenger - Gains When Ally is Killed By Enemy'
          when 17  ; text = 'Defender - Gains When Hero Chooses to Guard'
          end
          return text
        end
        #--------------------------------------------------------------------------
        # * Refresh
        #--------------------------------------------------------------------------
        def refresh
          if self.contents != nil
            self.contents.dispose
            self.contents = nil
          end
          @data = ['Warrior', 'Stotic', 'Healer', 'Comrade', 'Slayer', 'Victor',
                         'Tactician', 'Hero', 'Ally', 'Daredevil', 'Solo', 'Coward', 'Dancer',
                         'Rook', 'Sufferer', 'Victim', 'Avenger', 'Defender']
          # If item count is not 0, make a bit map and draw all items
          @item_max = @data.size
          if @item_max > 0
            self.contents = Bitmap.new(width - 32, row_max * 32)
            for i in 0...@item_max
              draw_item(i)
            end
          end
        end
        #--------------------------------------------------------------------------
        # * Draw Item
        #     index : item number
        #--------------------------------------------------------------------------
        def draw_item(index)
          x = 4 + index % 2 * (288 + 32)
          y = index / 2 * 32
          self.contents.draw_text(x, y, contents.width / 2 - 32, 32, @data[index], 1)
        end
      end
    
      #==============================================================================
      # ** Scene_Menu
      #==============================================================================
      class Scene_Menu
        #------------------------------------------------------------------------------
        # * Alias Listings
        #------------------------------------------------------------------------------
        alias seph_limitbreak_scenemenu_init initialize
        alias seph_limitbreak_scenemenu_update_command_check update_command_check
        alias seph_limitbreak_scenemenu_update_status_check update_status_check
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     menu_index : command cursor's initial position
        #--------------------------------------------------------------------------
        def initialize(menu_index = 0)
          seph_limitbreak_scenemenu_init(menu_index)
          # Inserts 'Limit Break' Below Skill
          @commands.insert(@commands.index($data_system.words.skill) + 1, 'Limit Break')
        end
        #--------------------------------------------------------------------------
        # * Update Command Check
        #--------------------------------------------------------------------------
        def update_command_check
          seph_limitbreak_scenemenu_update_command_check
          # Loads Command
          command = @commands[@command_window.index]
          # Check If Command is Limit Break
          if command == 'Limit Break'
            command_start_limit
          end
        end
        #--------------------------------------------------------------------------
        # * Update Status Check
        #--------------------------------------------------------------------------
        def update_status_check
          seph_limitbreak_scenemenu_update_status_check
          # Loads Command
          command = @commands[@command_window.index]
          # Check If Command is Limit Break
          if command == 'Limit Break'
            command_limit
          end
        end
        #--------------------------------------------------------------------------
        # * Command Start Limit
        #--------------------------------------------------------------------------
        def command_start_limit
          activate_status
        end
        #--------------------------------------------------------------------------
        # * Command Limit
        #--------------------------------------------------------------------------
        def command_limit
          # If this actor's action limit is 2 or more
          if $game_party.actors[@status_window.index].restriction >= 2
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Switch to skill screen
          $scene = Scene_LimitBreak.new(@status_window.index)
        end
      end
      
      #==============================================================================
      # ** Scene_LimitBreak
      #==============================================================================
      class Scene_LimitBreak
        #--------------------------------------------------------------------------
        # * Object Initialization
        #     actor_index : actor index
        #--------------------------------------------------------------------------
        def initialize(actor_index = 0)
          @actor_index = actor_index
        end
        #--------------------------------------------------------------------------
        # * Main Processing
        #--------------------------------------------------------------------------
        def main
          # Get actor
          @actor = $game_party.actors[@actor_index]
          # Make Help Window
          @help_window = Window_Help.new
          # Command Window
          @command_window = Window_HorizCommand.new(['View Skills', 'Set Overdrive Type'])
            @command_window.y = 64
          # Skill Window
          @skill_window = Window_Skill.new(@actor)
            @skill_window.height = 288
            @skill_window.refresh(true, true)
            @skill_window.active = false
          # Skill Status Window
          @status_window = Window_SkillStatus.new(@actor)
            @status_window.y = 416
          # Limit Break Types Window
          @limit_break_type_window = Window_Limit_Types.new
            @limit_break_type_window.index = @actor.limit_type
            @limit_break_type_window.visible = @limit_break_type_window.active = false
          # Associate help window
          if @skill_window.help_window == nil
            @help_window.set_text('No Limit Breaks Available', 1)
          else
            @skill_window.help_window = @help_window
          end
          # Scene Objects
          @objects = [@help_window, @command_window, @skill_window, @limit_break_type_window, @status_window]
          # Execute transition
          Graphics.transition
          # Main loop
          loop do
            # Update game screen
            Graphics.update
            # Update input information
            Input.update
            # Objects Update
            @objects.each {|x| x.update}
            # Frame update
            update
            # Abort loop if screen is changed
            if $scene != self
              break
            end
          end
          # Prepare for transition
          Graphics.freeze
          # Dispose of Objects
          @objects.each {|x| x.dispose}
        end
        #--------------------------------------------------------------------------
        # * Frame Update
        #--------------------------------------------------------------------------
        def update
          # If Main Command Active : call update_main
          if @command_window.active
            update_main
            return
          end
          # If skill window is active: call update_skill
          if @skill_window.active
            update_skill
            return
          end
          # If Limit Type is active: call update_type
          if @limit_break_type_window.active
            update_type
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (if main window is active)
        #--------------------------------------------------------------------------
        def update_main
          # Toggles Windows Visiblity
          @skill_window.visible = @command_window.index == 0 ? true : false
          @limit_break_type_window.visible = @command_window.index == 1 ? true : false
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to menu screen
            $scene = Scene_Menu.new(2)
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Branch Point
            case @command_window.index
            when 0  # View Skills
              if @skill_window.data.size == 0
                $game_system.se_play($data_system.buzzer_se)
                @help_window.set_text('No Limit Breaks Available', 1)
              else
                $game_system.se_play($data_system.decision_se)
                @command_window.active = false
                @skill_window.active = true
              end
            when 1  # Set Limit Break Type
                $game_system.se_play($data_system.decision_se)
                @command_window.active = false
                @limit_break_type_window.active = true
                @help_window.set_text(@limit_break_type_window.help_text, 1)
            end
          end
          # If R button was pressed
          if Input.trigger?(Input::R)
            # Play cursor SE
            $game_system.se_play($data_system.cursor_se)
            # To next actor
            @actor_index += 1
            @actor_index %= $game_party.actors.size
            # Switch to different skill screen
            $scene = Scene_LimitBreak.new(@actor_index)
            return
          end
          # If L button was pressed
          if Input.trigger?(Input::L)
            # Play cursor SE
            $game_system.se_play($data_system.cursor_se)
            # To previous actor
            @actor_index += $game_party.actors.size - 1
            @actor_index %= $game_party.actors.size
            # Switch to different skill screen
            $scene = Scene_LimitBreak.new(@actor_index)
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (if main window is active)
        #--------------------------------------------------------------------------
        def update_skill
          # Refreshes Help Window Text
          @skill_window.help_window = @help_window
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to main menu
            @command_window.active = true
            @skill_window.active = false
            return
          end
        end
        #--------------------------------------------------------------------------
        # * Frame Update (if main window is active)
        #--------------------------------------------------------------------------
        def update_type
          # Refreshes Help Window Text
          if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) || Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
            @help_window.set_text(@limit_break_type_window.help_text, 1)
          end
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # Switch to main menu
            @command_window.active = true
            @limit_break_type_window.active = false
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Play cancel SE
            $game_system.se_play($data_system.decision_se)
            # Set Actor Limit Type
            @actor.limit_type = @limit_break_type_window.index
            @help_window.set_text("#{@actor.name}'s Limit Type is Now #{@limit_break_type_window.get_type}", 1)
            return
          end
        end
      end
      
      #==============================================================================
      # ** Scene_Battle
      #==============================================================================
      class Scene_Battle
        #------------------------------------------------------------------------------
        # * Alias Listings
        #------------------------------------------------------------------------------
        alias seph_limitbreak_scenebattle_battleend battle_end
        alias seph_limitbreak_scenebattle_updatephase1 update_phase1
        alias seph_limitbreak_scenebattle_makebasicactionguard make_basic_action_result_guard
        #------------------------------------------------------------------------------
        # * Battle End Result
        #------------------------------------------------------------------------------
        def battle_end(result)
          for actor in $game_party.actors
            # Victor
            if result == 0
              if actor.limit_type == 5
                actor.limit += 200
              end
            # Coward
            elsif result == 1
              if actor.limit_type == 11
                actor.limit += 100
              end
            end
          end
          seph_limitbreak_scenebattle_battleend(result)
        end
        #------------------------------------------------------------------------------
        # * Update Phase 1
        #------------------------------------------------------------------------------
        def update_phase1
          for actor in $game_party.actors
            # Ally
            if actor.limit_type == 8
              actor.limit += 40
            end
            # Daredevil
            if actor.limit_type == 9 && actor.hp.quo(actor.maxhp) < 0.5
              actor.limit += 160 
            end
            # Solo
            if actor.limit_type == 16 && $game_party.actors.size == 1
              actor.limit += 160
            end
            # Victim
            if actor.limit_type == 15 && actor.states.empty?
              actor.limit += 160
            end
          end
          seph_limitbreak_scenebattle_updatephase1
        end
        #--------------------------------------------------------------------------
        # * Make Basic Action Results - Guard
        #--------------------------------------------------------------------------
        def make_basic_action_result_guard
          # Defender
          if @active_battler.is_a?(Game_Actor)
            if @active_battler.limit_type == 17
              @active_battler.limit += 80
            end
          end
          seph_limitbreak_scenebattle_makebasicactionguard
        end
      end
      
      #==============================================================================
      # ** Game_Battler
      #==============================================================================
      class Game_Battler
        #--------------------------------------------------------------------------
        # * Applying Normal Attack Effects
        #     attacker : battler
        #--------------------------------------------------------------------------
        def attack_effect(attacker)
          # Clear critical flag
          self.critical = false
          # First hit detection
          hit_result = (rand(100) < attacker.hit)
          # If hit occurs
          if hit_result == true
            # Calculate basic damage
            atk = [attacker.atk - self.pdef / 2, 0].max
            self.damage = atk * (20 + attacker.str) / 20
            # Element correction
            self.damage *= elements_correct(attacker.element_set)
            self.damage /= 100
            # If damage value is strictly positive
            if self.damage > 0
              # Critical correction
              if rand(100) < 4 * attacker.dex / self.agi
                self.damage *= 2
                self.critical = true
              end
              # Guard correction
              if self.guarding?
                self.damage /= 2
              end
            end
            # Dispersion
            if self.damage.abs > 0
              amp = [self.damage.abs * 15 / 100, 1].max
              self.damage += rand(amp+1) + rand(amp+1) - amp
            end
            # Second hit detection
            eva = 8 * self.agi / attacker.dex + self.eva
            hit = self.damage < 0 ? 100 : 100 - eva
            hit = self.cant_evade? ? 100 : hit
            hit_result = (rand(100) < hit)
          end
          # If hit occurs
          if hit_result == true
            # State Removed by Shock
            remove_states_shock
            # Loads Current States
            current_states = self.states
            # Substract damage from HP
            self.hp -= self.damage
            # Slayer, Hero & Avenger
            if self.dead?
              if self.is_a?(Game_Actor)
                # Avenger
                for actor in $game_party.actors
                  unless actor == self
                    if actor.limit_type == 16
                      actor.limit += 300 unless actor.dead?
                    end
                  end
                end
              else
                # Hero
                if attacker.limit_type == 7 && self.maxhp >= 10000
                  attacker.limit += 250 
                end
                # Slayer
                if attacker.limit_type == 4
                  attacker.limit += 200 
                end
              end
            end
            # State change
            @state_changed = false
            states_plus(attacker.plus_state_set)
            states_minus(attacker.minus_state_set)
            # Sufferer
            if self.is_a?(Game_Actor)
              if states.size > current_states.size
                if self.limit_type == 14
                  self.limit += 160 
                end
              end
            end
            # Warrior & Tactician
            unless self.is_a?(Game_Actor)
              # Warrior
              if attacker.limit_type == 0
                attacker.limit += [self.damage * 10, 160].min
              end
              # Tactician
              if attacker.limit_type == 6
                attacker.limit += 160 
              end
            end
            # Stotic
            if self.is_a?(Game_Actor)
              if self.limit_type == 1
                self.limit += self.damage * 100 / self.maxhp
              end
            end
            # Comrade
            if self.is_a?(Game_Actor)
              for actor in $game_party.actors
                unless actor == self
                  if actor.limit_type == 3
                    actor.limit += self.damage * 20 / self.maxhp
                  end
                end
              end
            end
          # When missing
          else
            # Dancer & Rook
            if self.is_a?(Game_Actor)
              # Dancer
              if self.limit_type == 12
                self.limit += 160 
              end
              # Rook
              if self.limit_type == 13 && !attacker.plus_state_set.empty?
                self.limit += 100 
              end
            end
            # Set damage to "Miss"
            self.damage = "Miss"
            # Clear critical flag
            self.critical = false
          end
          # End Method
          return true
        end
        #--------------------------------------------------------------------------
        # * Apply Skill Effects
        #     user  : the one using skills (battler)
        #     skill : skill
        #--------------------------------------------------------------------------
        def skill_effect(user, skill)
          # Clear critical flag
          self.critical = false
          # If skill scope is for ally with 1 or more HP, and your own HP = 0,
          # or skill scope is for ally with 0, and your own HP = 1 or more
          if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
             ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
            # End Method
            return false
          end
          # Clear effective flag
          effective = false
          # Set effective flag if common ID is effective
          effective |= skill.common_event_id > 0
          # First hit detection
          hit = skill.hit
          if skill.atk_f > 0
            hit *= user.hit / 100
          end
          hit_result = (rand(100) < hit)
          # Set effective flag if skill is uncertain
          effective |= hit < 100
          # If hit occurs
          if hit_result == true
            # Calculate power
            power = skill.power + user.atk * skill.atk_f / 100
            if power > 0
              power -= self.pdef * skill.pdef_f / 200
              power -= self.mdef * skill.mdef_f / 200
              power = [power, 0].max
            end
            # Calculate rate
            rate = 20
            rate += (user.str * skill.str_f / 100)
            rate += (user.dex * skill.dex_f / 100)
            rate += (user.agi * skill.agi_f / 100)
            rate += (user.int * skill.int_f / 100)
            # Calculate basic damage
            self.damage = power * rate / 20
            # Element correction
            self.damage *= elements_correct(skill.element_set)
            self.damage /= 100
            # If damage value is strictly positive
            if self.damage > 0
              # Guard correction
              if self.guarding?
                self.damage /= 2
              end
            end
            # Dispersion
            if skill.variance > 0 and self.damage.abs > 0
              amp = [self.damage.abs * skill.variance / 100, 1].max
              self.damage += rand(amp+1) + rand(amp+1) - amp
            end
            # Second hit detection
            eva = 8 * self.agi / user.dex + self.eva
            hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
            hit = self.cant_evade? ? 100 : hit
            hit_result = (rand(100) < hit)
            # Set effective flag if skill is uncertain
            effective |= hit < 100
          end
          # If hit occurs
          if hit_result == true
            # If physical attack has power other than 0
            if skill.power != 0 and skill.atk_f > 0
              # State Removed by Shock
              remove_states_shock
              # Set to effective flag
              effective = true
            end
            # Loads Current States
            current_states = self.states
            # Substract damage from HP
            last_hp = self.hp
            self.hp -= self.damage
            # Healer
            if self.damage < 0
              if user.is_a?(Game_Actor)
                if self.is_a?(Game_Actor) && self != user
                  if user.limit_type == 2
                    user.limit += 80
                  end
                end
              end
            end
            effective |= self.hp != last_hp
            # Slayer, Hero & Avenger
            if self.dead?
              if self.is_a?(Game_Actor)
                # Avenger
                for actor in $game_party.actors
                  unless actor == self
                    if actor.limit_type == 16
                      actor.limit += 300 unless actor.dead?
                    end
                  end
                end
              else
                # Hero
                if user.limit_type == 7 && self.maxhp >= 10000
                  user.limit += 250 
                end
                # Slayer
                if user.limit_type == 4
                  user.limit += 200 
                end
              end
            end
            @state_changed = false
            effective |= states_plus(skill.plus_state_set)
            effective |= states_minus(skill.minus_state_set)
            # Sufferer
            if self.is_a?(Game_Actor)
              if states.size > current_states.size
                if self.limit_type == 14
                  self.limit += 160 
                end
              end
            end
            # Warrior & Tactician
            if user.is_a?(Game_Actor)
              # Warrior
              if user.limit_type == 0
                user.limit += [self.damage * 10, 160].min
              end
              # Tactician
              if user.limit_type == 6
                user.limit += 160 
              end
            end
            # Stotic
            if self.is_a?(Game_Actor)
              if self.limit_type == 1
                self.limit += self.damage * 100 / self.maxhp
              end
            end
            # Comrade
            if self.is_a?(Game_Actor)
              for actor in $game_party.actors
                unless actor == self
                  if actor.limit_type == 3
                    actor.limit += self.damage * 20 / self.maxhp
                  end
                end
              end
            end
            # If power is 0
            if skill.power == 0
              # Set damage to an empty string
              self.damage = ""
              # If state is unchanged
              unless @state_changed
                # Set damage to "Miss"
                self.damage = "Miss"
              end
            end
          # When missing
          else
            # Dancer & Rook
            if self.is_a?(Game_Actor)
              # Dancer
              if self.limit_type == 12
                self.limit += 160 
              end
              # Rook
              if self.limit_type == 13 && user.plus_state_set.empty?
                self.limit += 100 
              end
            end
            # Set damage to "Miss"
            self.damage = "Miss"
            # Clear critical flag
            self.critical = false
          end
          # If not in battle
          unless $game_temp.in_battle
            # Set damage to nil
            self.damage = nil
          end
          # End Method
          return effective
        end
      end  
    
      #==============================================================================
      # ** Scene_Battle
      #==============================================================================
      class Scene_Battle
        #--------------------------------------------------------------------------
        # * Alias Listings
        #--------------------------------------------------------------------------
        alias seph_limitbreak_scenebattle_commandsinit commands_init
        alias seph_limitbreak_scenebattle_updatephase3 update_phase3
        alias seph_limitbreak_scenebattle_checkcommands check_commands
        alias seph_limitbreak_scenebattle_endenemyselect end_enemy_select
        alias seph_limitbreak_scenebattle_endactorselect end_actor_select
        #--------------------------------------------------------------------------
        # * Set Commands
        #--------------------------------------------------------------------------
        def commands_init
          seph_limitbreak_scenebattle_commandsinit
          @commands.insert(@commands.index($data_system.words.skill) + 1, 'Limit Break')
        end
        #--------------------------------------------------------------------------
        # * Frame Update (actor command phase)
        #--------------------------------------------------------------------------
        def update_phase3
          seph_limitbreak_scenebattle_updatephase3
          # If limit skill is enabled
          if @limit_skill_window != nil
            update_phase3_limit_select
          end
        end
        #--------------------------------------------------------------------------
        # * Check Commands
        #--------------------------------------------------------------------------
        def check_commands
          seph_limitbreak_scenebattle_checkcommands
          # Loads Current Command
          command = @commands[@actor_command_window.index]
          if command == 'Limit Break'
            update_phase3_command_limit
          end
        end
        #--------------------------------------------------------------------------
        # * Command : Limit
        #--------------------------------------------------------------------------
        def update_phase3_command_limit
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Set action
          @active_battler.current_action.kind = 1
          # Start skill selection
          start_limit_select
        end
        #--------------------------------------------------------------------------
        # * Start Limit Selection
        #--------------------------------------------------------------------------
        def start_limit_select
          # Skill Window
          @limit_skill_window = Window_Skill.new(@active_battler)
            @limit_skill_window.refresh(true, true)
          # Associate help window
          @limit_skill_window.help_window = @help_window
          # Disable actor command window
          @actor_command_window.active = false
          @actor_command_window.visible = false
        end
        #--------------------------------------------------------------------------
        # * Frame Update (actor command phase : limit selection)
        #--------------------------------------------------------------------------
        def update_phase3_limit_select
          # Make skill window visible
          @limit_skill_window.visible = true
          # Update skill window
          @limit_skill_window.update
          # If B button was pressed
          if Input.trigger?(Input::B)
            # Play cancel SE
            $game_system.se_play($data_system.cancel_se)
            # End skill selection
            end_limit_select
            return
          end
          # If C button was pressed
          if Input.trigger?(Input::C)
            # Get currently selected data on the skill window
            @skill = @limit_skill_window.skill
            # If it can't be used
            if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Checks Overdrive
            if @active_battler.limit < 1000
              # Play buzzer SE
              $game_system.se_play($data_system.buzzer_se)
              return
            end
            # Play decision SE
            $game_system.se_play($data_system.decision_se)
            # Set action
            @active_battler.current_action.skill_id = @skill.id
            # Make skill window invisible
            @limit_skill_window.visible = false
            # If effect scope is single enemy
            if @skill.scope == 1
              # Start enemy selection
              start_enemy_select
            # If effect scope is single ally
            elsif @skill.scope == 3 or @skill.scope == 5
              # Start actor selection
              start_actor_select
            # If effect scope is not single
            else
              # End skill selection
              end_limit_select
              # Go to command input for next actor
              phase3_next_actor
            end
            # Resets Limit
            @active_battler.limit = 0
            return
          end
        end
        #--------------------------------------------------------------------------
        # * End Skill Selection
        #--------------------------------------------------------------------------
        def end_limit_select
          # Dispose of skill window
          @limit_skill_window.dispose
          @limit_skill_window = nil
          # Hide help window
          @help_window.visible = false
          # Enable actor command window
          @actor_command_window.active = true
          @actor_command_window.visible = true
        end
        #--------------------------------------------------------------------------
        # * End Enemy Selection
        #--------------------------------------------------------------------------
        def end_enemy_select
          seph_limitbreak_scenebattle_endenemyselect
          unless @limit_skill_window ==  nil
            end_limit_select
          end
        end
        #--------------------------------------------------------------------------
        # * End Actor Selection
        #--------------------------------------------------------------------------
        def end_actor_select
          seph_limitbreak_scenebattle_endactorselect
          unless @limit_skill_window ==  nil
            end_limit_select
          end
        end
      end
      
    #--------------------------------------------------------------------------
    # * End SDK Enable Test
    #--------------------------------------------------------------------------
    end
     
  20. MasterWind

    MasterWind T.E.T.Я.I.S

    Tham gia ngày:
    12/4/06
    Bài viết:
    637
    Nơi ở:
    [GVN]Audition
    Vấn đề 2 Script trên "khắc nhau" .Lí do thứ nhất cả 2 đều thay đổi cơ cấu Window trong Battle do đó mà không đủ chỗ cho tụi nó chen chân .Cần phải chỉnh sửa lại Window trong RTAB .Nhưng cái đó những 4000 mấy dòng đọc thấy oải rồi .Lí do thứ 2 :Cả 2 đều dùng chung 1 số Method và Variable giống nhau do đó khi cần chạy thì Computer không biết dùng Code bên nào .Còn nữa ,do mỗi cái có 1 đặc tính Battle riêng biệt nên khi vào Battle dù có chạy được thì nó cũng không ăn khớp nhau về mặt hình ảnh .Nói thì dễ nhưng làm mới khó ,đang ngồi tìm cách sửa Bug .Giờ ngồi mò hết mấy cái Method giống nhau sửa lại trước cái đã .Dây vào mấy cái SDK này phiền lắm ...

    Còn để tui hướng dẫn kĩ thêm về cái Limit Break (Cái thứ 2) Cái này giống dạng Tuyệt Chiêu (Cái gì ma Aoura gì gì đó trong FF) .Bạn sẽ phải tạo thêm trước hết là 1 cái Element (Cái này tui hướng dẫn trong CMS rồi ) .Nhớ là tạo cái Element thứ 20 và đặt tên nó là Limit Break .Khi cần Skill nào vào Limit Break thì cứ check vào ô Element thứ 20 đó .
    "Ồn ào Demo đâu !@!" (Học theo bác Bullno :p)
    "Dạ đây ."
     

    Các file đính kèm:

Chia sẻ trang này