RPGXP 스크립트
2013.09.24 08:28

장비제련 스크립트

조회 수 1024 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
#아이템 제련 스크립트, 테스트 -_-; ( 스크립트가 좀 길어요 -_-; )
# 참고 : 장비수를 늘리는 스크립트를 사용하신분들은 스크립트를 수정해야합니다.
#
# 사용법 방법은 글과 같이 있지만 여기 주석에도 올립니다.
# 일단 수정해야할 부분이 있습니다. Game_System으로 가주세요.
#
#  attr_accessor :new_weapons                  # 추가 무기
#  attr_accessor :new_armors1                  # 추가 방어구1
#  attr_accessor :new_armors2                  # 추가 방어구2
#  attr_accessor :new_armors3                  # 추가 방어구3
#  attr_accessor :new_armors4                  # 추가 방어구4
#
# 위 5줄을 공개 인스턴스 변수쪽 끝에... 그니까 아래처럼; ( 앞에 주석은 쓰지마세요. )
#
#  attr_accessor :magic_number             # magic number- 
#  attr_accessor :new_weapons                  # 추가 무기
#  attr_accessor :new_armors1                  # 추가 방어구1
#  attr_accessor :new_armors2                  # 추가 방어구2
#  attr_accessor :new_armors3                  # 추가 방어구3
#  attr_accessor :new_armors4                  # 추가 방어구4
#
# 이렇게 넣어줍니다. 그리고 오브젝트 초기화 끝쪽
# @maigc_number = 0 이거 아래줄에
#
# @new_weapons = []
# @new_armors1 = []
# @new_armors2 = []
# @new_armors3 = []
# @new_armors4 = []
#
# 이렇게 집어 넣습니다.
# 그리고 Scene_Save로 가서
# Marshal.dump($data_weapons, file)
# Marshal.dump($data_armors, file)
# Marshal.dump($data_items, file)
#
# 위와 비슷한것이 있는곳에 위 스크립트를 넣어줍니다.
#
# 그리고 Scene_Load로 가서
# $data_weapons        = Marshal.load(file)
# $data_armors        = Marshal.load(file)
# $data_items        = Marshal.load(file)
#
# 역시 위와 비슷한것이 있는곳에 위 스크립트를 넣어줍니다.
#
# 그리고 Main 위쪽에 삽입(Ins=Insert키)을해서
# 새 스크립트란을 만들어주고 이 스크립트를 전부 집어넣습니다.
#
# 이제 준비는 끝났습니다.
# 이 스크립트를 불러올려면 $scene = Scene_제련.new 이라고 스크립트를
# 사용해서 이 스크립트를 가져오면됩니다.
#=======================================================
class Scene_제련
  def main
    #기본 설정
    @lose_item_id = 23 #제련시 필요한 아이템의 아이템ID - 아이템이 하나씩 감소됩니다;
    @lose_money = 500 #제련시 필요한 돈 - 돈이 감소됩니다 -_-;(당연한건가?)
    @money_string = "5실버가 필요합니다." #얼마 필요한지 뜨는 텍스트 -_-;
    
    @help_window = Window_Help.new
    @spriteset = Spriteset_Map.new 
    # 커멘드 윈도우를 작성 
    bmp = RPG::Cache.character($game_party.actors[0].character_name, 0) 
    px = $game_player.screen_x 
    py = $game_player.screen_y - bmp.rect.height / 4 / 2 
    
    @actor = $game_party.actors[0]
    
    @data = []
    @data.push($data_weapons[@actor.weapon_id])
    @data.push($data_armors[@actor.armor1_id])
    @data.push($data_armors[@actor.armor2_id])
    @data.push($data_armors[@actor.armor3_id])
    @data.push($data_armors[@actor.armor4_id])
    @item_max = @data.size
    
    if @data[0].to_s == ""
      @data[0] = "무기 없음"
      s1 = sprintf("%s : %s",$data_system.words.weapon,@data[0].to_s)
      @s1_disible = false
    else @data[0].to_s != ""
      @data[0] = @data[0].name
      s1 = sprintf("%s : %s",$data_system.words.weapon,@data[0].to_s)
      @s1_disible = true
    end
    
    if @data[1].to_s == ""
      @data[1] = "방어구1 없음"
      s2 = sprintf("%s : %s",$data_system.words.armor1,@data[1].to_s)
      @s2_disible = false
    else @data[1].to_s != ""
      @data[1] = @data[1].name
      s2 = sprintf("%s : %s",$data_system.words.armor1,@data[1].to_s)
      @s2_disible = true
    end
    
    if @data[2].to_s == ""
      @data[2] = "방어구2 없음"
      s3 = sprintf("%s : %s",$data_system.words.armor2,@data[2].to_s)
      @s3_disible = false
    else @data[2].to_s != ""
      @data[2] = @data[2].name
      s3 = sprintf("%s : %s",$data_system.words.armor2,@data[2].to_s)
      @s3_disible = true
    end

    if @data[3].to_s == ""
      @data[3] = "방어구3 없음"
      s4 = sprintf("%s : %s",$data_system.words.armor3,@data[3].to_s)
      @s4_disible = false
    else @data[3].to_s != ""
      @data[3] = @data[3].name
      s4 = sprintf("%s : %s",$data_system.words.armor3,@data[3].to_s)
      @s4_disible = true
    end

    if @data[4].to_s == ""
      @data[4] = "방어구4 없음"
      s5 = sprintf("%s : %s",$data_system.words.armor4,@data[4].to_s)
      @s5_disible = false
    else @data[4].to_s != ""
      @data[4] = @data[4].name
      s5 = sprintf("%s : %s",$data_system.words.armor4,@data[4].to_s)
      @s5_disible = true
    end
    
    @selc_window = Window_Command.new(300,[s1, s2, s3, s4, s5, "그만두기"]) 
    @selc_window.back_opacity = 160 
    @selc_window.x = 10 
    @selc_window.y = 100 
    @selc_window.active = true 
    @selc_window.visible = true 
    @selc_window.index = 0 
    @item_window = Window_제련아템창.new
    @item_window.active = false
    @item_window.back_opacity = 160
    @item_window.x = 30 
    @item_window.y = 140 
    @item_window.active = false 
    @item_window.visible = false 
    @yn_win = Window_Command.new(100,["예","아니오"])
    @yn_win.x = 320
    @yn_win.y = 240
    @yn_win.active = false 
    @yn_win.visible = false 
    
    # 없는 아이템은 선택창 디시블
    unless @s1_disible
      @selc_window.disable_item(0)
    end
    unless @s2_disible
      @selc_window.disable_item(1)
    end
    unless @s3_disible
      @selc_window.disable_item(2)
    end
    unless @s4_disible
      @selc_window.disable_item(3)
    end
    unless @s5_disible
      @selc_window.disable_item(4)
    end
    
    # 트란지션 실행 
    Graphics.transition 
    # 메인 루프 
    loop do 
      # 게임 화면을 갱신 
      Graphics.update 
      # 입력 정보를 갱신 
      Input.update 
      # 프레임 갱신 
      update
      # 화면이 바뀌면(자) 루프를 중단 
      if $scene != self
        break 
      end 
    end 

    # 트란지션 준비 
    Graphics.freeze 
    @spriteset.dispose 
    @selc_window.dispose 
    @help_window.dispose
    @item_window.dispose
    @yn_win.dispose
  end 
