XP 스크립트

통상 공격하면, 일정 확률로 스킬이 발동하는 무기를 작성합니다.
발동하는 스킬·확률은 무기 마다 설정할 수 있어 발동해도 SP는 줄어 들지 않습니다.

사용법1

무기명에 [MW{ID},{확률}] (을)를 추가합니다.
예를 들면 「 10% 의 확률로 ID:20 의 스킬을 발동시킨다」경우는
무기명[MW20,10]
됩니다.

사용법2

속성 마법검 (을)를 만들어, 무기로 세트 합니다.
그리고는 무기의[민첩함+]%의 확률로 ID:[손재주가 있음+]의 스킬이 발동합니다.

예를 들면, 10% 의 확률로 ID:20 의 스킬을 발동시키고 싶은 경우는,
[손재주가 있음+] 20
[민첩함+] 10
(이)라고 입력합니다.
 
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/  ◆마법검 - KGC_MagicWeapon◆
#_/----------------------------------------------------------------------------
#_/ 통상 공격시에 일정 확률로 스킬이 발동하는 무기를 작성합니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

$imported["MagicWeapon"] = true

# 마법검용 속성
$game_special_elements["magic_weapon"] = $data_system.elements.index("魔法?")

#==============================================================================
# ■ RPG::Weapon
#==============================================================================

class RPG::Weapon
  #--------------------------------------------------------------------------
  # ● 이름 취득
  #--------------------------------------------------------------------------
  def name
    return @name.gsub(/[.*]/) {""}
  end
  #--------------------------------------------------------------------------
  # ● 발동 스킬 취득
  #--------------------------------------------------------------------------
  def exec_skill
    if @name =~ /[MW[ ]*([0-9]+)[ ]*,[ ]*([0-9]+)]/i
      return [$1.to_i, $2.to_i]
    elsif @element_set.include?($game_special_elements["magic_weapon"])
      return [@dex_plus, @agi_plus]
    else
      return nil
    end
  end
end

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

#==============================================================================
# ■ Game_Battler (분할 정의 1)
#------------------------------------------------------------------------------
#  버틀러를 취급하는 클래스입니다.이 클래스는 Game_Actor 클래스와 Game_Enemy 곳간
# 스의 슈퍼 클래스로서 사용됩니다.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_accessor :magic_weapon            # 마법검발동 플래그
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias initialize_KGC_MagicWeapon initialize
  def initialize
    # 원래의 처리를 실행
    initialize_KGC_MagicWeapon

    @magic_weapon = false
  end
end

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

#==============================================================================
# ■ Scene_Battle (분할 정의 3)
#------------------------------------------------------------------------------
#  배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (액터 커멘드 국면)
  #--------------------------------------------------------------------------
  alias update_phase3_KGC_MagicWeapon update_phase3
  def update_phase3
    # 마법검발동 플래그 해제
    @active_battler.magic_weapon = false if @active_battler.magic_weapon

    # 원래의 처리를 실행
    update_phase3_KGC_MagicWeapon
  end
end

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

