VX 스크립트

일단은 출저를 밝힙니다.

http://rmrk.net/index.php?topic=41079.0


스리야씨가 이미 올려놓은 스킬쿨타임 스크립트가 있기는 하였지만,

그 스크립트는 파티가 2명이상일때 심각한 문제점이 있습니다.


일단은 첫번째케릭이 스킬을쓰면. 쿨타임이 정상적으로 돌아갑니다.


그런대 큰 오류가 하나있는대.

첫번째 액터가 행동을 하나해놓고, 두번째 액터가 명령을 취소해서 다시 첫번째 액터 행동으로 넘어가면, 쿨타임이 한턴 줄어있습니다.

ㅡ.. 즉 이것만 알면 쿨타임은 없는것이나 마찬가지란겁니다.


그런대 이 스크립트는 그런게 없는듯 하더군요. 구글에서 검색하고 번역기돌리면서 스크립트 뒤지다가 운좋게 발견한 스크립트입니다.

사용법은 스킬의 메모 NoteBox일수도 있음.

그곳에

\charge[X]

라고 입력하면 X만큼 쿨타임이 적용됩니다.(X자리에 숫자를 넣는것을 모르는 바보는 없길바란다.)

예를들어서

\charge[2]

라고 메모에 적어두면, 사용후 두턴이 지나야만 사용이 가능해집니다.


그럼 밑에부터가 스크립트입니다. 스크립트자체를 딱히 건드릴 필요는 없을겁니다.



#==============================================================================
#    Recharge Skills
#    Version: 1.0.1
#    Author: modern algebra (rmrk.net)
#    Date: 1 March 2013
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This allows you to make it so that skills can be set to need to recharge
#   after use. In other words, you can make it so that once an actor uses Heal,
#   he or she cannot use Heal again for x number of turns. This script will
#   also allow you to make items, weapons, and states that can increase or
#   reduce the amount of time it takes to recharge a skill, as well as create
#   items and skills that can immediately recharge any skills that are charging
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in its own slot in the Script Editor (F11), above Main
#   but below any other custom scripts you might have.
#
#    Configuration is fairly easy. To specify how long a skill needs to take to
#   recharge, all you need to do is place the following code in its notebox:
#      \charge[x]
#   where x is the number of turns you want it to be unavailable for after
#   using it. It must be a positive integer.
#
#    Example:
#      \recharge[2]   # Will wait two turns before you can use this skill again
#
#    To set either an item or skill so that, when used, it will refresh all
#   skills and get rid of any remaining charges so that all skills will be
#   available, all you need to do is put the following code in the notebox:
#      \refresh
#
#    To set a weapon, armor, state, or enemy to reduce or increase the default
#   charge times of a skill, all you need to do is use the following code:
#      \recharge[x]
#
#    You can also specify recharge modifiers by class or actor. See the
#   Configurable Region at line 57 for instructions on setting those up. All
#   recharge modifiers stack, so if your class normally adds 1 and an armor the
#   actor wears adds 2, then it will take 3 extra turns to recharge the skill.
#   Also, recharge mods will only add to skills that have a recharge time to
#   begin with.
#==============================================================================

#==============================================================================
# *** RPG
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    New Constants - CLASS_RECHARGE_MODS, ACTOR_RECHARGE_MODS
#    Modified classes - UsableItem, Skill, Weapon, Armor, State, Enemy
#==============================================================================

module RPG

#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  CONFIGURABLE REGION
#``````````````````````````````````````````````````````````````````````````````
#    Here, you can set recharge modifiers for classes and actors, thus allowing
#   the recharge times to be different depending on which actor and what class.
#   They both work the same basic way:
#
#  CLASS_RECHARGE_MODS
#    Each line should look as follows (omitting the < and >):

#    <class ID> => <modifier>,
#
#       class ID : the ID of the class you want to modify. So, by default,
#         1 would be Paladin, 2 would be Warrior, 3 would be Priest, etc...
#       modifier : this can either be an integer or a positive decimal number.
#         If an integer, it will add it to the number of turns. If a decimal
#         number, it will multiply it by the number of turns.
#
#  If you don't do a line for a class, then it defaults to 0 modifier.
#  Remember to put a comma after EVERY one of these lines, except the last.
#
#  EXAMPLES:
#    2 => 1,
#      Whenever an actor with class 2 uses a skill, it will take one extra turn
#      to recharge than it would normally. So, if a skill should take 3 turns 
#      to recharge, it will take 4 turns for actors with this class.
#    7 => 0.5,
#      Whenever an actor with class 7 uses a skill, it will take only half as
#      long to recharge as it would normally. If a skill takes 6 turns
#      normally, it will take 3 turns to recharge for actors with this class.
#
#  ACTOR_RECHARGE_MODS
#    This works the same way, except with actor ID instead of class ID:
#
#    <actor ID> => <modifier>,
#       actor ID : the ID of the actor. So, by default, 1 would be Ralph,
#         2 would be Ulrika, etc...
#       modifier : same as at line 71.
#
#  If you don't do a line for a class, then it defaults to 0 modifier.
#  Remember to put a comma after EVERY one of these lines, except the last.
#
#  EXAMPLES:
#    4 => -2,
#      Whenever Actor 4 uses a skill, it takes 2 less turns to charge. So if
#      the skill normally takes 5 turns, it will take only 3 turns for actor 4.
#    7 => 2.5,
#      Whenever Actor 7 uses a skill it 250% longer to recharge. So if a skill
#      normally takes 2 turns, it will take 5 turns for actor 7.
#
#  You can also change an actor's recharge modifier in game with a script call:
#    $game_actors[<actor ID>] = <modifier>
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CLASS_RECHARGE_MODS = { # <- Do not touch.
  1 => 0,
  2 => 1.0,
} # <- Do not touch.
ACTOR_RECHARGE_MODS = { # <- Do not touch.
  1 => 0,
  2 => 1.0,
} # <- Do not touch.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  END CONFIGURABLE REGION
#//////////////////////////////////////////////////////////////////////////////
CLASS_RECHARGE_MODS.default = 0
ACTOR_RECHARGE_MODS.default = 0
 
