Ace 스크립트

  1. =begin
    #==============================================================================
     ** Casting Time
     Author: Tsukihime
     Date: Sep 21, 2012
    ------------------------------------------------------------------------------
     ** Change log
     Sep 21
       - added "state added" battle log message
     Aug 26
       - added "suspended" state
       - fixed bug where using item crashes the game
     Aug 25
       - initial release
    ------------------------------------------------------------------------------   
     This script allows you to specify the amount of time that must pass
     before your skill is executed. Time is specified in "turns" but can be
     modified to support frames for active battle systems.
     
     It uses a "casting" state to in order to determine whether you are in the
     middle of casting the spell.
     
     The battler cannot accept any commands while in the casting state.
     
     When the amount of time required to cast the spell has passed, if the
     battler is still casting, then the cast state will be removed and the
     skill executed.
     
     A "suspended" state is available to pause the casting. When the suspended
     state is inflicted, the battler will still be casting, but the countdown
     does not change. When the suspended state is removed, the countdown will
     resume.
     
     When the casting state is removed, the battler's reserved casting skill will
     be removed as well, and control goes back to the battler.
    #==============================================================================
    =end
    $imported = {} if $imported.nil?
    $imported["Tsuki_CastingTime"] = true
    #==============================================================================
    # ** Configuration
    #==============================================================================
    module Tsuki
      module CastingTime
        
        # state to inflict when the battler is preparing for a skill
        Cast_State = 27
        
        # state to inflict when the casting should be paused
        Suspended_State = 28
        
        Cast_Time_Regex = /<cast-time:\s*(\d+)>/i
      end
    end
    #==============================================================================
    # ** Rest of script
    #==============================================================================
    module RPG
      class UsableItem
        
        # amount of time required to cast this skill
        def cast_time
          return @cast_time unless @cast_time.nil?
          r = Tsuki::CastingTime::Cast_Time_Regex.match(self.note) 
          return @cast_time = r ? r[1].to_i : 0
        end
      end
    end
    
    class Game_Action
       
      def cast_time
        return item ? item.cast_time : 0
      end
    end
    
    class Game_Battler
      attr_reader :casting_item
      attr_reader :casting_time
      
      alias :th_cast_time_init :initialize
      def initialize
        th_cast_time_init
        @casting_item = nil
        @casting_time = 0
      end
      
      # clear all casting 
      def clear_casting
        @casting_item = nil
        @casting_time = 0
      end
      
      def casting_state_id
        Tsuki::CastingTime::Cast_State
      end
      
      def suspend_casting_state_id
        Tsuki::CastingTime::Suspended_State
      end
      
      def casting?
        @states.include?(casting_state_id)
      end
      
      def suspend_casting?
        @states.include?(suspend_casting_state_id)
      end
    
      alias :th_cast_time_turn_end :on_turn_end
      def on_turn_end
        th_cast_time_turn_end
        update_cast_time unless suspend_casting?
      end
      
      alias :th_cast_time_battle_end :on_battle_end
      def on_battle_end
        th_cast_time_battle_end
        clear_casting
      end
      
      # decrease by 1 per turn (although it could be arbitrary in the future...)
      def update_cast_time
        @casting_time = [@casting_time - 1, 0].max
      end
      
      # determine whether we are going to cast, or starting to cast
      def check_cast_time
        if casting?
          if @casting_item && @casting_time <= 0
            execute_cast_item
            clear_casting
          end
        elsif suspend_casting?
          return false
        elsif current_action && current_action.cast_time > 0
          prepare_cast_time
          return true
        else
          clear_casting
        end
      end
      
      # automatically set up actions based on the casting
      def execute_cast_item
        remove_state(casting_state_id)
        make_actions
        @actions[0].set_skill(@casting_item.id)
      end  
      
      # initiate casting
      def prepare_cast_time
        @casting_item = current_action.item
        @casting_time = current_action.cast_time
        add_state(casting_state_id)
        @result.used = true
        @result.success = true
        @result.hp_damage = 0
        
        # action has been stored so we can just clear it out
        remove_current_action
      end
    end
    
    class Scene_Battle
      
      #-----------------------------------------------------------------------------
      # Skip command input if casting
      #-----------------------------------------------------------------------------
      alias :th_cast_time_start_actor_command_selection :start_actor_command_selection 
      def start_actor_command_selection
        if BattleManager.actor.casting?
          next_command 
        else
          th_cast_time_start_actor_command_selection
        end
      end
      
      # replace...might be bad
      def process_action
        return if scene_changing?
        if !@subject || !@subject.current_action
          @subject = BattleManager.next_subject
        end
        return turn_end unless @subject
        if @subject.check_cast_time # new line
          @log_window.display_action_results(@subject, @subject.casting_item)
        end
        if @subject.current_action
          @subject.current_action.prepare
          if @subject.current_action.valid?
            @status_window.open
            execute_action
          end
          @subject.remove_current_action 
        end
        process_action_end unless @subject.current_action
      end
    end

    사용 방법
    n에 숫자를 넣는데.. 정확한 캐스팅시간은 모르겠네요.
    아마 행동에 따른 횟수겠지만 ( 아니면 턴단위 )

    <cast-time: n>

Who's 스리아씨

?
뺘라뺘뺘

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 5110
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 28928
» 전투 스킬 캐스팅 시스템 3 스리아씨 2013.10.12 32174
38 전투 RPG VX Ace 전투 대사 한글화 37 재규어 2012.01.04 20291
37 전투 Yanfly 엔진 - 몬스터의 레벨 설정 6 file 스리아씨 2013.11.08 13003
36 전투 vx ace 애니메이션 배틀 3 gor 2012.05.27 7664
35 전투 SRPG 컨버터 for Ace (SRPGコンバータ for Ace) by AD.Bank 27 file 습작 2012.04.17 7274
34 전투 [스크립트] Sideview Battle System ver. 1.00 (일본어) 7 file 허걱 2012.05.20 6912
33 전투 VXAce 사이드뷰 스크립트 (번역) 23 아이미르 2012.12.10 6356
32 전투 XAS Hero Edition Ace Experimental 0.5 6 Alkaid 2012.01.15 6130
31 전투 [VX Ace] Damage Popup by Dargor 7 Alkaid 2011.12.04 5445
30 전투 Schala 전투 시스템 (XAS에 의해 구동) 11 홍색의환상향 2013.05.05 5321
29 전투 레벨업시 HP/MP 전체회복 9 쿠쿠밥솥 2012.02.05 5029
28 전투 CP's Battle Engine by Neon Black 20 Alkaid 2013.02.14 4957
27 전투 콤보 카운팅 시스템 4 아르피쥐 2011.12.18 4589
26 전투 XAS VX ACE 데모 한글 번역 ( 스크립트 번역 모음 ) 1 미루 2013.01.10 4557
25 전투 사이드뷰 배틀 스크립트 (Animated Battlers By Jet10985) 6 file Rebiart 2014.05.18 4517
24 전투 Sideview08 Ace 테스트 버전 (인 듯 합니다) 5 재규어 2012.01.24 4386
23 전투 전투시 나오는 메세지 삭제 10 Nintendo 2012.03.03 4358
22 전투 Code Crush VXAce-RGSS3-21 프론트뷰 改 2 15 Alkaid 2013.01.28 4270
21 전투 Basic Enemy HP Bars 2.1 by V.M 10 Alkaid 2013.02.21 4207
20 전투 多人数SRPGコンバータ for Ace by AD.Bank 6 습작 2013.05.13 4038
Board Pagination Prev 1 2 Next
/ 2