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 6202
1021 아이템 흠..몬스터도감말고 아이템도감~ 9 백호 2009.02.21 2028
1020 전투 흠.. 아직도 이 스크립트가 없군요 ㅋㅋ(제가올림..) 1 file 백호 2009.02.21 3337
1019 전투 횡스크롤형식의 스크립트 7 백호 2009.02.21 2980
1018 기타 횡스크롤 스크립트 한국말 번역. 15 file 백호 2009.02.21 3315
1017 기타 회복으로 데미지를 받는 좀비 스크립트 7 백호 2009.02.22 2010
1016 메뉴 화살표 모양 셀렉트 커서 사용 2 백호 2009.02.22 2118
1015 그래픽 화면을 부드럽게 해주는스크립트[ 아주 유용] 56 file - 하늘 - 2009.08.05 6566
1014 미니맵 화면에 축소된 미니맵을 표시하는 스크립트 - 한글 번역 - 6 file 백호 2009.02.21 2560
1013 화면에 축소된 맵을 표시하는 스크립트 7 file 백호 2009.02.21 2394
1012 기타 홈페이지 띄우기 (VX 상관없음.) 6 KNAVE 2009.08.25 2139
1011 메뉴 혹시있나해서-_-.. 대화창에 테두리치기 스크립트 7 백호 2009.02.22 2596
1010 기타 현재시간표시 33 file 코아 코스튬 2010.10.09 2529
1009 기타 현재 맵BGM을 그대로 전투 BGM으로 연결 from phylomortis.com 백호 2009.02.22 1180
1008 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 507
1007 메시지 한글자씩 뜨는 스크립트 6 백호 2009.02.21 3004
1006 키입력 한글입력스크립트 16 file 아방스 2007.11.09 11828
1005 키입력 한글입력기(자음, 모음 분리. 아마 중복일 듯...) 11 캉쿤 2011.09.13 3225
1004 키입력 한글입력기 6 백호 2009.02.22 4306
1003 이름입력 한글이름 입력기 스크립트 14 백호 2009.02.22 4211
1002 메시지 한글 채팅 스크립트 32 file こなた 2009.01.22 4947
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