#-------------------------------------------------------------------------- 
# ● 프레임 갱신 
#-------------------------------------------------------------------------- 
def update 
# 윈도우를 갱신 
@selc_window.update 
@item_window.update 
@help_window.update
@yn_win.update 
# 아이템 윈도우가 액티브의 경우: update_item 를 부른다 
if @selc_window.active 
update_Scene 
return 
end
if @item_window.active
update_item
return
end
if @yn_win.active
update_yn
return
end
end 
#-------------------------------------------------------------------------- 
# ● 프레임 갱신 
#-------------------------------------------------------------------------- 
  def update_item
    @help_window.set_text("제련할 아이템을 선택해주세요.")
    # B 버튼이 밀렸을 경우
    if Input.trigger? (Input::B)
      # 캔슬 SE 를 연주
      $game_system.se_play($data_system.cancel_se)
      # 라이트 윈도우를 액티브화
      @selc_window.active = true
      @selc_window.visible = true
      @item_window.active = false
      @item_window.visible = false
      @item_window.index = 0
      @help_window.set_text("제련할 아이템을 선택해주세요.")
      return
    end
    # C 버튼이 밀렸을 경우
    if Input.trigger? (Input::C)
      #SE 를 연주
      $game_system.se_play($data_system.decision_se) 
      @yn_win.active = true
      @yn_win.visible = true
      @item_window.active = false
      @item_window.back_opacity = 160
      @help_window.set_text("이 아이템으로 제련합니까? ("+@money_string+")")
      @item = @item_window.item
      return
    end
  end

  
