XP 스크립트

Source Thread:  http://save-point.org/thread-4195.html

  Guillaume777씨의 장비확장 스크립트를 위한 최강장비 장착 스크립트입니다.  스크립트를 끼워넣은 뒤 장비창에서 X나 Y버튼(또는 거기에 대응하는 키)을 눌러보시길.  최강장비 선정기준은 Scene_Equip 처음의 상수부분을 편집해서 변경할 수 있습니다.

#==============================================================================
# ** Auto Equip Optimizer for Guillaume777's MultiSlots
#    Original version by RPG Advocate
#------------------------------------------------------------------------------
#    Edit by DerVVulfman
#    version 1.0
#    06-19-2012
#    RPGMaker XP
#==============================================================================


#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs equipment screen processing.
#==============================================================================

class Scene_Equip
  #--------------------------------------------------------------------------
  # * Constants
  #--------------------------------------------------------------------------  
  WEAPON_ATK_WEIGHT = 1.0
  WEAPON_PDF_WEIGHT = 0.0
  WEAPON_MDF_WEIGHT = 0.0
  WEAPON_STR_WEIGHT = 0.0
  WEAPON_DEX_WEIGHT = 0.0
  WEAPON_AGI_WEIGHT = 0.0
  WEAPON_INT_WEIGHT = 0.0
  ARMOR_EVA_WEIGHT  = 0.0
  ARMOR_PDF_WEIGHT  = 0.75
  ARMOR_MDF_WEIGHT  = 0.25
  ARMOR_STR_WEIGHT  = 0.0
  ARMOR_DEX_WEIGHT  = 0.0
  ARMOR_AGI_WEIGHT  = 0.0
  ARMOR_INT_WEIGHT  = 0.0
  NO_ACCESSORY_OPTIMIZATION = false  
  #--------------------------------------------------------------------------
  # * Frame Update (when right window is active)
  #--------------------------------------------------------------------------  
  alias aeo_update_right update_right
  def update_right
    # Perform the original call
    aeo_update_right
    # If X button was pressed
    if Input.trigger?(Input::X)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # optimize 
      optimize(@right_window.index)
      # Refresh windows
      @left_window.refresh
      @right_window.refresh
      for i in 0..@actor.armor_slots.max+1
        @item_windows[i].refresh
      end
      return
    end
    # If Y button was pressed
    if Input.trigger?(Input::Y)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      for i in 0..@actor.armor_slots.max+1
        optimize(i)
      end
      @left_window.refresh
      @right_window.refresh
      for i in 0..@actor.armor_slots.max+1
        @item_windows[i].refresh
      end
      return
    end
  end  
  #--------------------------------------------------------------------------
  # * Optimize Equipment
  #     slot : equipment slot
  #--------------------------------------------------------------------------  
  def optimize(slot)
    old_slot = slot
    slot = index_to_equip_kind(old_slot)
    # IF WEAPON SLOT.....
    if slot == 0
      # SORT through Weapons
      for w_slot in 0...@actor.weapon_slots.size
        # Only if the equipment menu slot is the matching weapon hand slot
        if old_slot == w_slot
          w_id = @actor.weapon_ids[w_slot]
          # Cannot be cursed if unequipped
          unless w_id == 0
            object = $data_weapons[w_id]
            return if object.cursed
          end
          optimal = object.id
          eval_current = 0.00
          if w_id != 0
            eval_current = calc_weapon_stats(object)
          else
            optimal = 0
          end
          @actor.equip_weapon(w_slot,0)
          flag = false
          zero_flag = true
          for weapon in $data_weapons
            if !flag
              flag = true
              next
            end
            # Cannot proceed w/ 2nd slot if first is two-handed
            unless @actor.weapon_ids[0].nil?
              unless $data_weapons[@actor.weapon_ids[0]].nil?
                if w_slot != 0 && $data_weapons[@actor.weapon_ids[0]].nb_hands > 1
                  next
                end
              end
            end
            eval_new = 0.00
            eval_new = calc_weapon_stats(weapon)
            zero_flag = false if eval_new > 0
            if @actor.equippable?(weapon) && 
              $game_party.weapon_number(weapon.id) > 0 && eval_new > eval_current
              eval_current = eval_new
              optimal = weapon.id
            end
          end
          optimal = 0 if zero_flag
          @actor.equip_weapon(w_slot, optimal)
          # If two-handed weapon (can't be if unarmed)
          unless object.nil?
            @actor.equip(1, 0) if object.nb_hands > 1
          end
        end
      end
    end
    # IF ARMOR SLOT.....
    if slot >= 1
      # Prevent accessories if no accesory switch is on
      return if NO_ACCESSORY_OPTIMIZATION && slot > 3
      # Obtain eval_current Object 
      for a_slot in 0..@actor.armor_slots.size-1
        slot_place = old_slot - @actor.weapon_slots.size
        if slot_place == a_slot
          id = @actor.armor_ids[a_slot]
          id = 0 if id.nil?
          object = $data_armors[id]
          # Do not proceed if cursed item
          unless object.nil?
            return if object.cursed
          end
          # Set Unequipped flag
          not_equipped = false
          # If shield slot
          if a_slot == 0
            # Skip Shield slot if two-handed equipped...
            for w_slot in 0...@actor.weapon_slots.size
              w_id = @actor.weapon_ids[w_slot]
              w_id = 0 if w_id.nil?
              w_object = $data_weapons[w_id]
              unless w_object.nil?
                return if w_object.nb_hands > 1
              end
            end
          end
          # Set optimal start
          if object.nil?
            optimal = 0
            not_equipped = true
          else
            if object.id == 0
              optimal = 0
              not_equipped = true
            else
              optimal = object.id
            end
          end
          # Calculate eval_current armor stats
          eval_current = 0.00
          if not_equipped == false
            eval_current = calc_armor_stats(object)
          end
          # Set Flag
          flag = false
          # Sort through Armor Database
          for armor in $data_armors
            if !flag
              flag = true
              next
            end
            # Skip for invalid slots
            next if armor.kind != slot-1
            # Calculate
            eval_new = 0.00
            eval_new = calc_armor_stats(armor)
            # If Armor Equippable by Actor and valid and above eval_current level
            if @actor.equippable?(armor) && 
              $game_party.armor_number(armor.id) > 0 && eval_new > eval_current
              # Set new eval_current level stat and ID
              eval_current = eval_new
              optimal = armor.id
            end
          end
          @actor.equip_armor(a_slot, optimal)        
        end
      end
    end  
  end
  #--------------------------------------------------------------------------
  # * Calculate Weapon Stats
  #     object : weapon evaluated
  #--------------------------------------------------------------------------  
  def calc_weapon_stats(object)
    eval_new = 0.00
    eval_new += object.atk      * WEAPON_ATK_WEIGHT
    eval_new += object.pdef     * WEAPON_PDF_WEIGHT
    eval_new += object.mdef     * WEAPON_MDF_WEIGHT
    eval_new += object.str_plus * WEAPON_STR_WEIGHT
    eval_new += object.dex_plus * WEAPON_DEX_WEIGHT
    eval_new += object.agi_plus * WEAPON_AGI_WEIGHT
    eval_new += object.int_plus * WEAPON_INT_WEIGHT
    return eval_new
  end
  #--------------------------------------------------------------------------
  # * Calculate Armor Stats
  #     object : armor evaluated
  #--------------------------------------------------------------------------  
  def calc_armor_stats(object)
    eval_new = 0.00
    eval_new += object.eva      * ARMOR_EVA_WEIGHT
    eval_new += object.pdef     * ARMOR_PDF_WEIGHT
    eval_new += object.mdef     * ARMOR_MDF_WEIGHT
    eval_new += object.str_plus * ARMOR_STR_WEIGHT
    eval_new += object.dex_plus * ARMOR_DEX_WEIGHT
    eval_new += object.agi_plus * ARMOR_AGI_WEIGHT
    eval_new += object.int_plus * ARMOR_INT_WEIGHT
    return eval_new
  end
