RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Making these two codes work together

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 86
~~~
Okay, I am wondering if any one of you more code-savy people could help me work both of these scripts together. First, that is the script "Windows Battle Status" Which, when you level up after a battle, shows a level up window and tells the player what was newly learnt and which stats increased.
Spoiler for:
Code: [Select]
#================================================
# ====Create a new script above main and put all that code in it. ======
#================================================
#
#
#
#
#
# Window_BattleStatus
#
#¥£¥ XRXS_BP10. LEVEL UP!”\—͏㏸•\Ž¦ƒEƒBƒ“ƒhƒE plus! ¥£¥
# by ÷‰ë Ý“y
#
# —vFXRXS.RGSS‰ü—ǃJƒXƒ^ƒ}ƒCƒY
#
#
#Script found at http://f26.aaa.livedoor.jp/~xxms/RPGXP_XRXS_BP10.htm
#Modified by Guillaume777
#
#
#==============================================================================
#   ƒJƒXƒ^ƒ}ƒCƒYƒ|ƒCƒ“ƒg
#==============================================================================
class Scene_Battle
  LEVEL_UP_SE   = ""                       # ƒŒƒxƒ‹ƒAƒbƒvSEB""‚Å–³‚µB
  LEVEL_UP_ME   = "Audio/ME/007-Fanfare01" # ƒŒƒxƒ‹ƒAƒbƒvME
end
class Window_SkillLearning < Window_Base
  SKILLLEARN_SE = "Audio/SE/106-Heal02"    # ƒXƒLƒ‹K“¾SEB
end
#==============================================================================
# ¡ Window_LevelUpWindow
#------------------------------------------------------------------------------
# @ƒoƒgƒ‹I—¹ŽžAƒŒƒxƒ‹ƒAƒbƒv‚µ‚½ê‡‚ɃXƒe[ƒ^ƒX‚ð•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
#==============================================================================
class Window_LevelUpWindow < Window_Base
  #--------------------------------------------------------------------------
  # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
  #--------------------------------------------------------------------------
  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, y-32, 160, 192+32)
 
    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
  #--------------------------------------------------------------------------
  # œ ƒŠƒtƒŒƒbƒVƒ…
  #--------------------------------------------------------------------------
  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 = $fontface
    self.contents.draw_text( 20,   0, 160, 24, "LEVEL UP!!")
    self.contents.font.size = 20
    self.contents.font.name = $fontface
    self.contents.draw_text( 0,  28+32, 160, 24, $data_system.words.hp)
    self.contents.draw_text( 0,  50+32, 160, 24, $data_system.words.sp)
    self.contents.font.size = 20
    self.contents.font.name = $fontface
    self.contents.draw_text( 0,  0+32,  80, 24, "Level")
    self.contents.draw_text( 0,  72+32,  80, 24, $data_system.words.str[0,3])
    self.contents.draw_text( 0,  94+32,  80, 24, $data_system.words.dex[0,3])
    self.contents.draw_text( 0, 116+32,  80, 24, $data_system.words.agi[0,3])
    self.contents.draw_text( 0, 138+32,  80, 24, $data_system.words.int[0,3])
    self.contents.draw_text(76,   0+32, 128, 24, "=")
    self.contents.draw_text(76,  28+32, 128, 24, "=")
    self.contents.draw_text(76,  50+32, 128, 24, "=")
    self.contents.draw_text(76,  72+32, 128, 24, "=")
    self.contents.draw_text(76,  94+32, 128, 24, "=")
    self.contents.draw_text(76, 116+32, 128, 24, "=")
    self.contents.draw_text(76, 138+32, 128, 24, "=")
    self.contents.font.size = 20
    self.contents.font.color = normal_color
    self.contents.draw_text( 0,   0+32,  72, 24, "+" + (actor.level-last_lv).to_s, 2)
    self.contents.draw_text( 0,  28+32,  72, 24, "+" + up_hp.to_s, 2)
    self.contents.draw_text( 0,  50+32,  72, 24, "+" + up_sp.to_s, 2)
    self.contents.draw_text( 0,  72+32,  72, 24, "+" + up_str.to_s, 2)
    self.contents.draw_text( 0,  94+32,  72, 24, "+" + up_dex.to_s, 2)
    self.contents.draw_text( 0, 116+32,  72, 24, "+" + up_agi.to_s, 2)
    self.contents.draw_text( 0, 138+32,  72, 24, "+" + up_int.to_s, 2)
    self.contents.font.size = 20
    self.contents.font.name = $fontface
    self.contents.draw_text( 0,   0+32, 128, 24, actor.level.to_s, 2)
    self.contents.draw_text( 0,  26+32, 128, 24, actor.maxhp.to_s, 2)
    self.contents.draw_text( 0,  48+32, 128, 24, actor.maxsp.to_s, 2)
    self.contents.draw_text( 0,  70+32, 128, 24, actor.str.to_s, 2)
    self.contents.draw_text( 0,  92+32, 128, 24, actor.dex.to_s, 2)
    self.contents.draw_text( 0, 114+32, 128, 24, actor.agi.to_s, 2)
    self.contents.draw_text( 0, 136+32, 128, 24, actor.int.to_s, 2)
  end
