메뉴 건너뛰기

창조도시 기록보관소



 


전투가 끝난후 레벨업이 된 케릭터는 위의 예제처럼 스탯 포인트를 주고 그에 따라 스탯을 올립니다.
자신이 케릭을 직접 키운다는 맛이 있죠. (유사 게임 : 디아블로 및 기타 온라인 게임)

찔러넣기로 변환하였습니다. 따라서 그냥 찔러넣으세요.
클래스는 3개이고 스크립트는 1개입니다. 섹션하나 만들어서 전부 넣으세요.

#여기서부터




#==============================================================================
# ■ Window_Levelup
#------------------------------------------------------------------------------
#  커스터마이즈       programed by gunmong
#==============================================================================

class Window_Levelup < Window_Base
  LEVELUP_POINT = 10                     # 레벨업시 얻는 포인트
  HP_PER_POINT = 10                       # 보너스 1포인트당 증감되는 HP, SP 포인트
  SKILLUP_POINT = 1
  ACCEPT = 6                                   # 결정의 index

attr_accessor :actor
attr_accessor :present_level
attr_accessor :index  
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------  
  def initialize(actor, last_level)
    # 윈도우 창 초기화
    super(220, 10,200, 300)
    self.contents = Bitmap.new(width - 32, height - 32)
    # 액터 스테이터스 초기화
    @actor = actor
    @name = $data_actors[actor.id].name
    @present_level = actor.level
    @last_level = last_level
    @status = []
    @text_status = []
    @temp_status = []
    @bonus_point = (@present_level - last_level) * LEVELUP_POINT
    for i in 0...6
      @status[i] = $data_actors[actor.id].parameters[i, last_level]
      @temp_status[i] = $data_actors[actor.id].parameters[i, last_level]
    end
    # 액터 그림 로드
    @battler_pic = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    # 인덱스 초기화
    @index = 0
    refresh
    update_cursor_rect
  end
#--------------------------------------------------------------------------
# ● 리프레쉬
#--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @text_down = "◀"
    @text_up = "▶"
    @text_status[0] = $data_system.words.hp
    @text_status[1] = $data_system.words.sp
    @text_status[2] = $data_system.words.str
    @text_status[3] = $data_system.words.dex
    @text_status[4] = $data_system.words.agi
    @text_status[5] = $data_system.words.int
    @text_bonus_point = "B.point " + @bonus_point.to_s

    self.contents.blt(50, 50, @battler_pic, Rect.new(0, 0, @battler_pic.width, @battler_pic.height),150)
    
    self.contents.draw_text(0,0, 168 , 32, @name.to_s, 1)
    self.contents.draw_text(0, 25, 45, 18, "Lv. ".to_s + @present_level.to_s)  
    
    for i in 0...@status.size
      self.contents.draw_text(0, 50 + i * 30, self.contents.text_size(@text_status[i]).width, 32, @text_status[i].to_s)
      self.contents.draw_text(50, 50 + i * 30, self.contents.text_size(@text_down).width, 32, @text_down)
      self.contents.draw_text(70, 50 + i * 30, 80, 32, @temp_status[i].to_s, 1)
      self.contents.draw_text(150, 50 + i * 30, self.contents.text_size(@text_up).width, 32, @text_up)
    end
    
    self.contents.draw_text(0, 240, 110, 32, @text_bonus_point )
    self.contents.draw_text(130, 240, 40, 32, "결정" )
    
      
  end
  
#--------------------------------------------------------------------------
# ● 커서의 구형 갱신
#--------------------------------------------------------------------------
  def update_cursor_rect
    # 커서 위치가 [결정]  의 경우
    if @index == ACCEPT
      self.cursor_rect.set(130, 240, 40, 32)
    # 커서 위치가 [결정]  이외의 경우
    else
      x = 50
      y = 50 + @index * 30
      self.cursor_rect.set(x, y, 120, 32)
    end
  end
  
  