#==============================================================================
# ■ Scene_Battle (분할 정의 4)
#------------------------------------------------------------------------------
#  배틀 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (메인 국면 스텝 2 : 액션 개시)
  #--------------------------------------------------------------------------
  alias update_phase4_step2_KGC_MagicWeapon update_phase4_step2
  def update_phase4_step2
    # 원래의 처리를 실행
    update_phase4_step2_KGC_MagicWeapon

    # 마법검발동의 경우
    if @magic_weapon
      @phase4_step = 2
      @magic_weapon = false
    end
  end
  #--------------------------------------------------------------------------
  # ● 기본 액션 결과 작성
  #--------------------------------------------------------------------------
  alias make_basic_action_result_KGC_MagicWeapon make_basic_action_result
  def make_basic_action_result
    # 마법검발동 플래그 해제
    @active_battler.magic_weapon = false

    # 행동측 버틀러가 액터, 행동이 통상 공격의 경우
    if @active_battler.is_a?(Game_Actor) &&
        @active_battler.current_action.basic == 0
      # 마법검의 경우
      weapon = $data_weapons[@active_battler.weapon_id]
      if weapon != nil && weapon.exec_skill != nil
        # 공격 대상 설정
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
        # ?動判定
        if rand(100) < weapon.exec_skill[1]
          # アクションを設定
          @active_battler.current_action.kind = 1
          @active_battler.current_action.skill_id = weapon.exec_skill[0]
          # 魔法??動フラグを立てる
          @active_battler.magic_weapon = true
          # 魔法??動
          @magic_weapon = true
          # ?る
          return
        end
      end
    end

    # 元の?理を?行
    make_basic_action_result_KGC_MagicWeapon
  end
  #--------------------------------------------------------------------------
  # ● スキルアクション 結果作成
  #--------------------------------------------------------------------------
  alias make_skill_action_result_KGC_MagicWeapon make_skill_action_result
  def make_skill_action_result
    # 行動者がアクタ?、魔法??動、かつ?制アクションでなければ
    if @active_battler.is_a?(Game_Actor) && @active_battler.magic_weapon &&
        !@active_battler.current_action.forcing
      # 魔法??動フラグ解除
      @active_battler.magic_weapon = false
      # スキルを取得
      @skill = $data_skills[@active_battler.current_action.skill_id]
      # ステ?タスウィンドウをリフレッシュ
      @status_window.refresh
      # ヘルプウィンドウにスキル名を表示
      @help_window.set_text(@skill.name, 1)
      # アニメ?ション ID を設定
      @animation1_id = @skill.animation1_id
      @animation2_id = @skill.animation2_id
      # コモンイベント ID を設定
      @common_event_id = @skill.common_event_id
      # ?象側バトラ?を設定
      set_target_battlers(@skill.scope)
      # スキルの?果を適用
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
      return
    end

    # 元の?理を?行
    make_skill_action_result_KGC_MagicWeapon
  end
end

묻혀두기엔 너무 아까운거 같아서 다시 올립니다^^;;
근데 저두 사용법을 몰라서요..ㅜ.ㅜ
스크립트 잘 아시는님들은 이거 보고 사용법 점 알려주세요~^^
출저는 kgc-블루다운님의 게시물

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '1'
  • profile
    킬비 2012.07.07 09:35

    공격시 확률적으로 스킬이 발동한다니 멋진 스크립트네요. 감사합니다.

    (포맷할때 실수로 스크립트를 죄다 날려먹어서 횡스크롤 전투 찾으려고 이리저리 돌아다니는 킬비)


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
621 기타 Real-Time Day Night 3 백호 2009.02.22 751
620 HUD Advanced HUD Script 3 file 백호 2009.02.22 1341
619 저장 멀티넷스크립트 -> 아이피 세이브,로드 스크립트 9 file 백호 2009.02.22 2204
618 온라인 멀티넷스크립트 => 채팅보완 스크립트 8 file 백호 2009.02.22 2931
617 전투 배틀샵 스크립트 1 백호 2009.02.22 1126
616 전투 배틀 포인트 1 백호 2009.02.22 918
615 기타 멋진...제작자 정보를 그림으로 1 백호 2009.02.22 1233
614 기타 Near Fantastica's SDK Test Bed 3 file 백호 2009.02.22 885
613 기타 Text Scroll by Dubealex (Release 3) 2 file 백호 2009.02.22 939
612 기타 Multiple Currencies(여러 개의 통화단위 사용) 2 백호 2009.02.22 1124
611 메시지 1문자식 표시랑 따랑소리 나는 스크립트 8 백호 2009.02.22 2304
610 타이틀/게임오버 타이틀 아주 미묘한 효과 5 백호 2009.02.22 1857
609 기타 Terrain Encounter Areas by SephirothSpawn 백호 2009.02.22 778
» 전투 마법검 스크립트 1 백호 2009.02.22 1425
607 기타 Random Character Generator by SephirothSpawn (SDK호환) 1 백호 2009.02.22 1040
606 기타 KGC - RMXP 스크립트 개발용 프로젝트 1.01 4 file 백호 2009.02.22 1515
605 메뉴 새로운 cms 4 file 백호 2009.02.22 2117
604 메뉴 Event Spawner 1 file 백호 2009.02.22 979
603 스킬 약간 수정한 심플액알(크리티컬,스킬) 10 백호 2009.02.22 3836
602 기타 Dynamic Stores by Astro_mech@rmxp.net 1 file 백호 2009.02.22 878
Board Pagination Prev 1 ... 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ... 52 Next
/ 52