end
#==============================================================================
# ¡ Window_SkillLearning
#------------------------------------------------------------------------------
# @ƒŒƒxƒ‹ƒAƒbƒvŽž‚ȂǂɃXƒLƒ‹‚ðK“¾‚µ‚½ê‡‚É‚»‚ê‚ð•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
#==============================================================================
class Window_SkillLearning < Window_Base
  #--------------------------------------------------------------------------
  # œ ŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
  #--------------------------------------------------------------------------
    attr_reader   :learned                  # ƒXƒLƒ‹‚ðK“¾‚µ‚½‚©‚Ç‚¤‚©
  #--------------------------------------------------------------------------
  # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»
  #--------------------------------------------------------------------------
  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
  #--------------------------------------------------------------------------
  # œ ƒŠƒtƒŒƒbƒVƒ…
  #--------------------------------------------------------------------------
  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
      # ¡‰ñ‚̃Œƒxƒ‹ƒAƒbƒv”͈͂ŏK“¾‚·‚éƒXƒLƒ‹‚̏ꍇ
      if learn_lv > last_lv and learn_lv <= now_lv
        @learned = true
        # SE‚̍ж
        if SKILLLEARN_SE != ""
          Audio.se_play(SKILLLEARN_SE)
        end
        # Še•`ŽÊ
        skill_name = $data_skills[$data_classes[class_id].learnings[i].skill_id].name
        self.contents.clear
        self.contents.font.name = $fontface
        self.contents.draw_text(0,0,448,32, skill_name + " learned !!")
        self.visible  = true
        # ƒƒCƒ“ƒ‹[ƒv
        loop do
          # ƒQ[ƒ€‰æ–Ê‚ðXV
          Graphics.update
          # “ü—͏î•ñ‚ðXV
          Input.update
          # ƒtƒŒ[ƒ€XV
          update
          # ‰æ–Ê‚ªØ‚è‘Ö‚í‚Á‚½‚烋[ƒv‚ð’†’f
          if @learned == false
            break
          end
        end
        # ƒƒCƒ“ƒ‹[ƒv‚±‚±‚Ü‚Å
      end
    end
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV
  #--------------------------------------------------------------------------
  def update
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      @learned = false
      self.visible  = false
    end
  end
end
#==============================================================================
# ¡ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # œ ’ljÁEŒöŠJƒCƒ“ƒXƒ^ƒ“ƒX•Ï”
  #--------------------------------------------------------------------------
    attr_accessor :level_up_flags             # LEVEL UP!•\Ž¦
end
#==============================================================================
# ¡ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # œ ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒYŠJŽn
  #--------------------------------------------------------------------------
  alias xrxs_bp10_start_phase5 start_phase5
  def start_phase5
    xrxs_bp10_start_phase5
    # Šl“¾ EXP‚ðŽæ“¾
    @exp_gained = battle_exp
    # 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_gained
        if actor.level < last_level
          @status_window.level_up_flags[i] = false
        end
      end
    end
    # Ý’è
    @exp_gain_actor    = -1
    # ƒŠƒUƒ‹ƒgƒEƒBƒ“ƒhƒE‚ð•\Ž¦
    @result_window.visible = true
  end
  #--------------------------------------------------------------------------
  # œ ƒtƒŒ[ƒ€XV (ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒY)
  #--------------------------------------------------------------------------
  alias xrxs_bp10_update_phase5 update_phase5
  def update_phase5
    @level_up_phase_done = false if @level_up_phase_done != true
    # C ƒ{ƒ^ƒ“‚ª‰Ÿ‚³‚ꂽê‡
    if Input.trigger?(Input::C)
      # ƒEƒBƒ“ƒhƒE‚ð•Â‚¶‚ÄŽŸ‚̃AƒNƒ^[‚Ö
      @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
        # ƒŠƒUƒ‹ƒgƒEƒBƒ“ƒhƒE‚ðvisible=true‚Å‚à•s‰ÂŽ‹‚É
        @result_window.opacity = 0
        @result_window.back_opacity = 0
        @result_window.contents_opacity = 0
      end
      # ŒÄ‚Ñ–ß‚·
      xrxs_bp10_update_phase5
      # ƒŒƒxƒ‹ƒAƒbƒv‚µ‚Ä‚¢‚éê‡‚Í‹­§ƒoƒgƒ‹I—¹
      battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
    end
  end
  #--------------------------------------------------------------------------
  # œ ŽŸ‚̃AƒNƒ^[‚̃Œƒxƒ‹ƒAƒbƒv•\Ž¦‚Ö
  #--------------------------------------------------------------------------
  def phase5_next_levelup
    begin
      # ŽŸ‚̃AƒNƒ^[‚Ö
      @exp_gain_actor += 1
      # ÅŒã‚̃AƒNƒ^[‚̏ꍇ
      if @exp_gain_actor >= $game_party.actors.size
        # ƒAƒtƒ^[ƒoƒgƒ‹ƒtƒF[ƒYŠJŽn
        return true
      end
      actor = $game_party.actors[@exp_gain_actor]
      if actor.cant_get_exp? == false
        # Œ»Ý‚Ì”\—Í’l‚ð•ÛŽ
        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
        # í“¬ŒoŒ±’l‚̍Ď擾
        actor.exp += @exp_gained
        # ”»’è
        if actor.level > last_level
          # ƒŒƒxƒ‹ƒAƒbƒv‚µ‚½ê‡
          @status_window.level_up(@exp_gain_actor)
          # ƒŠƒUƒ‹ƒgƒEƒBƒ“ƒhƒE‚ðÁ‚·
          @result_window.visible = false
          # SE‚̍ж
          if LEVEL_UP_SE != ""
            Audio.se_play(LEVEL_UP_SE)
          end
          # ME‚̍ж
          if LEVEL_UP_ME != ""
            Audio.me_stop
            Audio.me_play(LEVEL_UP_ME)
          end
          # LEVEL-UPƒEƒBƒ“ƒhƒE‚̐ݒè
          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,
            actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str,
            actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int)
          @levelup_window.visible = true
          # ƒXƒe[ƒ^ƒXƒEƒBƒ“ƒhƒE‚ðƒŠƒtƒŒƒbƒVƒ…
          @status_window.refresh
          # ƒXƒLƒ‹K“¾ƒEƒBƒ“ƒhƒE‚̐ݒè
          @skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level)
          # ƒEƒFƒCƒgƒJƒEƒ“ƒg‚ðÝ’è
          @phase5_wait_count = 40
          return false
        end
      end
    end until false
  end
 
    def battle_exp
    bexp = 0
    # ƒ‹[ƒv
    for enemy in $game_troop.enemies
      # ƒGƒlƒ~[‚ª‰B‚êó‘Ô‚Å‚È‚¢ê‡
      unless enemy.hidden
        # Šl“¾‚ð’ljÁ
        bexp += enemy.exp
      end
    end
    return bexp
  end