def update_Scene
case @selc_window.index
when 0
  if $data_armors[@actor.armor1_id] != nil
    text = $data_weapons[@actor.weapon_id].name+"을 제련한다."
  else
    text = "제련할 아이템이 없습니다."
  end
  @help_window.set_text(text,2)
when 1
  if $data_armors[@actor.armor1_id] != nil
    text = $data_armors[@actor.armor1_id].name+"을 제련한다."
  else
    text = "제련할 아이템이 없습니다."
  end
  @help_window.set_text(text,2)
when 2
  if $data_armors[@actor.armor2_id] != nil
    text = $data_armors[@actor.armor2_id].name+"을 제련한다."
  else
    text = "제련할 아이템이 없습니다."
  end
  @help_window.set_text(text,2)
when 3
  if $data_armors[@actor.armor3_id] != nil
    text = $data_armors[@actor.armor3_id].name+"을 제련한다."
  else
    text = "제련할 아이템이 없습니다."
  end
  @help_window.set_text(text,2)
when 4
  if $data_armors[@actor.armor4_id] != nil
    text = $data_armors[@actor.armor4_id].name+"을 제련한다."
  else
    text = "제련할 아이템이 없습니다."
  end
  @help_window.set_text(text,2)
when 5
  @help_window.set_text("",2)
end
# B 버튼이 밀렸을 경우 
if Input.trigger?(Input::B) 
# 캔슬 SE 을 연주 
$game_system.se_play($data_system.cancel_se) 
# 커멘드 윈도우를 액티브하게 하는 
$scene = Scene_Map.new 
return 
end 
# C 버튼이 밀렸을 경우 
if Input.trigger?(Input::C) 
$game_system.se_play($data_system.decision_se) 
case @selc_window.index 
when 0 #1
  unless @s1_disible
    $game_system.se_stop
    # 버저 SE 를 연주
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  @selc_window.active = false
  @selc_window.visible = false
  @item_window.active = true
  @item_window.visible = true
  @help_window.set_text("제련할 아이템을 선택해주세요.")
when 1 #2
  unless @s2_disible
    $game_system.se_stop
    # 버저 SE 를 연주
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  $scene = Scene_Map.new
when 2 #3
  unless @s3_disible
    $game_system.se_stop
    # 버저 SE 를 연주
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  @selc_window.active = false
  @selc_window.visible = false
  @item_window.active = true
  @item_window.visible = true
  @help_window.set_text("제련할 아이템을 선택해주세요.")
when 3 #4
  unless @s4_disible
    $game_system.se_stop
    # 버저 SE 를 연주
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  @selc_window.active = false
  @selc_window.visible = false
  @item_window.active = true
  @item_window.visible = true
  @help_window.set_text("제련할 아이템을 선택해주세요.")
when 4 #5
  unless @s5_disible
    $game_system.se_stop
    # 버저 SE 를 연주
    $game_system.se_play($data_system.buzzer_se)
    return
  end
  @selc_window.active = false
  @selc_window.visible = false
  @item_window.active = true
  @item_window.visible = true
  @help_window.set_text("제련할 아이템을 선택해주세요.")
when 5 #6
  $scene = Scene_Map.new
return 
end 
end 
end 

def update_yn
# B 버튼이 밀렸을 경우 
if Input.trigger?(Input::B) 
  # 캔슬 SE 을 연주 
  $game_system.se_play($data_system.cancel_se) 
  # 커멘드 윈도우를 액티브하게 하는 
  @yn_win.index = 0
  @yn_win.active = false
  @yn_win.visible = false
  @item_window.active = true
  @item_window.visible = true
  @item_window.back_opacity = 160
  @help_window.set_text("제련할 아이템을 선택해주세요.")
  return 
