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 5109
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 28923
137 기타 시디 플레이어 1.0 by 77er 1 file 77ER. 2013.08.20 1627
136 기타 사칙연산 게임 by 77er 1 file 77ER. 2013.08.19 1606
135 기타 77er 월드 맵 1.0 by 77er 3 file 77ER. 2013.08.14 2281
134 타이틀/게임오버 타이틀 스크린 커스터마이징 11 file 라실비아 2013.08.12 5153
133 맵/타일 XP Map Loader by LiTTleDRAgo Alkaid 2013.07.23 1703
132 HUD Galv's Explorer's HUD 4 file 천공대전 2013.07.21 3638
131 전투 GTBS v2 for VX Ace by GubiD 1 Alkaid 2013.07.19 3057
130 메뉴 System Options v1.00 시스템 환경설정, 이동속도 10 file 믛디 2013.07.18 3447
129 변수/스위치 변수/스위치 전역 저장 시스템 ( 게임이 종료 및 재시작되어도 값이 변하지 않는 변수와 스위치를 설정 ) 7 미루 2013.07.11 3162
128 이동 및 탈것 8 방향 이동 스크립트 ( 사선 이동 캐릭터 그래픽 지원 ) 9 file 미루 2013.07.11 4845
127 맵/타일 XPMAP-EX : XPマップスクリプト by A Crying Minister (WHITE-FLUTE) file 습작 2013.06.09 3125
126 퀘스트 CSCA]콜로세움 시스템 4 file 글쎄,왜 난 적용이 안될까? 2013.06.09 3623
125 스킬 galvs]매직샤드 시스템. 1 file 글쎄,왜 난 적용이 안될까? 2013.06.09 2876
124 맵/타일 안개 시스템 ( VXA ) 8 홍색의환상향 2013.05.19 4089
123 키입력 Mouse System Buttons update 2.0 by Falcao 11 file 습작 2013.05.14 2526
122 키입력 VA鼠标脚本——全操作鼠标化 v1.3e by Sion 4 file 습작 2013.05.14 2027
121 전투 Ra TBS Alpha by Eshra 1 file 습작 2013.05.13 3856
120 전투 多人数SRPGコンバータ for Ace by AD.Bank 6 습작 2013.05.13 4037
119 전투 Schala 전투 시스템 (XAS에 의해 구동) 11 홍색의환상향 2013.05.05 5321
118 퀘스트 Quest Journal by modern algebra 11 file 습작 2013.05.03 3695
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11