end
« Last Edit: November 02, 2007, 12:02:59 AM by savarast »
The Pessimist By The Lake In The Forest

Check Out Savarast's Resource Page, I do Requests

***
Rep:
Level 86
~~~
And this Code is the battle system that I am using:

Spoiler for:
[code]

class Bitmap
if not method_defined?('original_draw_text')
 alias original_draw_text draw_text
 def draw_text(*arg)

   original_color = self.font.color.dup
   self.font.color = Color.new(0, 0, 0, 128)

   if arg[0].is_a?(Rect)
     arg[0].x += 2
     arg[0].y += 2
     self.original_draw_text(*arg)
     arg[0].x -= 2
     arg[0].y -= 2
   else
     arg[0] += 2
     arg[1] += 2
     self.original_draw_text(*arg)
     arg[0] -= 2
     arg[1] -= 2
   end

   self.font.color = original_color
   self.original_draw_text(*arg)

 end
end
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

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
     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

class Game_Actor < Game_Battler
 def screen_x
   if self.index != nil
   n_split = [($game_party.actors.length * 0.5).ceil, 4].min
   case n_split
   when 1
     n_index = self.index * 2
   when 2
     if self.index < ($game_party.actors.length - 2)
       n_index = 0.5 + (2 * self.index)
     else
       if $game_party.actors.length == 3 then
         n_index = (self.index * 2) + 2
       elsif $game_party.actors.length == 4 then
         n_index = self.index * 2
       end
     end
   when 3
       n_index = self.index + (0.25 * (self.index + 1))
     if $game_party.actors.length == 5
     if self.index < 2
       n_index = self.index + (0.25 * (self.index + 1))
     else
       n_index = self.index + (0.25 * (self.index + 2)) + 1
     end
     end
   when 4
     n_index = self.index
     if $game_party.actors.length == 7
     if self.index < 3
       n_index = self.index
     else
       n_index = self.index + 1
     end
     end
   end
     return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) / 5) + 480 + ((n_index / 4).floor * 60)
   else
     return 0
   end
 end
 #--------------------------------------------------------------------------
 # ? ????? Y ?????
 #--------------------------------------------------------------------------
 def screen_y
   n_split = [($game_party.actors.length * 0.5).ceil, 4].min
   case n_split
   when 1
     n_index = self.index * 2
   when 2
     if self.index < ($game_party.actors.length - 2)
       n_index = 0.5 + (2 * self.index)
     else
       if $game_party.actors.length == 3 then
         n_index = (self.index * 2) + 2
       elsif $game_party.actors.length == 4 then
         n_index = self.index * 2
       end
     end
   when 3
       n_index = self.index + (0.25 * (self.index + 1))
     if $game_party.actors.length == 5
     if self.index < 2
       n_index = self.index + (0.25 * (self.index + 1))
     else
       n_index = self.index + (0.25 * (self.index + 2)) + 1
     end
     end
   when 4
     n_index = self.index
     if $game_party.actors.length == 7
     if self.index < 3
       n_index = self.index
     else
       n_index = self.index + 1
     end
     end
   end
   return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))
end
 #--------------------------------------------------------------------------
 # ? ????? Z ?????
 #--------------------------------------------------------------------------
 def screen_z
   # ??????????? Z ?????????
   if self.index != nil
     return self.index
   else
     return 0
   end
 end
end

class Game_Enemy < Game_Battler
 def screen_x
   n_split = [($game_troop.enemies.length * 0.5).ceil, 4].min
   case n_split
   when 1
     n_index = self.index * 2
   when 2
     if self.index < ($game_troop.enemies.length - 2)
       n_index = 0.5 + (2 * self.index)
     else
       if $game_troop.enemies.length == 3 then
         n_index = (self.index * 2) + 2
       elsif $game_troop.enemies.length == 4 then
         n_index = self.index * 2
       end
     end
   when 3
       n_index = self.index + (0.25 * (self.index + 1))
     if $game_troop.enemies.length == 5
     if self.index < 2
       n_index = self.index + (0.25 * (self.index + 1))
     else
       n_index = self.index + (0.25 * (self.index + 2)) + 2
     end
     end
   when 4
     n_index = self.index
     if $game_troop.enemies.length == 7
     if self.index < 3
       n_index = self.index
     else
       n_index = self.index + 1
     end
     end
   end
   return (n_index - ((n_index / 4).floor) * 4) * ((-160 / (4)) / 5) + 160 - ((n_index / 4).floor * 60)
 end
 #--------------------------------------------------------------------------
 # ? ????? Y ?????
 #--------------------------------------------------------------------------
 def screen_y
   n_split = [($game_troop.enemies.length * 0.5).ceil, 4].min
   case n_split
   when 1
     n_index = self.index * 2
   when 2
     if self.index < ($game_troop.enemies.length - 2)
       n_index = 0.5 + (2 * self.index)
     else
       if $game_troop.enemies.length == 3 then
         n_index = (self.index * 2) + 2
       elsif $game_troop.enemies.length == 4 then
         n_index = self.index * 2
       end
     end
   when 3
       n_index = self.index + (0.25 * (self.index + 1))
     if $game_troop.enemies.length == 5
     if self.index < 2
       n_index = self.index + (0.25 * (self.index + 1))
     else
       n_index = self.index + (0.25 * (self.index + 2)) + 1
     end
     end
   when 4
     n_index = self.index
     if $game_troop.enemies.length == 7
     if self.index < 3
       n_index = self.index
     else
       n_index = self.index + 1
     end
     end
   end
   return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))
 end
 #--------------------------------------------------------------------------
 # ? ????? Z ?????
 #--------------------------------------------------------------------------
 def screen_z
   return @member_index + 1
 end
end

#==============================================================================
# ¦ Sprite_Battler
#------------------------------------------------------------------------------
#  ????????????????Game_Battler ???????????????
# ????????????????????
#==============================================================================