end 
# C 버튼이 밀렸을 경우 
if Input.trigger?(Input::C) 
$game_system.se_play($data_system.decision_se) 
case @yn_win.index 
when 0 #1
  @yn_win.index = 0
  if @item.id==@lose_item_id
    if $game_party.gold<@lose_money
      Audio.se_play("Audio/SE/009-System09", 100, 100)
      @help_window.set_text("돈이 모자랍니다.",1)
      return
    end
    $game_party.lose_item(@lose_item_id, 1)
    $game_party.lose_gold(@lose_money)
    Audio.se_play("Audio/SE/007-System07", 100, 100)
    case @selc_window.index
    when 0 #무기
      #==========수정 필요==========#
      main_item = $data_weapons
      item = $data_weapons[@actor.weapon_id].clone
      item_size = $data_weapons.size
      new_item_list = $game_system.new_weapons
      text = "[제련형]" #제작된 아이템의 설명에 들어갈 텍스트
      equip_type = 0
      #==========수정 필요==========#
      setup = $data_classes
      job_last = $data_classes.size-1
      #제련횟수와 아이템이름을 잘라낸다.
      number = item.name.gsub(/D/) {""}
      itemname = item.name.gsub(/d/) {""}
      #다음 제련횟수를 구한다.
      next_number = number.to_i+1
      #다음 제련횟수를 합한 아이템명을 구한다.
      next_itemname = itemname.to_s+"+"+next_number.to_s
      next_itemname2 = itemname.to_s+next_number.to_s
      #다음 아이디를 구한다.
      next_id = item_size+1
      
      #아이템이 이미 생성되어 있다면 그걸로 바꿔준다.
      if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_weapon(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_weapon(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname2)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname2
            #==========수정 필요==========#
            $game_party.gain_weapon(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_weapon(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_weapon(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_weapon(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      #아이템이 생성되어 있지 않다면 새로 만든다.
      else new_item_list.include?(next_itemname)==false
        #아이템 ID의 공백을 찾는다.
        for check in 1..item_size
          if main_item[check] == nil
            null_id = check
            break
          end
        end
        #공백 ID가 없을경우. 전체에서 다시 찾는다.
        if null_id == nil
          check = 1
          loop do
            if main_item[check] == nil
              null_id = check
              break
            end
            check += 1
          end
        end
        
        #아이템 제작을 시작한다.
        main_item[null_id] = item.clone
        main_item[null_id].id = item.clone
        main_item[null_id].name = item.name.clone
        main_item[null_id].description = item.description.clone
        
        main_item[null_id].id = null_id
        
        if main_item[null_id].name.include?("+") == false
          main_item[null_id].name = next_itemname
        else main_item[null_id].name.include?("+") == true
          main_item[null_id].name = next_itemname2
        end
        if main_item[null_id].description.include?(text) == false
          main_item[null_id].description = main_item[null_id].description+text
        end
        item_size = null_id+1
        
        #테스트
        #p main_item[null_id].id
        #p main_item[null_id].name
        #p main_item[null_id].description
        #p item_size
        
        #==========수정 필요==========# #무기 능력치 수정#
        # 변경될 옵션값 : 기본 : ATK(공격력을 기본+10%
        main_item[null_id].pdef = main_item[null_id].pdef+(main_item[null_id].pdef/10).floor
        main_item[null_id].mdef = main_item[null_id].mdef+(main_item[null_id].mdef/10).floor
        main_item[null_id].price = main_item[null_id].price+(main_item[null_id].price/10).floor
        if main_item[null_id].int_plus > 0
          main_item[null_id].int_plus += 1
        end
        if main_item[null_id].agi_plus > 0
          main_item[null_id].agi_plus += 1
        end
        if main_item[null_id].dex_plus > 0
          main_item[null_id].dex_plus += 1
        end
        if main_item[null_id].str_plus > 0
          main_item[null_id].str_plus += 1
        end
        $game_party.gain_weapon(null_id, 1)
        #장비를 변경하고, 빠진 아이템을 제거한다.
        @actor.equip(equip_type, null_id)
        $game_party.lose_weapon(item.id, 1)
        for item_set in 1..job_last
          setup[item_set].weapon_set.push(null_id)
        end
        #==========수정 필요==========#
        
        # 새 아이템이 생겼다는것을 갱신한다.
        new_item_list.push(main_item[null_id].name)
      end
      end
      end
    when 1 #방패
      #==========수정 필요==========#
      main_item = $data_armors
      item = $data_armors[@actor.armor1_id].clone
      item_size = $data_armors.size
      new_item_list = $game_system.new_armors1
      text = "[제련형]" #제작된 아이템의 설명에 들어갈 텍스트
      equip_type = 1
      #==========수정 필요==========#
      setup = $data_classes
      job_last = $data_classes.size-1
      #제련횟수와 아이템이름을 잘라낸다.
      number = item.name.gsub(/D/) {""}
      itemname = item.name.gsub(/d/) {""}
      #다음 제련횟수를 구한다.
      next_number = number.to_i+1
      #다음 제련횟수를 합한 아이템명을 구한다.
      next_itemname = itemname.to_s+"+"+next_number.to_s
      next_itemname2 = itemname.to_s+next_number.to_s
      #다음 아이디를 구한다.
      next_id = item_size+1
      
      #아이템이 이미 생성되어 있다면 그걸로 바꿔준다.
      if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname2)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname2
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      #아이템이 생성되어 있지 않다면 새로 만든다.
      else new_item_list.include?(next_itemname)==false
        #아이템 ID의 공백을 찾는다.
        for check in 1..item_size
          if main_item[check] == nil
            null_id = check
            break
          end
        end
        #공백 ID가 없을경우. 전체에서 다시 찾는다.
        if null_id == nil
          check = 1
          loop do
            if main_item[check] == nil
              null_id = check
              break
            end
            check += 1
          end
        end
        
        #아이템 제작을 시작한다.
        main_item[null_id] = item.clone
        main_item[null_id].id = item.clone
        main_item[null_id].name = item.name.clone
        main_item[null_id].description = item.description.clone
        
        main_item[null_id].id = null_id
        
        if main_item[null_id].name.include?("+") == false
          main_item[null_id].name = next_itemname
        else main_item[null_id].name.include?("+") == true
          main_item[null_id].name = next_itemname2
        end
        if main_item[null_id].description.include?(text) == false
          main_item[null_id].description = main_item[null_id].description+text
        end
        item_size = null_id+1
        
        #테스트
        #p main_item[null_id].id
        #p main_item[null_id].name
        #p main_item[null_id].description
        #p item_size
        
        #==========수정 필요==========# #방어구1 능력치 수정#
        # 변경될 옵션값 : 기본 : Pdef,Mdef(물리,마법방어을 기본+10%
        main_item[null_id].pdef = main_item[null_id].pdef+(main_item[null_id].pdef/10).floor
        main_item[null_id].mdef = main_item[null_id].mdef+(main_item[null_id].mdef/10).floor
        main_item[null_id].price = main_item[null_id].price+(main_item[null_id].price/10).floor
        if main_item[null_id].int_plus > 0
          main_item[null_id].int_plus += 1
        end
        if main_item[null_id].agi_plus > 0
          main_item[null_id].agi_plus += 1
        end
        if main_item[null_id].dex_plus > 0
          main_item[null_id].dex_plus += 1
        end
        if main_item[null_id].str_plus > 0
          main_item[null_id].str_plus += 1
        end
        $game_party.gain_armor(null_id, 1)
        #장비를 변경하고, 빠진 아이템을 제거한다.
        @actor.equip(equip_type, null_id)
        $game_party.lose_armor(item.id, 1)
        for item_set in 1..job_last
          setup[item_set].armor_set.push(null_id)
        end
        #==========수정 필요==========#
        
        # 새 아이템이 생겼다는것을 갱신한다.
        new_item_list.push(main_item[null_id].name)
      end
      end
      end
    when 2 #머리
      #==========수정 필요==========#
      main_item = $data_armors
      item = $data_armors[@actor.armor2_id].clone
      item_size = $data_armors.size
      new_item_list = $game_system.new_armors2
      text = "[제련형]" #제작된 아이템의 설명에 들어갈 텍스트
      equip_type = 2
      #==========수정 필요==========#
      setup = $data_classes
      job_last = $data_classes.size-1
      #제련횟수와 아이템이름을 잘라낸다.
      number = item.name.gsub(/D/) {""}
      itemname = item.name.gsub(/d/) {""}
      #다음 제련횟수를 구한다.
      next_number = number.to_i+1
      #다음 제련횟수를 합한 아이템명을 구한다.
      next_itemname = itemname.to_s+"+"+next_number.to_s
      next_itemname2 = itemname.to_s+next_number.to_s
      #다음 아이디를 구한다.
      next_id = item_size+1
      
      #아이템이 이미 생성되어 있다면 그걸로 바꿔준다.
      if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname2)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname2
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      #아이템이 생성되어 있지 않다면 새로 만든다.
      else new_item_list.include?(next_itemname)==false
        #아이템 ID의 공백을 찾는다.
        for check in 1..item_size
          if main_item[check] == nil
            null_id = check
            break
          end
        end
        #공백 ID가 없을경우. 전체에서 다시 찾는다.
        if null_id == nil
          check = 1
          loop do
            if main_item[check] == nil
              null_id = check
              break
            end
            check += 1
          end
        end
        
        #아이템 제작을 시작한다.
        main_item[null_id] = item.clone
        main_item[null_id].id = item.clone
        main_item[null_id].name = item.name.clone
        main_item[null_id].description = item.description.clone
        
        main_item[null_id].id = null_id
        
        if main_item[null_id].name.include?("+") == false
          main_item[null_id].name = next_itemname
        else main_item[null_id].name.include?("+") == true
          main_item[null_id].name = next_itemname2
        end
        if main_item[null_id].description.include?(text) == false
          main_item[null_id].description = main_item[null_id].description+text
        end
        item_size = null_id+1
        
        #테스트
        #p main_item[null_id].id
        #p main_item[null_id].name
        #p main_item[null_id].description
        #p item_size
        
        #==========수정 필요==========# #방어구2 능력치 수정#
        # 변경될 옵션값 : 기본 : Pdef,Mdef(물리,마법방어을 기본+10%
        main_item[null_id].pdef = main_item[null_id].pdef+(main_item[null_id].pdef/10).floor
        main_item[null_id].mdef = main_item[null_id].mdef+(main_item[null_id].mdef/10).floor
        main_item[null_id].price = main_item[null_id].price+(main_item[null_id].price/10).floor
        if main_item[null_id].int_plus > 0
          main_item[null_id].int_plus += 1
        end
        if main_item[null_id].agi_plus > 0
          main_item[null_id].agi_plus += 1
        end
        if main_item[null_id].dex_plus > 0
          main_item[null_id].dex_plus += 1
        end
        if main_item[null_id].str_plus > 0
          main_item[null_id].str_plus += 1
        end
        $game_party.gain_armor(null_id, 1)
        #장비를 변경하고, 빠진 아이템을 제거한다.
        @actor.equip(equip_type, null_id)
        $game_party.lose_armor(item.id, 1)
        for item_set in 1..job_last
          setup[item_set].armor_set.push(null_id)
        end
        #==========수정 필요==========#
        
        # 새 아이템이 생겼다는것을 갱신한다.
        new_item_list.push(main_item[null_id].name)
      end
      end
      end
    when 3 #신체
      #==========수정 필요==========#
      main_item = $data_armors
      item = $data_armors[@actor.armor3_id].clone
      item_size = $data_armors.size
      new_item_list = $game_system.new_armors3
      text = "[제련형]" #제작된 아이템의 설명에 들어갈 텍스트
      equip_type = 3
      #==========수정 필요==========#
      setup = $data_classes
      job_last = $data_classes.size-1
      #제련횟수와 아이템이름을 잘라낸다.
      number = item.name.gsub(/D/) {""}
      itemname = item.name.gsub(/d/) {""}
      #다음 제련횟수를 구한다.
      next_number = number.to_i+1
      #다음 제련횟수를 합한 아이템명을 구한다.
      next_itemname = itemname.to_s+"+"+next_number.to_s
      next_itemname2 = itemname.to_s+next_number.to_s
      #다음 아이디를 구한다.
      next_id = item_size+1
      
      #아이템이 이미 생성되어 있다면 그걸로 바꿔준다.
      if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname2)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname2
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      #아이템이 생성되어 있지 않다면 새로 만든다.
      else new_item_list.include?(next_itemname)==false
        #아이템 ID의 공백을 찾는다.
        for check in 1..item_size
          if main_item[check] == nil
            null_id = check
            break
          end
        end
        #공백 ID가 없을경우. 전체에서 다시 찾는다.
        if null_id == nil
          check = 1
          loop do
            if main_item[check] == nil
              null_id = check
              break
            end
            check += 1
          end
        end
        
        #아이템 제작을 시작한다.
        main_item[null_id] = item.clone
        main_item[null_id].id = item.clone
        main_item[null_id].name = item.name.clone
        main_item[null_id].description = item.description.clone
        
        main_item[null_id].id = null_id
        
        if main_item[null_id].name.include?("+") == false
          main_item[null_id].name = next_itemname
        else main_item[null_id].name.include?("+") == true
          main_item[null_id].name = next_itemname2
        end
        if main_item[null_id].description.include?(text) == false
          main_item[null_id].description = main_item[null_id].description+text
        end
        item_size = null_id+1
        
        #테스트
        #p main_item[null_id].id
        #p main_item[null_id].name
        #p main_item[null_id].description
        #p item_size
        
        #==========수정 필요==========# #방어구3 능력치 수정#
        # 변경될 옵션값 : 기본 : Pdef,Mdef(물리,마법방어을 기본+10%
        main_item[null_id].pdef = main_item[null_id].pdef+(main_item[null_id].pdef/10).floor
        main_item[null_id].mdef = main_item[null_id].mdef+(main_item[null_id].mdef/10).floor
        main_item[null_id].price = main_item[null_id].price+(main_item[null_id].price/10).floor
        if main_item[null_id].int_plus > 0
          main_item[null_id].int_plus += 1
        end
        if main_item[null_id].agi_plus > 0
          main_item[null_id].agi_plus += 1
        end
        if main_item[null_id].dex_plus > 0
          main_item[null_id].dex_plus += 1
        end
        if main_item[null_id].str_plus > 0
          main_item[null_id].str_plus += 1
        end
        $game_party.gain_armor(null_id, 1)
        #장비를 변경하고, 빠진 아이템을 제거한다.
        @actor.equip(equip_type, null_id)
        $game_party.lose_armor(item.id, 1)
        for item_set in 1..job_last
          setup[item_set].armor_set.push(null_id)
        end
        #==========수정 필요==========#
        
        # 새 아이템이 생겼다는것을 갱신한다.
        new_item_list.push(main_item[null_id].name)
      end
      end
      end
    when 4 #장식품
      #==========수정 필요==========#
      main_item = $data_armors
      item = $data_armors[@actor.armor4_id].clone
      item_size = $data_armors.size
      new_item_list = $game_system.new_armors4
      text = "[제련형]" #제작된 아이템의 설명에 들어갈 텍스트
      equip_type = 4
      #==========수정 필요==========#
      setup = $data_classes
      job_last = $data_classes.size-1
      #제련횟수와 아이템이름을 잘라낸다.
      number = item.name.gsub(/D/) {""}
      itemname = item.name.gsub(/d/) {""}
      #다음 제련횟수를 구한다.
      next_number = number.to_i+1
      #다음 제련횟수를 합한 아이템명을 구한다.
      next_itemname = itemname.to_s+"+"+next_number.to_s
      next_itemname2 = itemname.to_s+next_number.to_s
      #다음 아이디를 구한다.
      next_id = item_size+1
      
      #아이템이 이미 생성되어 있다면 그걸로 바꿔준다.
      if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname2)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname2
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      else if new_item_list.include?(next_itemname)==true
        #해당 아이템을 찾는다.
        for find in 1..item_size
          if main_item[find].name == next_itemname
            #==========수정 필요==========#
            $game_party.gain_armor(find, 1)
            #찾은 아이템으로 장비를 변경한다.
            @actor.equip(equip_type, find)
            $game_party.lose_armor(item.id, 1)
            #==========수정 필요==========#
            break
          end
        end
      #아이템이 생성되어 있지 않다면 새로 만든다.
      else new_item_list.include?(next_itemname)==false
        #아이템 ID의 공백을 찾는다.
        for check in 1..item_size
          if main_item[check] == nil
            null_id = check
            break
          end
        end
        #공백 ID가 없을경우. 전체에서 다시 찾는다.
        if null_id == nil
          check = 1
          loop do
            if main_item[check] == nil
              null_id = check
              break
            end
            check += 1
          end
        end
        
        #아이템 제작을 시작한다.
        main_item[null_id] = item.clone
        main_item[null_id].id = item.clone
        main_item[null_id].name = item.name.clone
        main_item[null_id].description = item.description.clone
        
        main_item[null_id].id = null_id
        
        if main_item[null_id].name.include?("+") == false
          main_item[null_id].name = next_itemname
        else main_item[null_id].name.include?("+") == true
          main_item[null_id].name = next_itemname2
        end
        if main_item[null_id].description.include?(text) == false
          main_item[null_id].description = main_item[null_id].description+text
        end
        item_size = null_id+1
        
        #테스트
        #p main_item[null_id].id
        #p main_item[null_id].name
        #p main_item[null_id].description
        #p item_size
        
        #==========수정 필요==========# #방어구4 능력치 수정#
        # 변경될 옵션값 : 기본 : 스텟은있으면+1, 증가기능+10%
        main_item[null_id].pdef = main_item[null_id].pdef+(main_item[null_id].pdef/10).floor
        main_item[null_id].mdef = main_item[null_id].mdef+(main_item[null_id].mdef/10).floor
        main_item[null_id].price = main_item[null_id].price+(main_item[null_id].price/10).floor
        if main_item[null_id].int_plus > 0
          main_item[null_id].int_plus += 1
        end
        if main_item[null_id].agi_plus > 0
          main_item[null_id].agi_plus += 1
        end
        if main_item[null_id].dex_plus > 0
          main_item[null_id].dex_plus += 1
        end
        if main_item[null_id].str_plus > 0
          main_item[null_id].str_plus += 1
        end
        $game_party.gain_armor(null_id, 1)
        #장비를 변경하고, 빠진 아이템을 제거한다.
        @actor.equip(equip_type, null_id)
        $game_party.lose_armor(item.id, 1)
        for item_set in 1..job_last
          setup[item_set].armor_set.push(null_id)
        end
        #==========수정 필요==========#
        
        # 새 아이템이 생겼다는것을 갱신한다.
        new_item_list.push(main_item[null_id].name)
      end
      end
      end
    end
    @help_window.set_text("제련했습니다.")
    
    #갱신
    @selc_window.update 
    @help_window.update
    @item_window.update
    @yn_win.update
    @selc_window.refresh
    # 없는 아이템은 선택창 디시블
    unless @s1_disible
      @selc_window.disable_item(0)
    end
    unless @s2_disible
      @selc_window.disable_item(1)
    end
    unless @s3_disible
      @selc_window.disable_item(2)
    end
    unless @s4_disible
      @selc_window.disable_item(3)
    end
    unless @s5_disible
      @selc_window.disable_item(4)
    end
    $scene = Scene_Map.new # 커멘드를 닫고 맵으로 돌아간다.
  else @item.id != 23
    $game_system.se_play($data_system.cancel_se) # SE재생
    @yn_win.active = false
    @yn_win.visible = false
    @item_window.active = true
    @item_window.visible = true
    @item_window.back_opacity = 160
  end
when 1 #2
  @yn_win.index = 0
  @yn_win.active = false
  @yn_win.visible = false
  @item_window.active = true
  @item_window.visible = true
  @help_window.set_text("제련할 아이템을 선택해주세요.")
  return
end 
end 
end 

end

#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
#  아이템 화면, 배틀 화면에서, 소지 아이템의 일람을 표시하는 윈도우입니다.
#==============================================================================

class Window_제련아템창 < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 360, 128)
    @column_max = 1
    refresh
    self.index = 0
    # 전투중의 경우는 윈도우를 화면 중앙에 이동해, 반투명으로 한다
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # ● 아이템의 취득
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # 아이템을 추가
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        @data.push($data_items[i])
      end
    end
    # 항목수가 0 이 아니면 비트 맵을 작성해, 전항목을 묘화
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 항목의 묘화
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = $game_party.item_number(item.id)
    end
    if item.is_a? (RPG::Item) and
       $game_party.item_can_use? (item.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.icon_name)
    opacity = self.contents.font.color == normal_color ?  255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # ● 헬프 텍스트 갱신
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ?  "" : self.item.description)
  end