end





List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
981 오디오 WhiteFlute - AudioEX (XP/VX/VXA) file Alkaid 2012.12.26 1255
980 그래픽 WhiteFlute - BitmapEX 4 file JACKY 2012.12.10 2950
979 오디오 Audio Module Rewrite mciSendString 1.1 by DerVVulfman Alkaid 2012.09.18 1367
978 전투 Trickster씨의 전투 시스템 (SDK 필수?) Alkaid 2012.09.18 3256
977 스킬 Trickster's Bag of Skill Effects (SDK 필요) Alkaid 2012.09.17 1289
976 변수/스위치 Switchless Common Events by PK8(XP/VX/VXA) Alkaid 2012.09.15 1199
975 변수/스위치 Initial Switches and Variables by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1296
974 변수/스위치 The Self Data Suite by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1232
973 그래픽 부드럽게 화면이 움직이는 스크립트 입니다. 16 GangSin 2012.09.12 4587
972 맵/타일 Editor Tiles by PK8 (XP/VX/VXA) Alkaid 2012.09.11 1868
» 장비 Auto Equipment Optimization for Guillaume777's Multi Slot Script by DerVVulfman Alkaid 2012.09.09 1497
970 메뉴 Leidy's Ring Command Window 1.2 by DerVVulfman Alkaid 2012.09.09 1430
969 그래픽 Pictures below Characters by PK8 (XP/VXA) Alkaid 2012.09.07 1640
968 그래픽 Event Transparency by DerVVulfman (XP/VX/VXA) Alkaid 2012.09.01 1485
967 전투 Etude87_Custom_Slip_Damage_XP ver.1.0 5 습작 2012.08.26 1856
966 전투 Mr.Mo's ABS Ultimate 7.0 by DerVVulfman 4 Alkaid 2012.08.26 2587
965 그래픽 Composite Window Skins by PK8 (XP/VX/VXA) Alkaid 2012.08.26 1559
964 스킬 Miriam's Handicrafts! 1.3 by DerVVulfman Alkaid 2012.08.26 1204
963 전투 Minkoff's Animated Battlers - Enhanced 13.8 by DerVVulfman 1 Alkaid 2012.08.26 1831
962 메뉴 메뉴를 바꾸는 스크립트 14 №1 2012.08.04 4205
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52