class Sprite_Battler < RPG::Sprite
 #--------------------------------------------------------------------------
 # ? ??????????
 #--------------------------------------------------------------------------
 attr_accessor :battler                  # ????
 attr_accessor :moving        # Is the sprite moving?
 attr_reader   :index
 attr_accessor :target_index
 attr_accessor :direction
 attr_accessor :pattern
 #--------------------------------------------------------------------------
 # ? ?????????
 #     viewport : ??????
 #     battler  : ???? (Game_Battler)
 #--------------------------------------------------------------------------
 def initialize(viewport, battler = nil)
   super(viewport)
   change
   @old = Graphics.frame_count  # For the delay method
   @goingup = true    # Increasing animation? (if @rm2k_mode is true)
   @once = false      # Is the animation only played once?
   @animated = true   # Used to stop animation when @once is true
   self.opacity = 0
   @index = 0
   @pattern_b = 0
   @counter_b = 0
   @trans_sprite = Sprite.new
   @trans_sprite.opacity = 0
   @bar_hp_sprite = Sprite.new
   @bar_hp_sprite.bitmap = Bitmap.new(64, 10)
   @bar_sp_sprite = Sprite.new
   @bar_sp_sprite.bitmap = Bitmap.new(64, 10)
   @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)
   @old_hp = -1
   @old_sp = -1
   @battler = battler
   @battler_visible = false
   @first = true
   @pattern = 0
   if $target_index == nil
     $target_index = 0
   end
   @battler.is_a?(Game_Enemy) ? enemy_pose(0, 1) : pose(0, 1)
 end
 #--------------------------------------------------------------------------
 # ? ??
 #--------------------------------------------------------------------------
 def dispose
   if self.bitmap != nil
     self.bitmap.dispose
   end
   if @trans_sprite.bitmap != nil
     @trans_sprite.bitmap.dispose
   end
   @trans_sprite.dispose
   @bar_hp_sprite.bitmap.dispose
   @bar_hp_sprite.dispose
   @bar_sp_sprite.bitmap.dispose
   @bar_sp_sprite.dispose
   super
 end
 
 def change(frames = 0, delay = 0, offx = 0, offy = 0, startf = 0, once = false)
   @frames = frames
   @delay = delay
   @offset_x, @offset_y = offx, offy
   @current_frame = startf
   @once = once
   @goingup = true
   @animated = true
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
   bar_check = true if @_damage_duration == 1
   super
   @trans_sprite.blend_type = self.blend_type
   @trans_sprite.color = self.color
   if @_collapse_duration > 0
     @trans_sprite.opacity = self.opacity
   else
     @trans_sprite.opacity = [self.opacity, 160].min
   end
   if (@_damage_duration == 0 and bar_check == true) or @first == true
     @first = false if @first == true
     bar_check = false
     @bar_must_change = true
   end
   @bar_hp_sprite.opacity = self.opacity
   @bar_sp_sprite.opacity = self.opacity
   # ????? nil ???
   if @battler == nil
     self.bitmap = nil
     @trans_sprite.bitmap = nil
     loop_animation(nil)
     return
   end
   # ????????????????????
   if @battler.battler_name != @battler_name or
      @battler.battler_hue != @battler_hue
     # ????????????
     @battler_name = @battler.battler_name
     @battler_hue = @battler.battler_hue
     if @battler.is_a?(Game_Actor)
       @battler_name = @battler.character_name
       @battler_hue = @battler.character_hue
       @direction = 4
     else
       @direction = 6
     end
       self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
       @width = bitmap.width / 4
       @height = bitmap.height / 4
       @frame_width = @width
       @frame_height = @height
       self.ox = @width / 2
       self.oy = @height
       @pattern = @current_frame
       @direction = @offset_y
       sx = @pattern * @width
       sy = (@direction - 2) / 2 * @height
       self.src_rect.set(sx, sy, @width, @height)
       @current_frame = (@current_frame + 1) unless @frames == 0
       @animated = false if @current_frame == @frames and @once
       @current_frame %= @frames
       @trans_sprite.bitmap = self.bitmap
       @trans_sprite.ox = self.ox
       @trans_sprite.oy = self.oy
       @trans_sprite.src_rect.set(sx, sy, @width, @height)
     # ?????????????????? 0 ???
     if @battler.dead? or @battler.hidden
       self.opacity = 0
       @trans_sprite.opacity = 0
       @bar_hp_sprite.opacity = 0
       @bar_sp_sprite.opacity = 0
     end
   self.x = @battler.screen_x
   self.y = @battler.screen_y
   self.z = @battler.screen_z
 end
 change_sp_bar if @old_sp != @battler.sp
 if delay(@delay) and @animated
     @pattern = @current_frame
     @direction = @offset_y
     sx = @pattern * @width
     sy = (@direction - 2) / 2 * @height
     self.src_rect.set(sx, sy, @width, @height)
     @current_frame = (@current_frame + 1) unless @frames == 0
     @animated = false if @current_frame == @frames and @once
     @current_frame %= @frames
     @trans_sprite.ox = self.ox
     @trans_sprite.oy = self.oy
     @trans_sprite.src_rect.set(sx, sy, @width, @height)
   end
   # ??????? ID ????????????
   if @battler.damage == nil and
      @battler.state_animation_id != @state_animation_id
     @state_animation_id = @battler.state_animation_id
     loop_animation($data_animations[@state_animation_id])
   end
   # ??????????????
   #if @battler.is_a?(Game_Actor) and @battler_visible
     # ???????????????????????
     #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
   # ??????
   unless @battler_visible
     # ??
     if not @battler.hidden and not @battler.dead? and
        (@battler.damage == nil or @battler.damage_pop)
       appear
       @battler_visible = true
     end
   end
   # ?????
   if @battler_visible
     # ??
     if @battler.hidden
       $game_system.se_play($data_system.escape_se)
       escape
       @trans_sprite.opacity = 0
       @battler_visible = false
     end
     # ??????
     if @battler.white_flash
       whiten
       @battler.white_flash = false
     end
     # ???????
     if @battler.animation_id != 0
       animation = $data_animations[@battler.animation_id]
       animation(animation, @battler.animation_hit)
       @battler.animation_id = 0
     end
     # ????
     if @battler.damage_pop
       damage(@battler.damage, @battler.critical)
       @battler.damage = nil
       @battler.critical = false
       @battler.damage_pop = false
     end
     if @bar_must_change == true
       @bar_must_change = false
       if @old_hp != @battler.hp
         change_hp_bar
       end
       if @battler.damage == nil and @battler.dead?
         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
   # ???????????
   @trans_sprite.x = self.x
   @trans_sprite.y = self.y
   @trans_sprite.z = self.z
   @bar_hp_sprite.x = @battler.screen_x - 32
   @bar_hp_sprite.y = @battler.screen_y - (@height +18) if @height != nil
   @bar_hp_sprite.z = 100
   @bar_sp_sprite.x = @battler.screen_x - 32
   @bar_sp_sprite.y = @battler.screen_y - (@height + 8) if @height != nil
   @bar_sp_sprite.z = 100
 end
 
 #--------------------------------------------------------------------------
 # - Move the sprite
 #   x : X coordinate of the destination point
 #   y : Y coordinate of the destination point
 #   speed : Speed of movement (0 = delayed, 1+ = faster)
 #   delay : Movement delay if speed is at 0
 #--------------------------------------------------------------------------
 def move(x, y, speed = 1, delay = 0)
   @destx = x
   @desty = y
   @move_speed = speed
   @move_delay = delay
   @move_old = Graphics.frame_count
   @moving = true
 end
 
 #--------------------------------------------------------------------------
 # - Move sprite to destx and desty
 #--------------------------------------------------------------------------
 def update_move
   return unless @moving
   movinc = @move_speed == 0 ? 1 : @move_speed
   if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
     self.x += movinc if self.x < @destx
     self.x -= movinc if self.x > @destx
     self.y += movinc if self.y < @desty
     self.y -= movinc if self.y > @desty
     @move_old = Graphics.frame_count
   end
   if @move_speed > 1  # Check if sprite can't reach that point
     self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
                        (@destx - self.x).abs <= @move_speed
     self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
                        (@desty - self.y).abs <= @move_speed
   end
   if self.x == @destx and self.y == @desty
     @moving = false
   end
 end
 
 #--------------------------------------------------------------------------
 # - Pause animation, but still updates movement
 #   frames : Number of frames
 #--------------------------------------------------------------------------
 def delay(frames)
   update_move
   if (Graphics.frame_count - @old >= frames)
     @old = Graphics.frame_count
     return true
   end
   return false
 end
 
 def change_hp_bar
   j = false
  @old_hp = @battler.hp if @old_hp == -1
   i = @old_hp
   loop do
     i -= 10
     if i < @battler.hp
       i = @battler.hp
       j = true
     end
     rate = i.to_f / @battler.maxhp
     @color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
     @color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
     @bar_hp_sprite.bitmap.clear
     @bar_hp_sprite.bitmap.fill_rect(0, 0, 64, 10, @color1)
     @bar_hp_sprite.bitmap.fill_rect(1, 1, 62, 8, @color2)
     @bar_hp_sprite.bitmap.gradation_rect(2, 2, 60, 6, @color3, @color4, 1)
     #@bar_hp_sprite.bitmap.fill_rect(2, 2, 60, 6, @color3)
     @bar_hp_sprite.bitmap.gradation_rect(2, 2, 64 * rate - 4, 6, @color5, @color6, 2)
     #@bar_hp_sprite.bitmap.fill_rect(2, 2, 64 * rate - 4, 6, @color5)
     @bar_hp_sprite.opacity = self.opacity
     Graphics.update
     if j == true
       j = false
       break
     end
   end
   @old_hp = @battler.hp
 end
 
 def change_sp_bar
   j = false
  @old_sp = @battler.sp if @old_sp == -1
   i = @old_sp
   loop do
     i -= 10
     if i < @battler.sp
       i = @battler.sp
       j = true
     end
     rate = i.to_f / @battler.maxsp
     @color7 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
     @color8 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
     @bar_sp_sprite.bitmap.clear
     @bar_sp_sprite.bitmap.fill_rect(0, 0, 64, 10, @color1)
     @bar_sp_sprite.bitmap.fill_rect(1, 1, 62, 8, @color2)
     @bar_sp_sprite.bitmap.gradation_rect(2, 2, 60, 6, @color3, @color4, 1)
     #@bar_hp_sprite.bitmap.fill_rect(2, 2, 60, 6, @color3)
     @bar_sp_sprite.bitmap.gradation_rect(2, 2, 64 * rate - 4, 6, @color7, @color8, 0)
     #@bar_hp_sprite.bitmap.fill_rect(2, 2, 64 * rate - 4, 6, @color5)
     @bar_sp_sprite.opacity = self.opacity
     Graphics.update
     if j == true
       j = false
       break
     end
   end
   @old_sp = @battler.sp
 end
 
 def enemy                                             #
   $target_index += $game_troop.enemies.size
   $target_index %= $game_troop.enemies.size
   return $game_troop.enemies[$target_index]           #
 end                                                   #
 
 def actor                                             #
   $target_index += $game_party.actors.size
   $target_index %= $game_party.actors.size
   return $game_party.actors[$target_index]            #
 end
 
 def index=(index)
   @index = index
   update
 end
 
   def pose(number, frames = 4)
   case number
   when 0
     change(frames, 4, 0, 4, 0)
   when 1
     change(frames, 4, 0, 4)
   when 2
     change(frames, 4, 0, 6)
   else
     change(frames, 4, 0, 0, 0)
   end
 end
 
   def enemy_pose(number ,enemy_frames = 4)
   case number
   when 0
     change(enemy_frames, 4, 0, 6, 0)
   when 1
     change(enemy_frames, 4, 0, 4)
   when 2
     change(enemy_frames, 4, 0, 6)
   else
     change(enemy_frames, 4, 0, 0, 0)
   end
 end
 
 def default_pose
   pose(0, 1)
 end
