VX 스크립트

#==============================================================================
#    Learn Skills By Use
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: August 27, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to have actors learn skills by using other skills.
#   For instance, you could set it so that an actor will learn Fire II only
#   after he has used Fire 50 times. You can also set it so that there can be
#   multiple paths to learning a skill and multiple skill requirements. For
#   instance, that same actor could also learn Fire II if he has used Flame
#   60 times and Flame II 25 times. However, you can also set class
#   prohibitions and level requirements, so if you never want a Paladin to
#   learn Fire II no matter how many times he uses its root skills, then it is
#   easy to set that up, and if you don't want Fire II to be learned by any
#   actor until they are at least level 7, then that can be setup too. You may
#   also set it up so that it is like an upgrade - Fire becomes obsolete once
#   Fire II is learned, and so you can simply forget Fire once you have Fire II
#
#    Also, the actors will only learn these skills upon level up, not as soon
#   as they meet requirements, so if you are using any display levelup scripts,
#   the skills learned by use should show up in that script no problem.
#
#    Further, this doesn't interfere with the regular skill learning system, so
#   if you set it that a mage will learn Fire II at level 6 in the Class Tab
#   of the database, than the mage will learn Fire II at level 6 no matter if
#   she has met the use requirements of its root skills, and no matter what
#   the class prohibitions or level requirements are.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script above Main and below Materials in the Editor. It should
#   also be below any custom levelup scripts you may have.
#
#    To set up a skill to be learned through use, you must use this code in a
#   notes box:
#
#      ROOT_SKILL[skill_id, number_of_uses, <supplement_skills>, forget]
#        skill_id : The ID of the root skill that leads to this skill.
#        number_of_uses : An integer - the number of times the root skill has
#          be used before it teaches this skill.
#        <supplement_skills> : a list of skill IDs that also have to have their
#          root requirements fulfilled before the skill will be learned. It is
#          of the format: <x, y, z> where x, y, and z are the IDs of the other
#          skills that must have usage requirements met. You can have as many
#          as you like. Note, however, that you must set up one of these
#          requirements notes for each of the other skills as well, and you
#          must cross-reference the skills in this path. Defaults to <>,
#          meaning that the only usage requirements needed to be filled is this
#          one
#        forget : If this is set to 1, then the root skills will be forgotten
#          once this skill is learned. If left blank or set to any other digit,
#          than the root skills will be retained.
#
#  EXAMPLE A:
#
#    This code in the notebox of a skill:
#
#      ROOT_SKILL[9, 100]
#
#    There is only one path to learning this skill:
#      (i) Use the skill with ID 9 at least 100 times.
#
#    No skill is forgotten
#
#  EXAMPLE B:
#
#    These codes in the notebox of a skill:
#
#      ROOT_SKILL[1, 20, 1]
#      ROOT_SKILL[4, 15, <5>]
#      ROOT_SKILL[5, 8, <4>]
#
#    With these codes, there are two paths to learning this skill.
#      (i)  Use the skill with ID 1 at least 20 times.
#      (ii) Use the skill with ID 4 at least 15 times and use the skill with
#         ID 5 at least 8 times.
#
#    No matter which path is taken to the skill, the skill with ID 1 will be
#   forgotten as soon as the new skill is learned.
#
#  EXAMPLE C:
#
#    The following codes in the notebox of a skill:
#
#      ROOT_SKILL[6, 100]
#      ROOT_SKILL[7, 100]
#      ROOT_SKILL[6, 20, <7, 8>]
#      ROOT_SKILL[7, 25, <6, 8>]
#      ROOT_SKILL[8, 15, <6, 7>]
#
#    With these codes, there are three paths to learning this skill.
#      (i)   Use the skill with ID 6 at least 100 times
#      (ii)  Use the skill with ID 7 at least 100 times
#      (iii) Use the skill with ID 6 at least 20 times, the skill with ID 7 at
#          least 25 times, and the skill with ID 8 at least 15 times.
#
#    No matter which path is taken, no skills will be forgotten.
#
#    To prohibit a class from learning a skill through usage requirements,
#   put this code in a notebox of a skill:
#
#      PROHIBIT_CLASS[class_id]
#        class_id : ID of class not allowed to learn this skill through use
#
#    To set a minimum level for learning a skill through usage requirements,
#   put this code in the notebox of a skill:
#
#      MIN_LEVEL[x]
#        x : an integer that is the minimum level. An actor cannot learn
#          the skill until his level is at least equal to x.
#==============================================================================