#==============================================================================
# ** UsableItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - refresh_charges?
#==============================================================================

class UsableItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh_charges?
    return (self.note[/\\REFRESH/i] != nil)
  end
end

#==============================================================================
# ** Skill
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - charge_time
#==============================================================================

class Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Charge Time
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_time
    return self.note[/\\CHARGE\[(\d+)\]/i] != nil ? $1.to_i : 0
  end
end

#==============================================================================
# ** Weapon, Armor, State, Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - recharge_mod
#    aliased method - ma_reset_note_values (if have Note Editor)
#==============================================================================

["Weapon", "Armor", "State", "Enemy"].each { |class_name|

RS_REGEXP = "/\\\\RECHARGE\\[(-?\\d+)(%?)\\]/i"

CLDEF = <<__END__
class #{class_name}
  def recharge_mod
    if !@recharge_mod
      if self.note[#{RS_REGEXP}] != nil
        if $2.empty?
          @recharge_mod = $1.to_i
        else
          x = $1.to_f / 100.0
          @recharge_mod = x >= 0 ? x : -1*x
        end
      else
        @recharge_mod = 0
      end
    end
    return @recharge_mod
  end
  if self.method_defined? (:ma_reset_note_values)
    alias ma_rchrg_restnot_8ik3 ma_reset_note_values
    def ma_reset_note_values (*args)
      ma_rchrg_restnot_8ik3 (*args) # Run Original Method
      @recharge_mod = nil
    end
  end
end
__END__

eval (CLDEF)

}

end

#==============================================================================
# ** Game_Battler
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize; skill_can_use?; skill_test; skill_effect;
#      item_test; item_effect
#    new methods - set_skill_recharge; update_skill_recharge; recharge_mod
#==============================================================================

class Game_Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_skilchrg_initz_5tg2 initialize
  def initialize (*args)
    @sc_turns_count = {}
    @sc_turns_count.default = 0
    ma_skilchrg_initz_5tg2 (*args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check if Can Use Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgbr_chrgskil_canus_9dv4 skill_can_use?
  def skill_can_use? (skill, *args)
    return false if @sc_turns_count[skill.id] > 0
    return malgbr_chrgskil_canus_9dv4 (skill, *args) # Return Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Skill Test
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mal_rchrgskl_tst_4wp9 skill_test
  def skill_test (user, skill, *args)
    return true if skill.refresh_charges? && !@sc_turns_count.empty?
    return mal_rchrgskl_tst_4wp9 (user, skill, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Skill Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mgba_rchrgskil_efct_2ok7 skill_effect
  def skill_effect (user, skill, *args)
    @sc_turns_count.clear if skill.refresh_charges?
    mgba_rchrgskil_efct_2ok7 (user, skill, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item Test
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mogb_rchrg_itmtest_6yh2 item_test
  def item_test (user, item, *args)
    return true if item.refresh_charges? && !@sc_turns_count.empty?
    return mogb_rchrg_itmtest_6yh2 (user, item, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malga_rechrge_itmeffect_5th3 item_effect
  def item_effect (user, item, *args)
    @sc_turns_count.clear if item.refresh_charges?
    malga_rechrge_itmeffect_5th3 (user, item, *args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Charge
  #  skill : the skill used
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_skill_recharge (skill)
    return if skill.recharge_time == 0
    @sc_turns_count[skill.id] = skill.recharge_time
    direct, percent = recharge_mod
    @sc_turns_count[skill.id] += direct
    @sc_turns_count[skill.id] = (@sc_turns_count[skill.id] * percent).round
    @sc_turns_count[skill.id] += 1
    @sc_turns_count.delete (skill.id) if @sc_turns_count[skill.id] < 1
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear Charge
  #  skill : the skill used
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_skill_recharge(skill_id = 0)
    if skill_id == 0
      @sc_turns_count.clear
    else
      @sc_turns_count.delete(skill_id)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Charges
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_skill_recharge
    for i in @sc_turns_count.keys
      @sc_turns_count[i] -= 1
      @sc_turns_count.delete (i) if @sc_turns_count[i] <= 0
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Recharge Mod
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_mod
    direct, percent = 0, 1.0
    states.each { |state|
      x = state.recharge_mod
      x.is_a? (Float) ? percent *= x : direct += x
    }
    return direct, percent
  end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - setup
#    redefined super method - recharge_mod
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :base_recharge
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Actor Setup
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malgb_rechrg_initz_8ik2 setup
  def setup (*args)
    malgb_rechrg_initz_8ik2 (*args) # Run Original Method
    @base_recharge = RPG::ACTOR_RECHARGE_MODS[@actor_id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Recharge Mod
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_mod
    direct, percent = super
    class_mod = RPG::CLASS_RECHARGE_MODS[class_id]
    class_mod.is_a? (Float) ? percent *= class_mod : direct += class_mod
    @base_recharge.is_a? (Float) ? percent *= @base_recharge : direct += @base_recharge
    equips.compact.each { |equip|
      x = equip.recharge_mod
      x.is_a? (Float) ? percent *= x : direct += x
    }
    return direct, percent
  end
end

#==============================================================================
# ** Game_Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    redefined super method - recharge_mod
#==============================================================================

class Game_Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Recharge Mod
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def recharge_mod
    direct, percent = super
    x = enemy.recharge_mod
    x.is_a? (Float) ? percent *= x : direct += x
    return direct, percent
  end
end

#==============================================================================
# ** Scene_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - execute_action_skill; turn_end
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Execute Battle Action: Skill
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modrn_chrg_exactskil_5th3 execute_action_skill
  def execute_action_skill (*args)
    modrn_chrg_exactskil_5th3 (*args) # Run Original Method
    @active_battler.set_skill_recharge (@active_battler.action.skill)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * End Turn
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias morba_chrgskl_endturn_4tx1 turn_end
  def turn_end (*args)
    if args[0] && args[0].is_a? (Game_Battler) # Tankentai ATB Compatibility
      args[0].update_skill_recharge
    else
      ($game_troop.members + $game_party.members).each { |battler| battler.update_skill_recharge }
    end
    morba_chrgskl_endturn_4tx1 (*args) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * End Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias marc_batlend_4kb6 battle_end
  def battle_end(*args)
    $game_party.members.each { |actor| actor.clear_skill_recharge }
    marc_batlend_4kb6(*args) # Call Original Method
  end
end


####

여기까지가 스크립트.


추가로 번역을 하려다가 말았는대. 솔직히 스크립트부분 번역이 필요없이 노트박스만 쓰면 되니 그냥 적지않았습니다.

참고로 recharge[]라는것도 있던대 전잘모르겟어욤 ㅇㅂㅇ...


그리고!

눈팅족들!

내가이걸 몇시간걸려서 찾았는대 자네는 댓글하나 안쓰고 가져가는가!!!


댓글좀...

Comment '5'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
637 아이템 현재있는 파티원 선택 레벨업 아이템 만들기 1 file 싸패 2016.06.06 712
636 저장 세이브 파일 개수 16개로 늘리기 (기본 세이브 엔진용) 1 file Bunny_Boy 2015.09.07 815
» 스킬 [RPG VX] 턴알 스킬 쿨타임 스크립트! (잘돌아감) 5 듀란테 2015.08.18 1671
634 메뉴 KGC - 커스텀 메뉴 커멘드 (번역) 1 듀란테 2015.07.27 1077
633 메뉴 Etude87's Menu Editor for VX 25 습작 2015.01.14 1461
632 기타 Gamepad Extender VX 습작 2015.01.02 672
631 버그픽스 DerVVulfman's Tileset Reader VX Bug Fix 습작 2014.11.16 699
630 장비 방어구 착용시 최대HP, MP증가 스크립트(턴알) 3 file 기관차 2014.11.06 1222
629 메뉴 Etude87_Ace_Style_Formation_Change ver.1.01 습작 2014.10.05 757
628 키입력 해외 제작자 He Who Jets님의 마우스 스크립트(mouse system) 1 file 보자기군 2014.09.30 1260
627 메시지 Etude87 Dialogue History Scene file 습작 2014.07.07 1069
626 메뉴 MOG - Scroll Bar for VX file 습작 2014.07.06 1114
625 이동 및 탈것 이동 기능 파워업 (장애물 등을 피하는 이동방식) 8 file 파노 2014.04.27 1716
624 타이틀/게임오버 Title Skip System : 타이틀 스킵 file 허걱 2014.03.19 1510
623 버그픽스 Graphical Object Global Reference VX by Mithran Alkaid 2014.03.03 1026
622 기타 장애물을 피하고 다가오게 하는 스크립트 5 file 박력남 2014.02.25 1877
621 버그픽스 애니메이션 표시 위치 수정 (Fix Animation Position) 2 file AltusZeon 2014.02.12 1288
620 전투 [RPG VX]기술에 쿨타임을 부여하는 스크립트 3 스리아씨 2013.12.05 2347
619 HUD 아방스님이 올린 HUD를 개조했습니다. 7 file 스리아씨 2013.09.30 2683
618 전투 SRPGコンバータ for VX by AD.Bank 습작 2013.05.13 2968
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