end

#==============================================================================
# ¦ Spriteset_Battle
#------------------------------------------------------------------------------
#  ???????????????????????????? Scene_Battle ??
# ????????????
#==============================================================================

class Spriteset_Battle
 #--------------------------------------------------------------------------
 # ? ??????????
 #--------------------------------------------------------------------------
 attr_reader   :viewport1                # ????????????
 attr_reader   :viewport2                # ????????????
 attr_accessor :actor_sprites
 attr_accessor :enemy_sprites
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def initialize
   # ?????????
   @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
   if $game_temp.battleback_name == ""
   @battleback_sprite = nil
   @tilemap = Tilemap.new(@viewport1)
   @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
   for i in 0..6
     autotile_name = $game_map.autotile_names
     @tilemap.autotiles = RPG::Cache.autotile(autotile_name)
   end
   @tilemap.map_data = $game_map.data
   @tilemap.priorities = $game_map.priorities
   else
   # ??????????????
   @tilemap = nil
   @battleback_sprite = Sprite.new(@viewport1)
   end
   # ????????????
   @enemy_sprites = []
   for enemy in $game_troop.enemies#.reverse
     @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
   end
   # ????????????
   @actor_sprites = []
   for j in 0..7
       # ƒAƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ð’ljÁ
       @actor_sprites.push(Sprite_Battler.new(@viewport1, $game_party.actors[j]))
   end
   # ?????
   @weather = RPG::Weather.new(@viewport1)
   # ????????????
   @picture_sprites = []
   for i in 51..100
     @picture_sprites.push(Sprite_Picture.new(@viewport3,
       $game_screen.pictures))
   end
   # ????????????
   @timer_sprite = Sprite_Timer.new
   # ??????
   update
 end
 #--------------------------------------------------------------------------
 # ? ??
 #--------------------------------------------------------------------------
 def dispose
   if @tilemap != nil
   # ?????????
   @tilemap.tileset.dispose
   for i in 0..6
     @tilemap.autotiles.dispose
   end
   @tilemap.dispose
   end
   # ??????????????
   if @battleback_sprite != nil
   # ??????????????????????
   if @battleback_sprite.bitmap != nil
     @battleback_sprite.bitmap.dispose
   end
   @battleback_sprite.dispose
   end
   # ??????????????????????
   for sprite in @enemy_sprites + @actor_sprites
     sprite.dispose
   end
   # ?????
   @weather.dispose
   # ????????????
   for sprite in @picture_sprites
     sprite.dispose
   end
   # ????????????
   @timer_sprite.dispose
   # ?????????
   @viewport1.dispose
   @viewport2.dispose
   @viewport3.dispose
   @viewport4.dispose
 end
 #--------------------------------------------------------------------------
 # ? ??????????
 #--------------------------------------------------------------------------
 def effect?
   # ??????????????? true ???
   for sprite in @enemy_sprites + @actor_sprites
     return true if sprite.effect?
   end
   return false
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
   # ???????????????????????
   if @battleback_sprite != nil
   if @battleback_name != $game_temp.battleback_name
     @battleback_name = $game_temp.battleback_name
     if @battleback_sprite.bitmap != nil
       @battleback_sprite.bitmap.dispose
     end
     bg_bitmap = RPG::Cache.battleback(@battleback_name)
     bg_bitmap_stretch = Bitmap.new(640, 480)
     bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 640, 480), bg_bitmap, bg_bitmap.rect)
     @battleback_sprite.bitmap = bg_bitmap_stretch
   end
   end
   if @tilemap != nil
   @tilemap.ox = $game_map.display_x / 4
   @tilemap.oy = $game_map.display_y / 4
   @tilemap.update
   end
   # ????????????
   for sprite in @enemy_sprites + @actor_sprites
     sprite.update
   end
   # ???????????
   @weather.type = $game_screen.weather_type
   @weather.max = $game_screen.weather_max
   @weather.update
   # ????????????
   for sprite in @picture_sprites
     sprite.update
   end
   # ????????????
   @timer_sprite.update
   # ???????????????
   @viewport1.tone = $game_screen.tone
   @viewport1.ox = $game_screen.shake
   # ????????????
   @viewport4.color = $game_screen.flash_color
   # ?????????
   @viewport1.update
   @viewport2.update
   @viewport4.update
 end
