XP 스크립트

이벤트 커멘드 「조건 분기」에서 4개째의 방어용 기구가 인식되지 않는XP자체의 버그를 수정.
이벤트 커멘드 「스크립트」로 , 1행째에 false 가 돌아가는 스크립트를 기술하면(자) 다운 당하는XP자체의 버그를 수정.
배틀 이벤트로 「문장 표시」 「애니메이션 표시」를 실시하면 이상하게 무거워지는XP자체의 버그를 수정.
전투중에 엑터를 제외해 , 재차 더하면(자) 버틀러 그래픽이 사라지는XP자체의 버그를 수정.
전투 개시 트란지션 변경 기능을 추가.
전투 배경 전체화 기능을 추가.
전투시의 스테이터스 윈도우 투과 기능을 추가.


※ Main 바로 위에 삽입해주세요.
=======================================================================



#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆기본 설정 강화 - KGC_Base Reinforce◆
#_/----------------------------------------------------------------------------
#_/  RPGXP의 기본 기능을 미묘하게 강화합니다. (버그 수정도 있어)
#_/  Reinforces some basic functions of "RPG Maker XP".
#_/  (There are some bag fixes.)
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ 커스터마이즈 항목 - Customize ★
#==============================================================================

module KGC
  # ◆전투 배경 전체화
  BR_BATTLEBACK_FULL = true
  # ◆메인 국면시에 윈도우 투과
  #  BR_BATTLEBACK_FULL 가 true 때 에 유효.
  BR_WINDOW_CLEAR_MAIN_PHASE = true
  # ◆메인 국면시에 윈도우 배경만 반투과
  #  BR_WINDOW_CLEAR_MAIN_PHASE 가 false 때 에 유효.
  BR_WINDOW_BACK_CLEAR_MAIN_PHASE = true

  # ◆전투 개시 트란지션(nil 으로 해제)
  BR_BATTLE_START_TRANSITION = "016-Diamond02"
end

#### BR_BATTLEBACK_FULL
### Makes battleback full screen.

#### BR_WINDOW_CLEAR_MAIN_PHASE
### Makes windows transparency at the Main-Phase in battle.
# When BR_BATTLEBACK_FULL is true, this is effective.

#### BR_BATTLE_START_TRANSITION
### Transition of battle beginning. (nil : release)

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["Base Reinforce"] = true

#==============================================================================
# ■ RPG::Sprite
#==============================================================================

class RPG::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 || pattern == nil || 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 / 2
        else
          sprite.x, sprite.y = 320, 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 = 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

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Sprite_Battler
#==============================================================================

class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias update_KGC_Base_Reinforce update
  def update
    # 버틀러가 nil 의 경우
    if @battler == nil
      @battler_name = nil
      @battler_hue = nil
    end

    update_KGC_Base_Reinforce
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Spriteset_Battle
#==============================================================================

if KGC::BR_BATTLEBACK_FULL
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias update_KGC_Base_Reinforce update
  def update
    # 원의 처리를 실행
    update_KGC_Base_Reinforce

    @viewport1.rect.height = 480
    # 배틀 백이 변경되었을 경우
    if @battleback_name2 != $game_temp.battleback_name
      # 전체화
      @battleback_name2 = $game_temp.battleback_name
      mag_x = 640.0 / @battleback_sprite.bitmap.width
      mag_y = 480.0 / @battleback_sprite.bitmap.height
      @battleback_sprite.zoom_x = mag_x
      @battleback_sprite.zoom_y = mag_y
    end
  end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    super
    # 메인 국면 때는 불투명도를 약간 내리는(하는 김에 윈도우 소거)
    if $game_temp.battle_main_phase
      self.contents_opacity -= 2 if self.contents_opacity > 224
      if self.opacity > 0 && KGC::BR_BATTLEBACK_FULL && KGC::BR_WINDOW_CLEAR_MAIN_PHASE
        self.opacity -= 16
      end
      if self.back_opacity > 128 && KGC::BR_BATTLEBACK_FULL && KGC::BR_WINDOW_BACK_CLEAR_MAIN_PHASE
        self.back_opacity -= 8
      end
    else
      self.contents_opacity += 2 if self.contents_opacity < 255
      if self.opacity < 255 && KGC::BR_BATTLEBACK_FULL && KGC::BR_WINDOW_CLEAR_MAIN_PHASE
        self.opacity += 16
      end
      if self.back_opacity < 255 && KGC::BR_BATTLEBACK_FULL && KGC::BR_WINDOW_BACK_CLEAR_MAIN_PHASE
        self.back_opacity += 8
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 이름의 묘화
  #--------------------------------------------------------------------------
  def draw_actor_name(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_shadow_text(x, y, 120, 32, actor.name)
  end
  #--------------------------------------------------------------------------
  # ● 스테이트의 묘화
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 120)
    text = make_battler_state_text(actor, width, true)
    self.contents.font.color = actor.dead? ? knockout_color : normal_color
    self.contents.draw_shadow_text(x, y, width, 32, text)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

