The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: lostamongmortals on February 10, 2007, 06:58:19 AM

Title: problem with my battlers
Post by: lostamongmortals on February 10, 2007, 06:58:19 AM
so I have a problem with my battlers and can't seem to locate the problem. Here's a screenshot:

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi82.photobucket.com%2Falbums%2Fj256%2Fonecrayonshy%2Ftest.png&hash=15123e521f4e53274620f250188dfc379ecb378d)

anyone know what might be the problem?
Title: Re: problem with my battlers
Post by: &&&&&&&&&&&&& on February 10, 2007, 07:10:52 AM
orgy... my advice, get a new battle system and scrap the RTP battle system. It will make people respect your game more.
Title: Re: problem with my battlers
Post by: Blizzard on February 10, 2007, 12:44:36 PM
Open your script, pres CTRL+SHIFT+F, type "class Spriteset_Battle" and press Enter.
Post all the scripts where the search found this phrase.
Title: Re: problem with my battlers
Post by: lostamongmortals on February 10, 2007, 12:57:20 PM
@Dr_Eden: I'm using a limit break battle system along with the zoom feature.
@Dr_eadful: When I do that I get:
Spriteset_Battle (8)
zoom battle (217)
zoom battle (440)

and that's it.
Title: Re: problem with my battlers
Post by: Blizzard on February 10, 2007, 02:02:36 PM
Ok, post your Zoom battle script and I will fix it.
Title: Re: problem with my battlers
Post by: lostamongmortals on February 10, 2007, 11:00:03 PM
Here it is:


# ??? XRXS_BP 8. ???????Full-View?????? ver.2 ???
# by ?? ??

#==============================================================================
# ? ??????????
#==============================================================================
module XRXS_BP8
  #
  # ???????????? (????????????)
  #
  SPEED = 8
  #
  # ????????????????
  #
  GA = Rect.new(-192, -144, 1024, 768)  # XGA ???
  #GA = Rect.new(   0, -  0,  640, 480) # VGA ???
end
#------------------------------------------------------------------------------
#
#
#
#    ? ????? ???? ?
#
#
#
#==============================================================================
# ? XCam
#------------------------------------------------------------------------------
#   ??????????????
#==============================================================================
class XCam
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_reader   :x
  attr_reader   :y
  attr_reader   :z
  attr_accessor :x_destination
  attr_accessor :y_destination
  attr_accessor :z_destination
  attr_accessor :watch_battler
  attr_accessor :wait_count
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def initialize
    # ?????????
    @x = 320
    @y = 240
    @z = 295
    # ??????????
    self.centering
    # ???
    @wait_count = 0
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    @moved = false
    # ????????
    if @wait_count > 0
      # ????????????
      @wait_count -= 1
    else
      # ???????
      speed = XRXS_BP8::SPEED
      #
      # ???: Z ?? (??)
      #
      z_dest = @z_destination
      if @z != z_dest
        if @z < z_dest
          distance = [(z_dest - @z)/speed, 1].max
        else
          distance = [(z_dest - @z)/speed, -1].min
        end
        @z = [[@z + distance, 74].max, 296].min
        @moved = true
      end
      #
      # ???: X ??
      #
      x_dest = @watch_battler == nil ? @x_destination : @watch_battler.x
      if @x != x_dest
        if (@x - x_dest).abs < speed
          distance = x_dest - @x
        elsif @x < x_dest
          distance = [(x_dest - @x)/speed, 8].max
        else
          distance = [(x_dest - @x)/speed, -8].min
        end
        maximum = 192 * (296 - @z) / 111 + 320
        minimum = 640 - maximum
        @x = [[@x + distance, minimum].max, maximum].min
        @moved = true
      end
      #
      # ???: Y ??
      #
      y_dest = @watch_battler == nil ? @y_destination : 88 + @watch_battler.y/2
      if @y != y_dest
        if (@y - y_dest).abs < speed
          distance = y_dest - @y
        elsif @y < y_dest
          distance = [(y_dest - @y)/speed, 4].max
        else
          distance = [(y_dest - @y)/speed, -4].min
        end
        maximum = 164 * (296 - @z) / 111 + 240
        minimum = 480 - maximum
        @y = [[@y + distance, minimum].max, maximum].min
        @moved = true
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def moved?
    return @moved
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def centering
    @watch_battler = nil
    @x_destination = 320
    @y_destination = 240
    @z_destination = 185
  end
  #--------------------------------------------------------------------------
  # ? ??
  #--------------------------------------------------------------------------
  def watch(battler)
    @watch_battler = battler
    @z_destination = 176
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def zoomout
    @z_destination = 222
  end
  #--------------------------------------------------------------------------
  # ? ?? X ?????
  #--------------------------------------------------------------------------
  def watch_at(x)
    @watch_battler = nil
    @x_destination =   x
    @y_destination = 240
    @z_destination = 185
  end