end

#==============================================================================
# ¦ Window_Command
#------------------------------------------------------------------------------
#  ?????????????????????
#==============================================================================

class Window_Command < Window_Selectable
 #--------------------------------------------------------------------------
 # ? ?????????
 #     width    : ???????
 #     commands : ??????????
 #--------------------------------------------------------------------------
 def initialize(width, commands, column_max = 1, style = 0, inf_scroll = 1)
   # ????????????????????
   super(0, 0, width, (commands.size * 1.0 / column_max).ceil * 32 + 32)
   @inf_scroll = inf_scroll
   @item_max = commands.size
   @commands = commands
   @column_max = column_max
   @style = style
   self.contents = Bitmap.new(width - 32, (@item_max * 1.0 / @column_max).ceil * 32)
   self.contents.font.name = "Tahoma"
   self.contents.font.size = 22
   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(index%@column_max * (self.width / @column_max) + 4, 32 * (index/@column_max), self.width / @column_max - 40, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[index], @style)
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #     index : ????
 #--------------------------------------------------------------------------
 def disable_item(index)
   draw_item(index, disabled_color)
 end
 
 def update_help
   @help_window.set_actor($game_party.actors[$scene.actor_index])
 end
end

#==============================================================================
# ¦ Arrow_Enemy
#------------------------------------------------------------------------------
#  ????????????????????????????? Arrow_Base ??
# ????????
#==============================================================================