#==============================================================================
# ** Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new methods - ma_root_skills, ma_class_prohibited, ma_level_requirement
#==============================================================================

class RPG::Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Skill roots
  #      Root_Skill[skill_ID, # of uses, <supplement_skills>, forget?]
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_root_skills
    if @ma_root_skills.nil?
      @ma_root_skills = []
      text = self.note.dup
      while text.sub!(/ROOT_SKILL[(d+),?s*?(d+),?s*?<?(.*?)>?,?s*?(d?)]/i) { "" } != nil
        id = $1.to_i
        n = $2.nil? ? 0 : $2.to_i
        forget = $4.nil? ? false : $4.to_i == 1
        supplement_skills = []
        unless $3.nil?
          txt = $3
          while txt.sub! (/(d+?)/) { "" } != nil
            supplement_skills.push ($1.to_i)
          end
        end
        @ma_root_skills.push ([id, n, forget, supplement_skills])
      end
    end
    return @ma_root_skills
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Class Prohibited?
  #      Prohibit_Class[class_ID]
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_class_prohibited? (class_id)
    if @ma_prohibited_classes.nil?
      @ma_prohibited_classes = []
      text = self.note.dup
      while text.sub! (/PROHIBIT_CLASS[(d+)]/i) { "" } != nil
        @ma_prohibited_classes.push ($1.to_i)
      end
    end
    return @ma_prohibited_classes.include? (class_id)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Level Requirement
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_level_requirement
    if @ma_level_req.nil?
      @ma_level_req = self.note[/MIN_LEVEL[(d+)]/i] != nil ? $1.to_i : 1
    end
    return @ma_level_req
  end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize, level_up
