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 28925
» 전투 스킬 캐스팅 시스템 3 스리아씨 2013.10.12 32164
216 전투 RPG VX Ace 전투 대사 한글화 37 재규어 2012.01.04 20291
215 전투 Yanfly 엔진 - 몬스터의 레벨 설정 6 file 스리아씨 2013.11.08 13003
214 이름입력 한글 이름입력창 23 file 에틴 2012.01.23 11679
213 기타 Dialog Extractor 1.04 (VXA/VX/XP) 6 AltusZeon 2014.01.16 11668
212 기타 원하는 글씨체로 변경하기 12 조말생 2012.04.20 8847
211 이름입력 전체키 + 조합한글 + 이름입력처리 변경 47 file 허걱 2012.07.04 8198
210 전투 vx ace 애니메이션 배틀 3 gor 2012.05.27 7664
209 전투 SRPG 컨버터 for Ace (SRPGコンバータ for Ace) by AD.Bank 27 file 습작 2012.04.17 7274
208 메시지 [스크립트] Ace Message System - by. Yanfly 17 file 허걱 2012.05.21 7252
207 그래픽 [ACE][BR] Awesome Light Effects 1.0(빛관련 스크립트) 37 file 꿈꾸는사람 2012.08.02 7014
206 메뉴 Etude87's Menu Editor 44 file 습작 2014.07.17 6992
205 전투 [스크립트] Sideview Battle System ver. 1.00 (일본어) 7 file 허걱 2012.05.20 6912
204 제작도구 VXAce HUD Designer by Cidiomar R. Dias Jr 1 file 습작 2013.01.19 6761
203 메뉴 [VX Ace] 다이얼 링 메뉴 스크립트 8 file RaonHank 2012.04.16 6670
202 스킬 VXACE 패시브 스킬 스크립트 Ver. 0.82 21 file 아이미르 2012.03.07 6669
201 장비 사용자 장비 슬롯 1.1 27 file 아방스 2012.01.31 6615
200 미니맵 미니맵 표시 스크립트 21 file 아방스 2012.01.16 6488
199 전투 VXAce 사이드뷰 스크립트 (번역) 23 아이미르 2012.12.10 6356
198 전투 XAS Hero Edition Ace Experimental 0.5 6 Alkaid 2012.01.15 6130
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11