end
#==============================================================================
# ? Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_reader   :x                        # ?????????????(+???)
  attr_reader   :y                        # ???????? ?? ??(+???)
  attr_reader   :z                        # ?????????????(+???)
  attr_accessor :zoom                     # ????????
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  def in_battlefield?
    return false
  end
end
#==============================================================================
# ? Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ? ?????????????? [???????]
  #--------------------------------------------------------------------------
  def in_battlefield?
    return true
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize(troop_id, member_index)
    @x    = $data_troops[troop_id].members[member_index].x
    @y    = $data_troops[troop_id].members[member_index].y
    @z    = 0
    @zoom = 1.00
    # ????
    xrxs_bp8_initialize(troop_id, member_index)
  end
  #--------------------------------------------------------------------------
  # ? ????? X ?????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_screen_x screen_x
  def screen_x
    return xrxs_bp8_screen_x if $xcam == nil
    return 320 + (xrxs_bp8_screen_x - $xcam.x) * self.zoom
  end
  #--------------------------------------------------------------------------
  # ? ????? Y ?????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_screen_y screen_y
  def screen_y
    return xrxs_bp8_screen_y if $xcam == nil
    return 240 + (xrxs_bp8_screen_y - $xcam.y) * self.zoom
  end
end
#==============================================================================
# ? Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ? ?????? (?????)
  #--------------------------------------------------------------------------
  def update_xcam
    # ???????????
    if $xcam.moved?
      # ??????????????
      zoom = 1.00 * 185 / $xcam.z
      # ???????
      @battleback_sprite.zoom_x = zoom
      @battleback_sprite.zoom_y = zoom
      @battleback_sprite.x      = -($xcam.x - 320) * zoom - 512 * (zoom - 1)
      @battleback_sprite.y      = -($xcam.y - 240) * zoom - 384 * (zoom - 1)
    end
  end
end
#==============================================================================
# --- ??????????????????? ????? ---
#==============================================================================
module XRXS_Cam_Deal
  def update
    # ????
    super
    # ????? nil ??????
    return if @battler == nil
    # ?????????????????
    return unless @battler.in_battlefield?
    # ??????????????
    return if $xcam == nil
    # ????
    @battler.z = 0 if @battler.z == nil
    # ????
    zoom = 1.00 * (185 - @battler.z) / ($xcam.z - @battler.z)
    self.zoom_x   = zoom
    self.zoom_y   = zoom
    @battler.zoom = zoom
    # ??????????????????????
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
  end
end
class Sprite_Battler < RPG::Sprite
  include XRXS_Cam_Deal
end
#==============================================================================
# --- ???????? ????? ---
#==============================================================================
module XRXS_DamageFollow
  def update
    # ????
    super
    # ???????????
    return if $xcam == nil
    # ????? nil ?????????????????
    return if @battler == nil or not @battler.in_battlefield?
    # ????????????????
    x_moved = @last_cam_x == nil ? 0 : $xcam.x - @last_cam_x
    y_moved = @last_cam_y == nil ? 0 : $xcam.y - @last_cam_y
    # ??????????????
    damage_sprites  = [@_damage_sprite]
    damage_sprites += @damage_sprites if @damage_sprites != nil
    # ????????
    for sprite in damage_sprites
      next if sprite == nil
      next if sprite.disposed?
      sprite.x -= x_moved
      sprite.y -= y_moved
    end
    # ??????????
    @last_cam_x = $xcam.x
    @last_cam_y = $xcam.y
  end
end
class Sprite_Battler < RPG::Sprite
  include XRXS_DamageFollow
end
#==============================================================================
# ? Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_main main
  def main
    # ????????
    $xcam = XCam.new
    # ??
    xrxs_bp8_main
    # ????????
    $xcam = nil
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # ????????????
    $xcam.update
    # ????
    xrxs_bp8_update
  end