#    new_method - lsbu_check_skill_requirements, skill_count
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_brnchskill_init_1cx3 initialize
  def initialize (*args)
    @lsbu_skill_count = []
    @lsbu_forget_skills = []
    # Run Original Method
    modalg_brnchskill_init_1cx3 (*args)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Level Up
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malg_skl_brnches_byuse_lvlplus_0kb2 level_up
  def level_up (*args)
    # Run Original Method
    malg_skl_brnches_byuse_lvlplus_0kb2 (*args)
    # Check all skills to see if requirements have been met to learn the skill
    $data_skills.each { |skill|
      next if skill.nil? || skill.ma_root_skills.empty?
      if !@skills.include? (skill.id) && lsbu_check_skill_requirements (skill)
        # Learn Skill
        learn_skill (skill.id)
        @lsbu_forget_skills.each { |id| forget_skill (id) }
      end
      @lsbu_forget_skills.clear
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Retrieve Skill Count
  #    skill_id : ID of skill checked
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def skill_count (skill_id)
    @lsbu_skill_count[skill_id] = 0 if @lsbu_skill_count[skill_id].nil?
    return @lsbu_skill_count[skill_id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Increase Skill Count
  #    skill_id : ID of skill increased
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def increase_skill_count (skill_id)
    @lsbu_skill_count[skill_id] = skill_count (skill_id) + 1
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check Skill Requirements
  #    skill_id : ID of skill checked
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def lsbu_check_skill_requirements (skill)
    return false if skill.ma_class_prohibited? (@class_id)
    return false if @level < skill.ma_level_requirement
    skill_paths = []
    skill.ma_root_skills.each { |requirements|
      @lsbu_forget_skills.push (requirements[0]) if requirements[2]
      # FALSE If root skill not possessed
      next if !@skills.include? (requirements[0])
      # If skill not used enough
      next if skill_count (requirements[0]) < requirements[1]
      # Add path to skill_paths only if other requirements are true
      path = [requirements[0]]
      requirements[3].each { |supplement| path.push (supplement) }
      path.sort!
      # Add to skill paths array
      skill_paths.push (path)
    }
    # Check if any paths to this skill have been fulfilled
    while skill_paths.size > 0
      path = skill_paths[0].dup
      skill_paths.delete_at (0)
      count = 1
      # Check if the number of true requirements of this path equal to path size
      while count < path.size
        index = skill_paths.index (path)
        # If there aren't enough reqs for this path, do not return true
        break if index == nil
        skill_paths.delete_at (index)
        count += 1
      end
      return true if count == path.size
    end
    return false
  end
end

#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - execute_action_skill
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Execute Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnalg_exctskl_lsbu_4nv2 execute_action_skill
  def execute_action_skill (*args)
    # Increase User's skill count if actor
    @active_battler.increase_skill_count (@active_battler.action.skill.id) if @active_battler.actor?
    # Run Original Method
    mdrnalg_exctskl_lsbu_4nv2 (*args)
  end
end

#==============================================================================
# ** Scene Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - use_skill_nontarget
#==============================================================================

class Scene_Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Use Skill Nontarget
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgbra_usesklnotrg_lsbu_5na2 use_skill_nontarget
  def use_skill_nontarget (*args)
    # Increase User's skill count
    @actor.increase_skill_count (@skill.id)
    # Run Original Method
    malgbra_usesklnotrg_lsbu_5na2 (*args)
  end
end

설명/(구글번역기)

이 스크립트는 당신이 배우가 다른 기술을 사용하여 기술을 습득하도록 허용합니다. 예를 들어, 그렇게 배우 후에만 그가 불의 사용한 50 회 소방 II를 배울 것입니다 그것을 설정할 수 있습니다. 기술과 복합 기술 요구 사항을 학습하는 당신도 그래야 그것을 설정할 수 있습니다 여러 경로를하실 수 있습니다. 그는 화염 사용한 경우 예를 들어, 같은 배우도 소방 II를 배울 수있는 60 번 및 화염 II에 25 번 읽혔습니다. 하지만, 당신은 또한, 그렇게한다면 당신은 친위가 화재 II에 당신이 원하지 않는다면 그것은 설치가 용이하며 수없이은 루트 기술을 사용하든, 그때 배우고 싶지 않은 수업 금지와 수준의 요구 사항을 설정할 수 있습니다 화재 II에 어떤 배우로 그들은 적어도 다음 레벨 7에 그 설치도있을 수 있습니다까지 배울 수 있습니다. 당신은 또한 너무 그것이 업그레이 드처럼 - 소방 II에 배운되면 화재가 오래된, 그리고되고 당신은 소방 II를 가지고 나면 당신은 단순히 화재를 잊을 수를 설정할 수 있습니다

또한, 배우 유일한 수준에 따라 최대 이러한 기술을 배울 것입니다, 안 나오자 마자, 그래서 만약 당신이 어떤 디스플레이 levelup 스크립트를 사용하는 요구 사항을 충족, 기술을 이용하여 배운 해당 스크립트 아무런 문제에 게재됩니다.

또한, 이것은 일반적인 기술 학습 시스템과, 방해가되지 않도록 그 마술사는 클래스 탭 데이터베이스의 수준 6에,보다 마술사 레벨 6에 상관없이 발사 II를 배우게됩니다 발사 II를 배울 것입니다 그것을 설정하면면 그녀와 상관없이 해당 루트 기술의 사용 요구 사항을 충족해야할 클래스 금지 또는 수준 요구 사항이 없습니다.

 

 

출처:rmrk


Comment '10'
  • ?
    NightWind AYARSB 2010.04.19 23:53

    아.. 스킬을 자신이 하면서 하는 것이군요...

    한마디로 숙련도 스킬 시스템이라고 보면 되겠군요..

  • ?
    blades 2010.04.30 13:50

    이런...그렇다면 저에게는 무리가 있는 거겠군요...

  • ?
    NightWind AYARSB 2010.04.29 21:49

    적용해보니 아직 뭐가 어떻게 적용되야되는지 모르겠군요..

     

    단지 알아낸거는 어떤 것을 스킬 DB의 메모에 넣어서 설정..

     

    조금 어려운 스크립트입니다..

     

     

     

  • ?
    blades 2010.04.29 20:02

    그냥 스크립트에 복사해서 넣으면 되는건가요?아님,어딘가 넣어야 하는 곳이라도?무척이나 탐나는 접니다.

  • ?
    나이트퓨리 2010.07.08 17:48

    잘쓰겠습니다~

  • ?
    따메츠나 2010.07.25 17:51

    ㅎㄷㄷ... 잘쓰겠습니다.

  • ?
    키리시마 2010.07.28 22:40

    그러니까 파이어1을 게속 쓰면 숙련도가 쌓여서 파이어2로 바꾼다는 거네요..(구글번역기는 알아듣기가 어렵...)

     

    파이어2를 배우고 파이어1을 남길수도 지울수도 있게되네요 ㅎㅎ

  • ?
    시옷청룡 2011.07.29 21:15

    스킬의 메모란에 써넣으시면 됩니다,

    ROOT_SKILL[9, 100]

    9번 스킬을 100번 정도 쓸 경우 배움

     

    1. ROOT_SKILL[1, 20, 1]

    2. ROOT_SKILL[4, 15, <5>]
        ROOT_SKILL[5, 8, <4>]]

    1. 1번 스킬을 20번 정도 쓰면 배움(20옆의 1은 왜있는지... 새로운 스킬을 배울 경우 1이 지워진다는 뜻이 아닌가 추측)

    2. 4번을 15번, 5번을 8번 정도 쓰면 배움

    둘 중 하나의 조건만 만족시켜도 되는듯

     

    1. ROOT_SKILL[6, 100]
    2.  ROOT_SKILL[7, 100]
    3.  ROOT_SKILL[6, 20, <7, 8>]
    4.  ROOT_SKILL[7, 25, <6, 8>]
    5.  ROOT_SKILL[8, 15, <6, 7>]

    1. 6번 스킬을 100번 정도 쓰면 배움

    2. 7번 스킬을 100번 정도 쓰면 배움

    3. 6번 스킬을 20번, 7번 스킬을 25번, 8번 스킬을 15번 쓰면 배움

    역시 셋 중 하나의 조건만 만족시켜도 될듯

     

    <>의 숫자는 함께 써야하는 스킬의 id같네요{노트창에 쓰실때 ROOT앞의 숫자들(1.이라거나 2. 등)은 적지 마세요}

     

    PROHIBIT_CLASS[class_id]를 스킬의 메모창에 적어줄 경우(id에 숫자)

    id 대신 넣은 숫자에 해당하는 직업군은 조건을 만족시켜도 새로운 스킬을 배울 수 없다

     

    MIN_LEVEL[x]를 스킬의 메모창에 적어줄 경우(x에 숫자)

    x대신 넣은 숫자에 못미치는 레벨로는 조건을 만족시켜도 새로운 스킬을 배울 수 없다

     

    정확한건 역시 실험을 해봐야 알겠군요 

  • ?
    시옷청룡 2011.07.29 21:35

    크윽... 충돌인가... 167줄 오류나서 레벨제한 부분 다 없앴더니 그냥 오류뜨네ㅜㅜ

  • ?
    까멸 2011.11.27 15:12

    저두 167줄 오류뜹니다ㅠㅠ


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
457 원경 원경(파노라마) 바꾸기 9 file 허걱 2010.05.28 3369
456 기타 [자작]게임 실행시 파일 체크 프로그램. 또는 파일 실행기. 16 file NightWind AYARSB 2010.05.20 3192
455 스킬 [ultimate series]스킬,아이템 데미지계산식을 자기입맛에 맞게 고치는 스크립트 16 file EuclidE 2010.05.04 4373
454 메시지 직접 생각해서 만든 "문장 속 특정 단어 색 바꾸기" 10 file X.66 2010.04.28 4363
453 메뉴 매우 간단명료한 메뉴. 32 file 비극ㆍ 2010.04.23 6618
452 이동 및 탈것 자동 이동 시스템 20 file 허걱 2010.04.21 4303
451 기타 전투후 이어지는 베경음 9 비극ㆍ 2010.04.19 2190
450 그래픽 토마스 에디슨(파티클 엔진 비슷) 9 file 비극ㆍ 2010.04.19 3431
449 기타 Lock Screen 3 비극ㆍ 2010.04.19 2012
448 기타 레벨업 이펙트... 20 비극ㆍ 2010.04.19 3768
447 기타 세이브 포인트 2 비극ㆍ 2010.04.19 2518
446 기타 그림자 없애기... 3 비극ㆍ 2010.04.19 1642
445 기타 메뉴에서 애니매이션 사용! 12 비극ㆍ 2010.04.19 3022
444 타이틀/게임오버 타이틀에서 홈페이지 연결 17 비극ㆍ 2010.04.19 2271
443 기타 스크린샷 기능 14 비극ㆍ 2010.04.19 2090
442 메뉴 Final Fantasy VII Menu System 8 비극ㆍ 2010.04.19 3506
441 기타 땅파기 18 file 비극ㆍ 2010.04.19 3013
» 스킬 Learn Skills By Use 10 비극ㆍ 2010.04.19 2037
439 맵/타일 Map Saver 17 file 비극ㆍ 2010.04.18 2415
438 HUD Zelda Health System 11 file 비극ㆍ 2010.04.18 2850
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 32 Next
/ 32