class Arrow_Enemy < Arrow_Base
 #--------------------------------------------------------------------------
 # ? ?????????????????
 #--------------------------------------------------------------------------
 def enemy
   return $game_troop.enemies[@index]
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
   super
   # ???????????????????
   $game_troop.enemies.size.times do
     break if self.enemy.exist?
     @index += 1
     @index %= $game_troop.enemies.size
   end
   # ?????
   if Input.repeat?(Input::DOWN)
     $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
   end
   # ?????
   if Input.repeat?(Input::UP)
     $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
   end
   if Input.repeat?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     $game_troop.enemies.size.times do
       @index += ((($game_troop.enemies.length) * 0.5).ceil)
       @index %= $game_troop.enemies.size
       break if self.enemy.exist?
     end
   end
   if Input.repeat?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     $game_troop.enemies.size.times do
       @index += $game_troop.enemies.size - ((($game_troop.enemies.length) * 0.5).ceil)
       @index %= $game_troop.enemies.size
       break if self.enemy.exist?
     end
   end
   # ???????????
   if self.enemy != nil
     self.x = self.enemy.screen_x + 4
     self.y = self.enemy.screen_y + 36
     self.z = self.enemy.screen_z + 1
   end
 end
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def update_help
   # ????????????????????????
   @help_window.set_enemy(self.enemy)
 end
end

#==============================================================================
# ¦ Arrow_Actor
#------------------------------------------------------------------------------
#  ????????????????????????????? Arrow_Base ??
# ????????
#==============================================================================

class Arrow_Actor < Arrow_Base
 #--------------------------------------------------------------------------
 # ? ?????????????????
 #--------------------------------------------------------------------------
 def actor
   return $game_party.actors[@index]
 end
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
   super
   # ?????
   if Input.repeat?(Input::DOWN)
     $game_system.se_play($data_system.cursor_se)
     @index += 1
     @index %= $game_party.actors.size
   end
   # ?????
   if Input.repeat?(Input::UP)
     $game_system.se_play($data_system.cursor_se)
     @index += $game_party.actors.size - 1
     @index %= $game_party.actors.size
   end
   if Input.repeat?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     @index += ($game_party.actors.length * 0.5).ceil
     @index %= $game_party.actors.size
   end
   # ?????
   if Input.repeat?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     @index += $game_party.actors.size - (($game_party.actors.length * 0.5).ceil)
     @index %= $game_party.actors.size
   end
   # ???????????
   if self.actor != nil
     self.x = self.actor.screen_x
     self.y = self.actor.screen_y + 36
     self.z = self.actor.screen_z + 1
   end
 end
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def update_help
   # ??????????????????????
   @help_window.set_actor(self.actor)
 end
end

class Scene_Battle
 attr_accessor :actor_index
 def main
   # ???????????????
   $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
   # ??????????????????
   $game_system.battle_interpreter.setup(nil, 0)
   # ???????
   @troop_id = $game_temp.battle_troop_id
   $game_troop.setup(@troop_id)
   # ????????????????
   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(640, [s1, s2, s3, s4], 4)
   @actor_command_window.y = 64
   @actor_command_window.back_opacity = 160
   @actor_command_window.active = false
   @actor_command_window.visible = false
   # ????????????
   @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
   # ???????????
   @spriteset = Spriteset_Battle.new
   # ????????????
   @wait_count = 0
   # ?????????
   if $data_system.battle_transition == ""
     Graphics.transition(20)
   else
     Graphics.transition(40, "Graphics/Transitions/" +
       $data_system.battle_transition)
   end
   # ???????????
   start_phase1
   # ??????
   loop do
     # ????????
     Graphics.update
     # ???????
     Input.update
     # ??????
     update
     # ????????????????
     if $scene != self
       break
     end
   end
   # ??????????
$game_map.refresh
   # ?????????
   Graphics.freeze
   # ????????
   @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
   # ???????????
   @spriteset.dispose
   # ???????????????
   if $scene.is_a?(Scene_Title)
     # ??????????
     Graphics.transition
     Graphics.freeze
   end
   # ???????????????????????????
   if $BTEST and not $scene.is_a?(Scene_Gameover)
     $scene = nil
   end
 end
 
 def update
   # ?????????????
   if $game_system.battle_interpreter.running?
     # ?????????
     $game_system.battle_interpreter.update
     # ?????????????????????????
     if $game_temp.forcing_battler == nil
       # ?????????????????
       unless $game_system.battle_interpreter.running?
         # ??????????????????????????
         unless judge
           setup_battle_event
         end
       end
       # ????????????????
       if @phase != 5
         # ?????????????????
         #@status_window.refresh
       end
     end
   end
   # ???? (????)??????
   $game_system.update
   $game_screen.update
   # ????? 0 ??????
   if $game_system.timer_working and $game_system.timer == 0
     # ?????
     $game_temp.battle_abort = true
   end
   # ????????
   @help_window.update
   @party_command_window.update
   @actor_command_window.update
   #@status_window.update
   @message_window.update
   # ???????????
   @spriteset.update
   # ?????????????
   if $game_temp.transition_processing
     # ?????????????????
     $game_temp.transition_processing = false
     # ?????????
     if $game_temp.transition_name == ""
       Graphics.transition(20)
     else
       Graphics.transition(40, "Graphics/Transitions/" +
         $game_temp.transition_name)
     end
   end
   # ????????????????
   if $game_temp.message_window_showing
     return
   end
   # ???????????
   if @spriteset.effect?
     return
   end
   # ??????????
   if $game_temp.gameover
     # ??????????????
     $scene = Scene_Gameover.new
     return
   end
   # ???????????
   if $game_temp.to_title
     # ???????????
     $scene = Scene_Title.new
     return
   end
   # ????????
   if $game_temp.battle_abort
     # ??????? BGM ???
     $game_system.bgm_play($game_temp.map_bgm)
     # ?????
     battle_end(1)
     return
   end
   # ????????
   if @wait_count > 0
     # ????????????
     @wait_count -= 1
     return
   end
   
   # this one holds the battle while the player moves
   for actor in @spriteset.actor_sprites
     if actor.moving
       return
     end
   end
   # and this one is for the enemy...
   for enemy in @spriteset.enemy_sprites
     if enemy.moving# and $game_system.animated_enemy
       return
     end
   end
   # ???????????????????????
   # ????????????????
   if $game_temp.forcing_battler == nil and
      $game_system.battle_interpreter.running?
     return
   end
   # ??????????
   case @phase
   when 1  # ?????????
     update_phase1
   when 2  # ????????????
     update_phase2
   when 3  # ????????????
     update_phase3
   when 4  # ???????
     update_phase4
   when 5  # ???????????
     update_phase5
   end
 end
 
 def start_phase2
   # ???? 2 ???
   @phase = 2
   # ?????????????
   @actor_index = -1
   @active_battler = nil
   # ?????????????????
   @party_command_window.active = true
   @party_command_window.visible = true
   # ?????????????????
   @actor_command_window.active = false
   @actor_command_window.visible = false
   @