end

출처: 게임공작소
?

  1. 일시정지 스크립트

    Date2013.09.29 CategoryRPGXP 스크립트 By청담 Views929 Votes0
    Read More
  2. 셀프 스위치 조작

    Date2013.09.29 CategoryRPGXP 스크립트 By청담 Views656 Votes0
    Read More
  3. HBGames.ORG::Motion Blur

    Date2013.09.27 CategoryRPGXP 스크립트 By죽은노예 Views772 Votes0
    Read More
  4. 횡스크롤 스크립트

    Date2013.09.27 CategoryRPGXP 스크립트 By 운 Views1107 Votes0
    Read More
  5. FPS 표시 스크립트

    Date2013.09.27 CategoryRPGXP 스크립트 By 운 Views1166 Votes0
    Read More
  6. 안티 렉 스크립트

    Date2013.09.26 CategoryRPGXP 스크립트 By Views3327 Votes1
    Read More
  7. 2D 마인크래프트 프로젝트

    Date2013.09.26 CategoryRPGXP 스크립트 By Views3048 Votes2
    Read More
  8. 정지 모션 스크립트

    Date2013.09.26 CategoryRPGXP 스크립트 By Views713 Votes1
    Read More
  9. 모든 글자에 외곽선을 넣어주는 스크립트

    Date2013.09.26 CategoryRPGXP 스크립트 By Views808 Votes1
    Read More
  10. 아이템 소지수 무제한 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1001 Votes0
    Read More
  11. 메뉴에서 실제시간 보는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views607 Votes0
    Read More
  12. 장비제련 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1024 Votes0
    Read More
  13. 맵 이동시 로딩 그림 표시 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views716 Votes0
    Read More
  14. 커다란 그래픽 좁은 길 못지나가는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views866 Votes0
    Read More
  15. 복권 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views925 Votes0
    Read More
  16. 창고 시스템

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views984 Votes0
    Read More
  17. 레벨업시 전회복 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views687 Votes0
    Read More
  18. 대화 글씨가 한글자씩 나오는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1415 Votes0
    Read More
  19. 간단한 여관 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views909 Votes0
    Read More
  20. 자동으로 장애물을 피해가는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views860 Votes0
    Read More
Board Pagination Prev 1 ... 4 5 6 7 8 9 10 11 12 13 ... 15 Next
/ 15






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)