#--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    super
    # 항목 선택
    if Input.trigger?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      @index -=1 if @index > 0
    end
    if Input.trigger?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @index +=1 if @index < ACCEPT
    end
    # 수치 증감
    if Input.trigger?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      #커서가 [결정]이거나 기존 스테이터스보다 크지 않으면 수행하지 않음.
      if @index != ACCEPT and @temp_status[@index] > @status[@index]  
        # HP 또는 SP는 HP_PER_POINT를 곱한다.
        @temp_status[@index] -= 1 * HP_PER_POINT if @index < 2
        @temp_status[@index] -= 1 if @index >= 2 and @index != ACCEPT
        @bonus_point += 1
        refresh
      end
    end
    if Input.trigger?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      #커서가 [결정]이거나 기존 보너스 포인트가 1이상이 아니면 수행하지 않음.
      if @index != ACCEPT and @bonus_point > 0
        # HP 또는 SP는 HP_PER_POINT를 곱한다.
        @temp_status[@index] += 1 * HP_PER_POINT if @index < 2
        @temp_status[@index] += 1 if @index >=2 and @index != ACCEPT
        @bonus_point -= 1
        refresh
      end    
    end
    update_cursor_rect
  end
  def status(i)
    return @temp_status[i]
  end  
end


  
  
class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  alias gunmong_main main
  def main
    #레벨업 데이터 초기화
    @actor_level_list = []
    @actor_last_level = []
    gunmong_main
  end
  
  #==============================================================================
# ■ Scene_Battle (분할 정의 2)
#------------------------------------------------------------------------------
#  배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
  #--------------------------------------------------------------------------
  # ● 애프터 배틀 국면 개시
  #--------------------------------------------------------------------------
  def start_phase5
    # 국면 5 에 이행
    @phase = 5
    # 배틀 종료 ME 를 연주
    $game_system.me_play($game_system.battle_end_me)
    # 배틀 개시전의 BGM 에 되돌린다
    $game_system.bgm_play($game_temp.map_bgm)
    # EXP, 골드, 트레이닝 전기밥통을 초기화
    exp = 0
    gold = 0
    treasures = []
    # 루프
    for enemy in $game_troop.enemies
      # 에너미가 숨어 상태가 아닌 경우
      unless enemy.hidden
        # 획득 EXP, 골드를 추가
        exp += enemy.exp
        gold += enemy.gold
        # 트레이닝 전기밥통 출현 판정
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # 트레이닝 전기밥통의 수를 6 개까지 한정
    treasures = treasures[0..5]
    # EXP 획득
    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
        if actor.level > last_level
#sssssssssssssssssssssssssssssssssssssssssssssssssss
          @actor_level_list.push(actor)
          @actor_last_level.push(last_level)
#eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
          @status_window.level_up(i)
        end
      end
    end
    # 골드 획득
    $game_party.gain_gold(gold)
    # 트레이닝 전기밥통 획득
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # 배틀 결과 윈도우를 작성
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # 웨이트 카운트를 설정
    @phase5_wait_count = 100
  end

#--------------------------------------------------------------------------
  # ● 프레임 갱신 (애프터 배틀 국면)
  #--------------------------------------------------------------------------
  def update_phase5
    # 웨이트 카운트가 0 보다 큰 경우
    if @phase5_wait_count > 0
      # 웨이트 카운트를 줄인다
      @phase5_wait_count -= 1
      # 웨이트 카운트가 0 이 되었을 경우
      if @phase5_wait_count == 0
        # 결과 윈도우를 표시
        @result_window.visible = true
        # 메인 국면 플래그를 클리어
        $game_temp.battle_main_phase = false
        # 스테이터스 윈도우를 리프레쉬
        @status_window.refresh
      end
      return
    end
    # C 버튼이 밀렸을 경우
    if Input.trigger?(Input::C)
      # 배틀 종료
      battle_end(0)
    end
  end

    #--------------------------------------------------------------------------
  # ● 배틀 종료
  #     result : 결과 (0:승리 1:패배 2:도주)
  #--------------------------------------------------------------------------
  def battle_end(result)
    # 전투중 플래그를 클리어
    $game_temp.in_battle = false
    # 파티 전원의 액션을 클리어
    $game_party.clear_actions
    # 배틀용 스테이트를 해제
    for actor in $game_party.actors
      actor.remove_states_battle
    end
    # 에너미를 클리어
    $game_troop.enemies.clear
    # 배틀 콜백을 부른다
    if $game_temp.battle_proc != nil
      $game_temp.battle_proc.call(result)
      $game_temp.battle_proc = nil
    end
#ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
# 레벨업 액터가 있을경우
if not @actor_level_list.empty?
$scene = Scene_Levelup.new(@actor_level_list, @actor_last_level)
return
end
#eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
    # 맵 화면으로 전환하고
    $scene = Scene_Map.new
  end
  
end
  
  
    
    
    
    
    
    










    
    
