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
721 메뉴 링메뉴 스크립트 file 백호 2009.02.21 1391
720 기타 게이지 3 백호 2009.02.21 1394
719 텔로포트 스크립트 8 WMN 2008.03.17 1397
718 저장 Woratana's Neo Save System for RMXP by LiTTleDRAgo 5 Alkaid 2013.01.19 1398
717 메뉴 콤보 스크립트 백호 2009.02.22 1399
716 영상 berka's Video Script II Reloaded 1.2 2 Alkaid 2010.10.08 1399
715 기타 마법반사스크립트 4 *ps인간 2009.01.26 1403
714 저장 오류 수정한 자동세이브 2 백호 2009.02.22 1403
713 기타 Multiple Languages v2 by SephirothSpawn (SDK호환) file 백호 2009.02.22 1404
712 전투 KGC_PreempAttack(선제공격) file 백호 2009.02.22 1405
711 기타 필요 경험치 직접 정하기 9 백호 2009.02.21 1407
710 기타 풀스크린 스크립트 2 백호 2009.02.22 1407
709 이동 및 탈것 KGC_SetAttackElement (공격속성설정) file 백호 2009.02.22 1407
708 전투 숙력도 시스템 스크립트 2 백호 2009.02.21 1408
707 타이틀/게임오버 타이틀음악 백호 2009.02.22 1410
706 메뉴 링메뉴에 돈(G)표시하기 백호 2009.02.21 1413
705 기타 비밀소년님의 경험치 표시 스크립트 백호 2009.02.22 1419
704 저장 [신기술 체험] 데이터 저장 6 file 백호 2009.02.22 1420
703 키입력 전체 키 사용 스크립트 1 백호 2009.02.21 1423
» 전투 마법검 스크립트 1 백호 2009.02.22 1425
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ... 52 Next
/ 52