« Last Edit: November 02, 2007, 12:05:27 AM by savarast »
The Pessimist By The Lake In The Forest

Check Out Savarast's Resource Page, I do Requests

*
Rep:
Level 87
I suspect you've got your battle system code in one script, then the Window Battle Status code in the next script, and then Main.  So in your game they appear in the opposite order to the way you've posted them here.

Just swap them around.  I tested it out, and I put them in the same order you've provided them and didn't get an error.  On a wild hunch, I swapped the order of the two scripts around, and I got your error.

I didn't see any "level up window and tells the player what was newly learnt and which stats increased" though - it just showed the EXP and gold earned - no "level up" indicator or any other stats that increased, so maybe this only partly solves your problem.
Always remember you're unique.
Just like everybody else.

***
Rep:
Level 86
~~~
I'll try that out.

edit-- Yep, you are right. You can avoid the error message, however, the messages on level up still do not show up... anyone else have an idea how to fix that part of the problem?

btw, I like your avatar, Yuzuki fromChobits1
« Last Edit: November 02, 2007, 01:53:04 AM by savarast »
The Pessimist By The Lake In The Forest

Check Out Savarast's Resource Page, I do Requests

*
Rep:
Level 87
someone else asked me about her too.  I've no idea who she is - I got her a few years ago and when I went searching couldn't find her again.


Before I saw your post I decided to take your code out altogether and see how the battle status window worked - I see it showed the level up message after the battle, though the box that was drawn was empty (all I got was LEVEL up, no indication of what increased).  So I figured it's still not quite right.

Where do you want the boxes to appear, and what's supposed to be in them?  Is that second bit of code something you've written or did you grab it from somewhere?

ok.... in Window_BattleStatus, the update_phase5 calls phase5_next_levelup which does all of the fanfares and displaying.  In your script update_phase5 (line 1528) does none of that stuff.  I think you have a bit of work there to bring some of that functionality into your own script.
« Last Edit: November 02, 2007, 02:21:53 AM by shaz »
Always remember you're unique.
Just like everybody else.

***
Rep:
Level 86
~~~
Here is an image of the script working:

http://img.photobucket.com/albums/v724/prozzak_boy/lvlup.png?t=1193971250

Now you see the screen I'm talking about?
The Pessimist By The Lake In The Forest

Check Out Savarast's Resource Page, I do Requests

*
Rep:
Level 87
mmm - when I ran it, I got the LEVEL UP shown below the player, and I got the box shown above the player, but there was no text in it.  This was just using your Battle Status Window.

Was there another script I should have copied in, or did you make any mods to the one in your first post before placing it there?
Always remember you're unique.
Just like everybody else.

***
Rep:
Level 86
~~~
Besides the universal text mod... No, no other codes were used for this.. One sec, I'll get that code for you.

*mumbles* I didn't know it was needed for the basic things*mumbles*

Gahh! I can't find the script that is effecting this! Though if I remember correctly there was a a "fix" on postality knight's version of RPGXP that fixed the "text not showing" bug... Though I can't remember where I found that,,,


edit-- Okay, here is a working version of my tester (without the wanted battle script)

RPGXPtester
« Last Edit: November 02, 2007, 03:46:15 AM by savarast »
The Pessimist By The Lake In The Forest

Check Out Savarast's Resource Page, I do Requests

*
Rep:
Level 87
I don't have PK.  I have the legal version.  So I shouldn't have a "text not showing" bug.

Tried your link, downloaded the file, it wouldn't run.  I wouldn't worry about trying to figure that out - if it works in your game, that's all you need.

I think it's just a case of your latest and greatest update_phase5 doesn't have anything that says to show the stats.  If you can just add those in, you should be ok, but it'll be a bit more complicated than just copying & pasting, since there are instance/class variables that you might have to bring along too.
Always remember you're unique.
Just like everybody else.

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
It's simple. When your text doesn't show up, you begin looking at what may be affecting the font RGSS is being told to use.

Code: [Select]
    self.contents.font.name = $fontface
    self.contents.draw_text( 20,   0, 160, 24, "LEVEL UP!!")
    self.contents.font.size = 20
    self.contents.font.name = $fontface
    self.contents.draw_text( 0,  28+32, 160, 24, $data_system.words.hp)
    self.contents.draw_text( 0,  50+32, 160, 24, $data_system.words.sp)
    self.contents.font.size = 20
    self.contents.font.name = $fontface

As you can see, the font for the window is being changed to whatever the hell $fontface has stored in it. If shaz is using the legal version, then that would explain the problem. I don't think the legal version uses a global variable for the font, hence why $fontface would possibly be interfering. Try using Arial or Times New Roman instead of a global variable since those are fonts that a lot of people, if not everyone, has on their computer. That should fix the problem.

Now for a reason why I think $fontface is the culprit. If a variable doesn't have a value stored in it, then that variable has a value of nil, aka NOTHING. If the font is nil, then the window won't have text. At least, that's the theory from a retired scripter who's done scripting for a good 2-3 years.

*
Rep:
Level 87
cool - I'll try that, thanks.  Never thought of looking at fonts - that indicates there may be another bit to this script that hasn't been included...
Always remember you're unique.
Just like everybody else.

*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
That's most likely the problem.

As for the windows only showing up at the end of the battle, I think I can explain that.

The LVL_UP_WINDOW changes the way the window is drawn (obviously) but how it shows up is based on the lvl up flag. I may be wrong (I haven't read the script) but I think it uses a slightly different method for showing someone lvl up (thus it not including the flag). In this case, if you wanted to show the window during battle, you'd have to edit the script yourself. If I'm wrong then just ignore my ramblings. It's been forever since I've done any scripting.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."