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
321 기타 Sphere Grid System file 백호 2009.02.21 765
320 메뉴 제가 쓰는 메뉴 14 file 백호 2009.02.21 2319
319 HUD 새로운방법의 맵이름 표시 31 file 백호 2009.02.21 4618
318 전투 횡스크롤형식의 스크립트 7 백호 2009.02.21 2980
317 기타 말걸면그림천천히뜨기 4 file 백호 2009.02.21 1102
316 전투 A-battle 수정 file 백호 2009.02.21 1155
315 HUD 직업명띄우기 스크립트 2 백호 2009.02.21 1123
314 기타 무기& 방어구 레벨제한 스크립트 23 file 백호 2009.02.21 1880
313 아이템 아이템 정리기능 S크립T 1 file 백호 2009.02.21 1082
312 기타 [KGC]HP&SP게이지 색다른것(글씨와 게이지가 안겹침) 10 file 백호 2009.02.21 2732
311 장비 [KGC]장비 제한(레벨,완력등등) 7 file 백호 2009.02.21 1780
310 메뉴 Tales Of Symphonia Menu 8 file 백호 2009.02.21 1744
309 이동 및 탈것 젤다 스타일 맵스크롤 5 file 백호 2009.02.21 1839
308 메시지 문자 메세지 띄우기 스크립트 10 file 백호 2009.02.21 3070
307 이동 및 탈것 Mouse_move 호환 100%강화버전 4 file 백호 2009.02.21 1513
306 기타 레벨9999스크립트 4 백호 2009.02.21 1151
305 이동 및 탈것 Mouse_move 호환버전 1 file 백호 2009.02.21 1059
304 전투 시뮬레이션 턴알 3 file 백호 2009.02.21 3055
303 이동 및 탈것 마우스 이동 조금 뜯어봤습니다. file 백호 2009.02.21 1680
302 기타 [KGC]강화스크립트 백호 2009.02.21 1667
Board Pagination Prev 1 ... 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 ... 52 Next
/ 52