end
#------------------------------------------------------------------------------
# ? ??????????
#==============================================================================
# ? Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ? ??????????????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase2 start_phase2
  def start_phase2
    # ??????????
    $xcam.centering
    # ????
    xrxs_bp8_start_phase2
  end
  #--------------------------------------------------------------------------
  # ? ?????? (???????????? : ??????)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
  def update_phase3_enemy_select
    # ?????????????
    enemy = $game_troop.enemies[@enemy_arrow.index]
    # ??????
    $xcam.watch_at(enemy.x)
    # ??
    xrxs_bp8_update_phase3_enemy_select
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_end_enemy_select end_enemy_select
  def end_enemy_select
    # ??????????
    $xcam.centering
    # ????
    xrxs_bp8_end_enemy_select
  end
  #--------------------------------------------------------------------------
  # ? ?????? (??????? ???? 2 : ???????)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase4_step2 update_phase4_step2
  def update_phase4_step2
    # ??
    xrxs_bp8_update_phase4_step2
    # ???? 3 ??????????
    if @phase4_step == 3
      # ????????????????????????
      if @active_battler.in_battlefield?
        # ??????
        $xcam.watch(@active_battler)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????? (??????? ???? 3 : ??????????)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase4_step3 update_phase4_step3
  def update_phase4_step3
    # ??
    xrxs_bp8_update_phase4_step3
    # ??????????????????? X ??????
    x_average  = 0
    number     = 0
    cam_target = nil
    for target in @target_battlers
      if target.in_battlefield?
        x_average += target.x
        number    += 1
        cam_target = target
      end
    end
    # ????????????????
    if number > 0
      # ??????????????????
      animation = $data_animations[@animation2_id]
      if animation != nil and animation.position == 3
        # ??????????
        $xcam.centering
        # ??????????
        $xcam.zoomout
      elsif number == 1
        # ??????
        $xcam.watch(cam_target)
      else
        # ?????? X ?????
        $xcam.watch_at(x_average / number)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????????????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase5 start_phase5
  def start_phase5
    # ??????????
    $xcam.centering
    # ????
    xrxs_bp8_start_phase5
  end
end






#------------------------------------------------------------------------------
#
#
#
#    ? Full-View ???? ?
#
#
#
#==============================================================================
# ? Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize
    # ????
    xrxs_bp8_initialize
    # ?????????????
    ga = XRXS_BP8::GA
    # ?????? 0 ???
    @viewport0 = Viewport.new(ga.x, ga.y, ga.width, ga.height)
    @viewport0.z  = 0
    # ?????? 1 ??????
    @viewport1.z += 1
    @viewport1.rect.height = 480
    # ??????????????? (?????? 0 ???)
    @battleback_sprite.dispose
    @battleback_sprite = Sprite.new(@viewport0)
    @battleback_name = ""
    # ?????????????
    update_battleback
  end
  #--------------------------------------------------------------------------
  # ? ??
  #--------------------------------------------------------------------------
  alias xrxs_bp8_dispose dispose
  def dispose
    # ????
    xrxs_bp8_dispose
    # ?????????
    @viewport0.dispose
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # ?????? (??????)
    update_battleback
    # ?????? (?????)
    update_xcam if defined? update_xcam
    # ????
    xrxs_bp8_update
  end
  #--------------------------------------------------------------------------
  # ? ?????? (??????)
  #--------------------------------------------------------------------------
  def update_battleback
    # ???????????????????????
    if @battleback_name != $game_temp.battleback_name
      @battleback_name = $game_temp.battleback_name
      if @battleback_sprite.bitmap != nil
        @battleback_sprite.bitmap.dispose
      end
      # ?????????????
      ga = XRXS_BP8::GA
      # ????????????
      bg   = RPG::Cache.battleback(@battleback_name)
      xga  = Bitmap.new(ga.width, ga.height)
      xga.stretch_blt(xga.rect, bg, bg.rect)
      # XGA??????????
      @battleback_sprite.bitmap = xga
    end
  end
end
#==============================================================================
# ? RPG::Sprite?????"??"????????? [???]
#==============================================================================
module RPG
  class Sprite < ::Sprite
    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 = 160 # ????????
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x  = self.x - self.ox + self.src_rect.width / 2
          sprite.y  = self.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
Title: Re: problem with my battlers
Post by: Blizzard on February 11, 2007, 02:03:35 PM
Damn... I don't see the problem with the script... Have you tried removing it and checking if it still glitchs?
Title: Re: problem with my battlers
Post by: lostamongmortals on February 15, 2007, 10:19:27 AM
tried that and it still does that. I really have no idea what to do.
Title: Re: problem with my battlers
Post by: Blizzard on February 18, 2007, 06:39:38 PM
Well, upload your Scripts.rxdata and I'll fix it then.