#==============================================================================
# ■ Scene_Levelup
#------------------------------------------------------------------------------
#  레벨업시 스탯포인터를 조절하는 화면을 처리하는 클래스입니다.
#==============================================================================

class Scene_Levelup
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     menu_index : 커멘드의 커서 초기 위치
  #--------------------------------------------------------------------------
  def initialize(actor_level_list, actor_last_level)
    @actor_level_list = actor_level_list
    @actor_last_level = actor_last_level
  end
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  def main
    # 스프라이트 세트를 작성
    @spriteset = Spriteset_Battle.new
    @status_window = Window_BattleStatus.new
    # 초기 윈도우를 작성
    @edit_window = Window_Levelup.new(@actor_level_list.shift, @actor_last_level.shift)

    # 트란지션 실행
    Graphics.transition
    # 메인 루프
    loop do
      # 게임 화면을 갱신
      Graphics.update
      # 입력 정보를 갱신
      Input.update
      # 프레임 갱신
      update
      # 화면이 바뀌면 루프를 중단
      if $scene != self
        break
      end
    end
        # 트란지션 준비
    Graphics.freeze
    # 윈도우를 해방
    @spriteset.dispose
    @status_window.dispose
    @edit_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 윈도우를 갱신
    @spriteset.update
    @edit_window.update
    
    # C 버튼이 밀렸을 경우
    if Input.repeat?(Input::C) and @edit_window.index == 6
      for i in 0...6
        $data_actors[@edit_window.actor.id].parameters[i, @edit_window.present_level] = @edit_window.status(i)
      end      
      if @actor_level_list.empty?
        $scene = Scene_Map.new
      else
        @edit_window.dispose
        @edit_window = Window_Levelup.new(@actor_level_list.shift, @actor_last_level.shift)
      end
    end
  end
end




#여기까지가 한 섹션입니다.



출처 : gunmong

주의: KGC의 전투종료 화면이나 모모모의 몬스터 도감과는 호환이 안될 가능성이 90%이상이라고 봅니다.

번호 제목 글쓴이 날짜 조회 수
371 레벨에 따라 값을 더 받아보자! [5] 다크세이버™ 2006.06.05 273
370 강력한 무료 에디터 Elitpad 6.5 file 나라 2006.06.04 138
369 제 2 부 ! 나도 게임을 만들수 있다 ! [5] 다크세이버™ 2006.06.01 320
368 [스크립트기초] 제 4과. 그림표시, 배열과 해시의 클래스. [1] 천무 2006.05.24 473
367 [스크립트] 배틀포인트, 배틀샵 [1] 천무 2006.05.24 669
366 [스크립트] 창고 시스템 [9] 천무 2006.05.24 621
365 [스크립트] KGC 몬스터도감 [4] 천무 2006.05.24 795
364 [연금술사] 드디어 완성! 스크립트로 점프&데쉬하기 [5] file 천무 2006.05.24 762
363 [비밀소년] 한글이름입력기 v1.76 [6] file 천무 2006.05.24 2117
362 [비밀소년] ◆공부용◆ 01 - 숫자게이지바 [1] file 천무 2006.05.24 683
361 [툴기능] RPG XP로 액알만들기.(스샷) [10] 천무 2006.05.24 1541
360 [스크립트기초] 제 3과. 조건분기와 루프. [2] 천무 2006.05.24 222
359 [스크립트] 파티원 교체. [2] 천무 2006.05.24 424
» [스크립트] 스탯포인트로 스테이터스 조절하기입니다. 출처:gunmong [6] 천무 2006.05.24 506
357 [스크립트] 이전의 액알게이지바와는 비교도 안될 멋진 초고속 게이지바 - 그라데이션 [7] 천무 2006.05.24 879
356 [스크립트] 대화창에 이름+얼굴 띄우기: 메시지 플러스 가장 최신버전 (2005년 2월1일 버전) [4] 천무 2006.05.24 755
355 [스크립트] 소지수 한계 돌파 [1] 천무 2006.05.24 250
354 [스크립트] 대화창 크기 위치를 내맘대로! 좀더 간단화 시켰습니다.(소형윈도우 네임도 추가) [1] 천무 2006.05.24 444
353 [스크립트] 전투시 몬스터 머리위로 게이지바 만들기 [6] 천무 2006.05.24 835
352 [스크립트] 레벨과 능력치 한계를 자유자재로. 출처: 모모모 [1] 천무 2006.05.24 384