class Interpreter
#==============================================================================
# ■□■□■ Interpreter 3 ■□■□■
#==============================================================================
  #--------------------------------------------------------------------------
  # ● 조건 분기
  #--------------------------------------------------------------------------
  def command_111
    # 로컬 변수 result 를 초기화
    result = false
    # 조건 판정
    case @parameters[0]
    when 0  # 스윗치
      result = ($game_switches[@parameters[1]] == (@parameters[2] == 0))
    when 1  # 변수
      value1 = $game_variables[@parameters[1]]
      if @parameters[2] == 0
        value2 = @parameters[3]
      else
        value2 = $game_variables[@parameters[3]]
      end
      case @parameters[4]
      when 0  # 와 동치
        result = (value1 == value2)
      when 1  # 이상
        result = (value1 >= value2)
      when 2  # 이하
        result = (value1 <= value2)
      when 3  # 초
        result = (value1 > value2)
      when 4  # 미만
        result = (value1 < value2)
      when 5  # 이외
        result = (value1 != value2)
      end
    when 2  # 셀프 스윗치
      if @event_id > 0
        key = [$game_map.map_id, @event_id, @parameters[1]]
        if @parameters[2] == 0
          result = ($game_self_switches[key] == true)
        else
          result = ($game_self_switches[key] != true)
        end
      end
    when 3  # 타이머
      if $game_system.timer_working
        sec = $game_system.timer / Graphics.frame_rate
        if @parameters[2] == 0
          result = (sec >= @parameters[1])
        else
          result = (sec <= @parameters[1])
        end
      end
    when 4  # 엑터
      actor = $game_actors[@parameters[1]]
      if actor != nil
        case @parameters[2]
        when 0  # 파티에 있는
          result = ($game_party.actors.include?(actor))
        when 1  # 이름
          result = (actor.name == @parameters[3])
        when 2  # 스킬
          result = (actor.skill_learn?(@parameters[3]))
        when 3  # 무기
          result = (actor.weapon_id == @parameters[3])
        when 4  # 방어용 기구
          result = (actor.armor1_id == @parameters[3] or
                    actor.armor2_id == @parameters[3] or
                    actor.armor3_id == @parameters[3] or
                    actor.armor4_id == @parameters[3])
        when 5  # 스테이트
          result = (actor.state?(@parameters[3]))
        end
      end
    when 5  # 에너미
      enemy = $game_troop.enemies[@parameters[1]]
      if enemy != nil
        case @parameters[2]
        when 0  # 출현하고 있는
          result = (enemy.exist?)
        when 1  # 스테이트
          result = (enemy.state?(@parameters[3]))
        end
      end
    when 6  # 캐릭터
      character = get_character(@parameters[1])
      if character != nil
        result = (character.direction == @parameters[2])
      end
    when 7  # 골드
      if @parameters[2] == 0
        result = ($game_party.gold >= @parameters[1])
      else
        result = ($game_party.gold <= @parameters[1])
      end
    when 8  # 아이템
      result = ($game_party.item_number(@parameters[1]) > 0)
    when 9  # 무기
      result = ($game_party.weapon_number(@parameters[1]) > 0)
    when 10  # 방어용 기구
      result = ($game_party.armor_number(@parameters[1]) > 0)
    when 11  # 버튼
      result = (Input.press?(@parameters[1]))
    when 12  # 스크립트
      result = eval(@parameters[1])
    end
    # 판정 결과를 해시에 격납
    @branch[@list[@index].indent] = result
    # 판정 결과가 진이었던 경우
    if @branch[@list[@index].indent] == true
      # 분기 데이터를 삭제
      @branch.delete(@list[@index].indent)
      # 계속
      return true
    end
    # 조건에 해당하지 않는 경우 : 커멘드 스킵
    return command_skip
  end
#==============================================================================
# ■□■□■ Interpreter 7 ■□■□■
#==============================================================================
  #--------------------------------------------------------------------------
  # ● 스크립트
  #--------------------------------------------------------------------------
  def command_355
    # script 에 1 행목을 설정
    script = @list[@index].parameters[0] + "n"
    # 루프
    loop {
      # 다음의 이벤트 커멘드가 스크립트 2 행 눈 이후의 경우
      if @list[@index+1].code == 655
        # script 에 2 행목 이후를 추가
        script += @list[@index+1].parameters[0] + "n"
      # 이벤트 커멘드가 스크립트 2 행 눈 이후가 아닌 경우
      else
        # 루프 중단
        break
      end
      # 인덱스를 진행시키는
      @index += 1
    }
    # 평가
    result = eval(script)
    # 계속
    return true
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

