메뉴 건너뛰기

창조도시 기록보관소

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

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 버젼으로 변환시켜주실 분 없나요 ㅠㅠ

번호 제목 글쓴이 날짜 조회 수
50 물가에가면 캐릭터를 반사시켜주는 스크립트 [11] file 창조도시 2007.11.05 3649
49 대화창에 이름&얼굴 띄우기 새로운방식. [2] file 창조도시 2007.11.05 2377
48 대화창에 이름&얼굴 띄우기 새로운방식. file 창조도시 2007.11.05 1535
47 새로운 게임 시작/로드 시 미묘한 연출 추가. 창조도시 2007.11.05 1332
46 vx 한글이름입력 [1] file 가가상 2008.03.03 1111
45 대화창에 얼굴 띄우기& 대화창 명령어 모음. [2] file 창조도시 2007.11.05 1110
44 맵 이름을 화면 상단에 띄우기. [1] file 창조도시 2007.11.05 1107
43 최초 시작화면에 제작자 정보를 띄워보자. [7] 창조도시 2007.11.05 1060
42 창고 시스템 [3] 창조도시 2007.11.05 1040
41 아이템창을 아이템 분류별로 나누어 지게 개조. [5] file 창조도시 2007.11.05 1026
40 액터선택지이벤트제작 간편화 스크립트 [1] Evangelista 2009.01.14 1024
39 이벤트커맨드 스크립트 관련 설명 [3] Evangelista 2009.01.27 1000
38 에너미 아이템 변화 스크립트 [1] Evangelista 2009.05.27 955
37 이벤트커맨드 스크립트 사용법 모음 [2] Evangelista 2009.01.27 937
36 이벤트커맨드 스크립트 관련 설명 Evangelista 2009.01.27 893
35 한글이름입력기 v1.76 창조도시 2007.11.05 873
34 창고 시스템 창조도시 2007.11.05 859
33 그림자문자 사용하기.. 바탕색이 무슨색이건 상관없이 글자가 잘보인다!!! 창조도시 2007.11.05 812
32 대각선 방향 이동추가로 8방향 이동 만들기. [1] 창조도시 2007.11.05 787
31 기차 파티 스크립트 [2] 창조도시 2007.11.05 781