메뉴 건너뛰기

창조도시 기록보관소

스크립트 기본전투 공격시 줌인되게 하는 스크립트

2009.12.21 02:12

[안타까운현실] 조회 수:525

extra_vars1 인터넷에 굴러다니던걸 퍼다가 개조한거라 잘... 
extra_vars2 RPGXP 
extra_vars3
extra_vars4
extra_vars5  
extra_vars6  
extra_vars7  
extra_vars8  
extra_vars9  
extra_vars10  
extra_vars11  
extra_vars12  

#크헉.......... 전투 줌인 방식입뉘더..
#곰팅 만세!
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # ● 추가·공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_accessor :x_pos                    # 배틀 필드옆 위치(+가 오른쪽 )
  attr_accessor :y_pos                    # 배틀 필드 높이 위치(+가 상)
  attr_accessor :z_pos                    # 배틀 필드 깊이 위치(+가 앞)
  attr_accessor :zoom                     # 현재의 줌 배율
  attr_accessor :x_destination            # X 목적지
  attr_accessor :y_blow                   # 현재Y 날아가 속도
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 추가·공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_reader   :actor_in_battlefield     # 엑터도 필드에
  #--------------------------------------------------------------------------
  # ● 셋업
  #--------------------------------------------------------------------------
  alias xrxs_bp8_setup setup
  def setup(actor_id)
    xrxs_bp8_setup(actor_id)
    # 기능"엑터도 필드에"
    # true를 우선하는
    @actor_in_battlefield = false if @actor_in_battlefield != true
  end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● 추가·공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_reader   :actor_in_battlefield     # 엑터도 필드에
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize(troop_id, member_index)
    @actor_in_battlefield = false
    @x_pos          =   $data_troops[troop_id].members[member_index].x - 320
    @y_pos          = -($data_troops[troop_id].members[member_index].y - 304)
    @field_x_offset = -192
    @field_y_offset = -144
    @z_pos          =    0
    @zoom           = 1.00
    xrxs_bp8_initialize(troop_id, member_index)
  end
  #--------------------------------------------------------------------------
  # ● 배틀 화면 X 좌표의 취득
  #--------------------------------------------------------------------------
  def screen_x
    return 320 - @field_x_offset + (@x_pos.to_i - $xcam_x.to_i) * @zoom
  end
  #--------------------------------------------------------------------------
  # ● 배틀 화면 Y 좌표의 취득
  #--------------------------------------------------------------------------
  def screen_y
    return 240 - @field_y_offset + (-@y_pos.to_i + 64 + $xcam_y.to_i) * @zoom
  end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # 초기화
    @z_offset = 0
    # 되돌리는
    xrxs_bp8_update
    # 버틀러가 nil 의 경우 돌아오는
    return if @battler == nil
    # 적에만 카메라가 영향.
    # 견해도 배틀 필드에 있는 경우 여기의 것 if 을 제외한다.
    if (@battler.is_a?(Game_Actor) and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
      # 줌율
      zoom = 1.00 * 185 / (($xcam_z != nil ? $xcam_z : 185) - @z_offset)
      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
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias xrxs_bp8_initialize initialize
  def initialize
    # 초기화
    @now_bg_x = 0
    @now_bg_y = 0
    @now_bg_z = 185
    # 통상시의 실행
    xrxs_bp8_initialize
    # 뷰포트를 작성
    @viewport1 = Viewport.new(-192, -144, 1024, 768)
    # 배틀 백 스프라이트를 작성
    @battleback_sprite = Sprite.new(@viewport1)
    @battleback_name = ""
    # 에너미 스프라이트를 작성
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
    # 기후를 작성
    @weather = RPG::Weather.new(@viewport1)
    # 프레임 갱신
    update
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # 배틀 백의 파일명이 현재의 것과 다른 경우
    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(1024, 768)
      bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 1024, 768), bg_bitmap, bg_bitmap.rect)
      @battleback_sprite.bitmap = bg_bitmap_stretch
    end
    # 카메라 위치가 움직였을 경우
    if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
      # 줌율
      zoom = 1.00 * 185 / $xcam_z
      @battleback_sprite.zoom_x = zoom
      @battleback_sprite.zoom_y = zoom
      # 카메라z에 의한 위치의 수정
      maximum = 192 * (296 - $xcam_z) / 111
      $xcam_x = [[$xcam_x, -maximum].max, maximum].min
      # 배경 위치 갱신
      @battleback_sprite.x = -$xcam_x * zoom - 512 * (zoom - 1)
      @battleback_sprite.y =  $xcam_y * zoom - 384 * (zoom - 1)
      # 치 갱신
      @now_bg_x = $xcam_x
      @now_bg_y = $xcam_y
      @now_bg_z = $xcam_z
    end
    # 되돌리는
    xrxs_bp8_update
  end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  alias xrxs_bp8_main main
  def main
    # 카메라 초기 위치 결정
    $xcam_x = 0
    $xcam_y = 0
    $xcam_z = 295
    # 카메라의 최초의 목적치
    @xcam_x_destination = 0
    @xcam_y_destination = 0
    @xcam_z_destination = 185
    # 지금 , 주목 버틀러는 없음.
    @xcam_watch_battler = nil
    # 초기화
    @wait_count_xcam = 0
    # 되돌리는
    xrxs_bp8_main
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update update
  def update
    # 카메라 위치의 갱신.
    if @wait_count_xcam > 0
      # 웨이트 카운트를 줄이는
      @wait_count_xcam -= 1
    else
      if $xcam_z != @xcam_z_destination
        if $xcam_z < @xcam_z_destination
          distance = [(@xcam_z_destination - $xcam_z)/8, 1].max
        else
          distance = [(@xcam_z_destination - $xcam_z)/8, -1].min
        end
        $xcam_z = [[$xcam_z + distance, 74].max, 296].min
      end
      if @xcam_watch_battler != nil
        if $xcam_x != @xcam_watch_battler.x_pos
          if ($xcam_x - @xcam_watch_battler.x_pos).abs < 8
            distance = @xcam_watch_battler.x_pos - $xcam_x
          elsif $xcam_x < @xcam_watch_battler.x_pos
            distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, 8].max
          else
            distance = [(@xcam_watch_battler.x_pos - $xcam_x)/8, -8].min
          end
          maximum = 192 * (296 - $xcam_z) / 111
          $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
        end
      elsif $xcam_x != @xcam_x_destination
        if ($xcam_x - @xcam_x_destination).abs < 8
          distance = @xcam_x_destination - $xcam_x
        elsif $xcam_x < @xcam_x_destination
          distance = [(@xcam_x_destination - $xcam_x)/8, 8].max
        else
          distance = [(@xcam_x_destination - $xcam_x)/8, -8].min
        end
        maximum = 192 * (296 - $xcam_z) / 111
        $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
      end
      if @xcam_watch_battler != nil
        if $xcam_y != @xcam_watch_battler.y_pos
          if ($xcam_y - @xcam_watch_battler.y_pos).abs < 8
            distance = @xcam_watch_battler.y_pos - $xcam_y
          elsif $xcam_y < @xcam_watch_battler.y_pos
            distance = [(@xcam_watch_battler.y_pos - $xcam_y)/8, 8].max
          else
            distance = [(@xcam_watch_battler.y_pos - $xcam_y)/8, -8].min
          end
          maximum = 144 * (296 - $xcam_z) / 111
          $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min         
        end
      elsif $xcam_y != @xcam_y_destination
        if $xcam_y < @xcam_y_destination
          distance = [(@xcam_y_destination - $xcam_y)/8, 1].max
        else
          distance = [(@xcam_y_destination - $xcam_y)/8, -1].min
        end
        maximum = 164 * (296 - $xcam_z) / 111
        $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
      end
    end
    # 통상 실행
    xrxs_bp8_update
  end
  #--------------------------------------------------------------------------
  # ● 파티 커멘드 국면 개시
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase2 start_phase2
  def start_phase2
    # 카메라:센터링
    @xcam_watch_battler = nil
    @xcam_x_destination = 0
    @xcam_z_destination = 185
    # 되돌리는
    xrxs_bp8_start_phase2
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (엑터 커멘드 국면)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase3 update_phase3
  def update_phase3
    # 카메라를 캐릭터 위치에
    if @active_battler != nil and @active_battler.actor_in_battlefield
      @xcam_x_destination = @active_battler.x_pos
      @xcam_z_destination = 175
    end
    xrxs_bp8_update_phase3
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (엑터 커멘드 국면 : 에너미 선택)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
  def update_phase3_enemy_select
    # 카메라:적 타겟을 줌 업
    @xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos * $game_troop.enemies[@enemy_arrow.index].zoom
    @xcam_z_destination = 175
    # 되돌리는
    xrxs_bp8_update_phase3_enemy_select
  end
  #--------------------------------------------------------------------------
  # ● 에너미 선택 종료
  #--------------------------------------------------------------------------
  alias xrxs_bp8_end_enemy_select end_enemy_select
  def end_enemy_select
    # 카메라:중심에
    @xcam_x_destination = 0
    @xcam_z_destination = 185
    # 되돌리는
    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.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
        # 카메라:행동 버틀러에게로의 줌 업을 예약
        @xcam_x_destination = @active_battler.x_pos * @active_battler.zoom if @active_battler.x_pos != nil
        @xcam_z_destination = 175
      end
      # 최저 0 프레임 기다리는
      @wait_count = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (메인 국면 스텝 3 : 행동측 애니메이션)
  #--------------------------------------------------------------------------
  alias xrxs_bp8_update_phase4_step3 update_phase4_step3
  def update_phase4_step3
    # 되돌리는
    xrxs_bp8_update_phase4_step3
    if @target_battlers.size > 0 and
      (@target_battlers[0].is_a?(Game_Enemy) or @target_battlers[0].actor_in_battlefield)
      # 카메라:타겟에의 줌 업을 예약
      @xcam_x_destination = @target_battlers[0].x_pos * @target_battlers[0].zoom if @target_battlers[0] != nil
      @xcam_z_destination = 110
      # 만약 대상 애니메이션이 「위치:화면」의 것의 경우
      if @animation2_id > 0 and $data_animations[@animation2_id].position == 3
        # 카메라를 센터링
        @xcam_x_destination = 90
        # 줌 아웃까지 해 치우는쪂?        @xcam_z_destination = 222
      end
    end
    # 최저 0프레임 기다리는
    @wait_count = 0
  end
  #--------------------------------------------------------------------------
  # ● 애프터 배틀 국면 개시
  #--------------------------------------------------------------------------
  alias xrxs_bp8_start_phase5 start_phase5
  def start_phase5
    @xcam_z_destination = 185
    xrxs_bp8_start_phase5
  end
end
#==============================================================================
# ◇ RPG::재정의 「전투중의"화면"애니메이션의 위치 수정」
#==============================================================================
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
            if $scene.is_a?(Scene_Battle)
              sprite.x = self.viewport.rect.width / 2
              sprite.y = 304
            else
              sprite.x = self.viewport.rect.width / 2
              sprite.y = self.viewport.rect.height - 160
            end
          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
 


 


 


 이거 원본이 예전에 가지고 있다가 잃어버린 줌인 스크립트랑 조금 다르길래 그때것처럼 살짝 개조했습니다. 공격시에 확대되는건 하겠는데 적이 공격시에 확대되는건 못하겠네요..


 


 이거 VX 버젼으로 변환시켜주실 분 없나요 ㅠㅠ