class Scene_Battle
#==============================================================================
# ■□■□■ Scene_Battle 1 ■□■□■
#==============================================================================
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  def main
    # 트란지션 실행
    if KGC::BR_BATTLE_START_TRANSITION != nil
      Graphics.transition(40, "Graphics/Transitions/" + KGC::BR_BATTLE_START_TRANSITION)
    end
    # 트란지션 준비
    Graphics.freeze
    # 전투용의 각종 일시 데이터를 초기화
    $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
    # 배틀 이벤트용 interpreter를 초기화
    $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(160, [s1, s2, s3, s4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # 그 외의 윈도우를 작성
    @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 if @actor_command_window != nil
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    @skill_window.dispose if @skill_window != nil
    @item_window.dispose if @item_window != nil
    @result_window.dispose if @result_window != nil
    # 스프라이트 세트를 해방
    @spriteset.dispose
    # 타이틀 화면으로 전환하고 안의 경우
    if $scene.is_a?(Scene_Title)
      # 화면을 페이드아웃
      Graphics.transition
      Graphics.freeze
    end
    # 전투 테스트로부터 게임 오버 화면 이외에 바꾸고 안의 경우
    if $BTEST && !$scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 배틀 이벤트 실행중의 경우
    if $game_system.battle_interpreter.running?
      @running = true
      # interpreter를 갱신
      $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 && !@message_window.visible && !@spriteset.effect?
          # 스테이터스 윈도우를 리프레쉬
          @status_window.refresh
        end
      end
    elsif @running
      # 스테이터스 윈도우를 리프레쉬
      @status_window.refresh
      @running = false
    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 if @actor_command_window != nil
    @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
    # 액션을 강제당하고 있는 버틀러가 존재하지 않고 ,
    # 한편 배틀 이벤트가 실행중의 경우
    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
  #--------------------------------------------------------------------------
  # ● 배틀 종료
  #    result : 결과 (0:승리 1:도주 2:패배)
  #--------------------------------------------------------------------------
  alias battle_end_KGC_Base battle_end
  def battle_end(result)
    # 오토 스테이트를 갱신
    for actor in $game_party.actors
      for i in 1...($imported["EquipExtension"] ? actor.equip_type.size : 5)
        actor.update_auto_state(nil, $data_armors[
          $imported["EquipExtension"] ? actor.armor_id[i] :
          eval("actor.armor#{i}_id")])
      end
    end

    # 원의 처리를 실행
    battle_end_KGC_Base(result)
  end
end

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
721 이동 및 탈것 Mouse_move file 백호 2009.02.21 921
» 기타 [KGC]강화스크립트 백호 2009.02.21 1667
719 이동 및 탈것 마우스 이동 조금 뜯어봤습니다. file 백호 2009.02.21 1680
718 전투 시뮬레이션 턴알 3 file 백호 2009.02.21 3053
717 이동 및 탈것 Mouse_move 호환버전 1 file 백호 2009.02.21 1059
716 기타 레벨9999스크립트 4 백호 2009.02.21 1151
715 이동 및 탈것 Mouse_move 호환 100%강화버전 4 file 백호 2009.02.21 1512
714 메시지 문자 메세지 띄우기 스크립트 10 file 백호 2009.02.21 3069
713 이동 및 탈것 젤다 스타일 맵스크롤 5 file 백호 2009.02.21 1838
712 메뉴 Tales Of Symphonia Menu 8 file 백호 2009.02.21 1744
711 장비 [KGC]장비 제한(레벨,완력등등) 7 file 백호 2009.02.21 1780
710 기타 [KGC]HP&SP게이지 색다른것(글씨와 게이지가 안겹침) 10 file 백호 2009.02.21 2732
709 아이템 아이템 정리기능 S크립T 1 file 백호 2009.02.21 1080
708 기타 무기& 방어구 레벨제한 스크립트 23 file 백호 2009.02.21 1880
707 HUD 직업명띄우기 스크립트 2 백호 2009.02.21 1123
706 전투 A-battle 수정 file 백호 2009.02.21 1155
705 기타 말걸면그림천천히뜨기 4 file 백호 2009.02.21 1101
704 전투 횡스크롤형식의 스크립트 7 백호 2009.02.21 2942
703 HUD 새로운방법의 맵이름 표시 31 file 백호 2009.02.21 4617
702 메뉴 제가 쓰는 메뉴 14 file 백호 2009.02.21 2318
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ... 52 Next
/ 52