XP 스크립트

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆毎ターン自動回復 - KGC_AutoRecover◆
#_/----------------------------------------------------------------------------
#_/  毎ターンHP/SPを自動回復する機能を追加します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================

module KGC
  # ◆回復タイミング
  #  0..行動後  1..パーティコマンド開始時
  #  ※≪Active Count Battle≫使用時は 0 しか使用できません。
  AR_RECOVER_TIMING = 0
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["AutoRecover"] = true

if $game_special_states == nil
  $game_special_states = {}
  $data_states = load_data("Data/States.rxdata")
end
# 毎ターン回復ステート
$game_special_states["auto_recover"] = /(HP|SP)?回復(d+)(%|%)?/i

#==============================================================================
# ■ Scene_Battle (分割定義 2)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● パーティコマンドフェーズ開始
  #--------------------------------------------------------------------------
  alias start_phase2_KGC_AutoRecover start_phase2
  def start_phase2
    @last_turn = $game_temp.battle_turn if @last_turn == nil
    if KGC::AR_RECOVER_TIMING == 1 && $game_temp.battle_turn != @last_turn
      @last_turn = $game_temp.battle_turn
      ($game_party.actors + $game_troop.enemies).each { |battler|
        apply_auto_recover(battler)
      }
      # ステータスウィンドウをリフレッシュ
      @status_window.refresh
    end

    start_phase2_KGC_AutoRecover
  end
  #--------------------------------------------------------------------------
  # ● 自動回復適用
  #--------------------------------------------------------------------------
  def apply_auto_recover(battler)
    # ステート判定
    battler.states.compact.each { |state|
      # 毎ターン回復ステート判定
      next unless $game_special_states["auto_recover"] =~ $data_states[state].name
      # 回復量を取得
      recover = $2.to_i
      # 回復するパラメータで分岐
      if $1 != nil
        case $1.upcase
        when "HP"  # HPだけの場合
          recover_hp = $3 != nil ? battler.maxhp * recover / 100 : recover
        when "SP"  # SPだけの場合
          recover_sp = $3 != nil ? battler.maxsp * recover / 100 : recover
        end
      else  # HP/SP両方の場合
        if $3 != nil
          recover_hp = battler.maxhp * recover / 100
          recover_sp = battler.maxsp * recover / 100
        else
          recover_hp = recover
          recover_sp = recover
        end
      end
      # 回復処理
      battler.hp += recover_hp if recover_hp != nil
      battler.sp += recover_sp if recover_sp != nil
      # HP回復値が設定されている場合
      if recover_hp != nil && recover_hp > 0
        battler.damage = -recover_hp
        if $imported["SPDamage"] && recover_sp != nil
          if battler.sp_damage != nil
            battler.sp_damage -= recover_sp
          else
            battler.sp_damage = -recover_sp
          end
        end
        battler.damage_pop = true
      # SP回復値のみ設定されている場合
      elsif recover_sp != nil && recover_sp > 0
        battler.damage = nil
        if $imported["SPDamage"]
          if battler.sp_damage != nil
            battler.sp_damage -= recover_sp
          else
            battler.sp_damage = -recover_sp
          end
        else
          battler.damage = "#{$data_system.words.sp}+ #{recover_sp}"
        end
        battler.damage_pop = true
      end
    }
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle (分割定義 4)
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias update_phase4_step6_KGC_AutoRecover update_phase4_step6
  def update_phase4_step6
    update_phase4_step6_KGC_AutoRecover

    # 行動者が生存している場合
    if KGC::AR_RECOVER_TIMING == 0 && !@active_battler.dead?
      # 自動回復
      apply_auto_recover(@active_battler)
      # ステータスウィンドウをリフレッシュ
      @status_window.refresh if @active_battler.damage_pop
    end
  end
end



행동 후에 HP/SP를 자동 회복하는 스크립트입니다.
스테이트를 사용하므로, 간단하게 설정 을 할 수가 있습니다.

스크립트가 완료하면, 스테이트를 작성합니다.
스테이트는[저항하지 않는]을 체크해,[레이팅]을 0 으로 해 두어 주세요.
그 외의 설정은 뭐든지 상관하지 않습니다.

스테이트의 서식은
 "[HP|SP]회복{회복량}[%|%]"
입니다.({ }는 수치,[ ]는 생략 가능.그 이외는 필수)

최초의 [HP|SP] 는
「"HP"또는"SP"를 기술, 혹은 생략」이라고 하는 의미입니다.
"HP"라면 HP를,"SP"라면 SP를, 생략 하면 HP/SP양쪽 모두를 회복합니다.

{회복량}[%|%] 에는, HP/SP의 회복량을 입력합니다.
이 때"%"를 생략 하면, 입력한 값이 그대로 회복량이 됩니다.
"%"는 전각에서도 반각에서도 OK입니다.

  기술예
SP회복 5% … 매턴 SP 를 5% 회복.
회복 300 … 매턴 HP/SP 를 300 회복.

그리고는, 전투중에 스테이트를 부가하면 완료입니다.
항상 효과를 적용하고 싶은 경우는, 로드시나 전투 개시시에 스테이트를 부가해 주면 OK입니다.
(잘 모르는 경우는 턴 0의 배틀 이벤트로 부가해 주세요)

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6202
861 기타 엔딩후 캐릭터 이어서 새로운 게임시작 스크립트 1 file 백호 2009.02.21 1263
860 메뉴 개별 메뉴 호출 단축키 스크립트 5 file 백호 2009.02.21 1965
859 전투 사이드뷰 전투(보행그래픽) 15 file 백호 2009.02.21 4244
858 전투 액티브 타임 배틀(보행그래픽) file 백호 2009.02.21 2104
857 전투 마법검 스크립트 file 백호 2009.02.21 1118
856 전투 마법반사 스크립트 1 file 백호 2009.02.21 1217
855 장비 장비 착용 효과 스크립트 14 file 백호 2009.02.21 2323
854 기타 상점 변동시세 적용 스크립트 3 file 백호 2009.02.21 1163
853 이동 및 탈것 데쉬 기능 스크립트 8 file 백호 2009.02.21 1508
852 전투 배틀 스테이터스·클리어 디자인 13 file 백호 2009.02.21 2468
851 전투 레벨 상승 화면 개조 스크립트 4 file 백호 2009.02.21 1884
850 메뉴 FF7형식의 메뉴로 변경하는 스크립트 1 file 백호 2009.02.21 1463
849 전투 렙업했을때 포인트 주고 스탯 올리기 7 file 백호 2009.02.21 1685
848 상태/속성 순간 적으로 무적상태되는 스크립트 백호 2009.02.21 1161
847 기타 모험 일기 스크립트 2 file 백호 2009.02.21 1434
846 기타 요리 시스템 스크립트 12 file 백호 2009.02.21 2023
845 이동 및 탈것 기차스크립트 6 백호 2009.02.21 1757
844 메뉴 링메뉴 스크립트 file 백호 2009.02.21 1392
843 상점 상점 직접 장비 스크립트 1 file 백호 2009.02.21 1771
842 전투 전투 특수효과 ActionEX 스크립트 1 file 백호 2009.02.21 1660
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