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
137 전투 XAS VX ACE 데모 한글 번역 ( 스크립트 번역 모음 ) 1 미루 2013.01.10 4556
136 전투 XAS Hero Edition Ace Experimental 0.5 6 Alkaid 2012.01.15 6130
135 전투 WhiteFlute: 자동전투 스크립트 3 file Alkaid 2012.09.20 3774
134 맵/타일 WhiteFlute - XPMap-EX (VX Ace에서 XP의 맵 데이터를 읽을 수 있게 함) 3 Alkaid 2012.12.26 1502
133 스킬 VXACE 패시브 스킬 스크립트 Ver. 0.82 21 file 아이미르 2012.03.07 6669
132 장비 VXAce 장비장착 스킬발동 스크립트 2 아이미르 2012.09.02 2400
131 스킬 VXAce 아츠장착 스킬습득 스크립트 1 file 아이미르 2013.02.24 2777
130 아이템 VXAce 아이템 합성 스크립트 Ver 0.8 17 아이미르 2012.08.23 4000
129 아이템 VXAce 아이템 채집 스크립트 23 file 아이미르 2012.11.23 4051
128 아이템 VXAce 아이템 도감 스크립트 7 file 아이미르 2012.12.31 3801
127 스킬 VXAce 스킬포인트 스크립트 5 file 아이미르 2013.03.21 4150
126 스킬 VXAce 스킬레벨, 스킬장착 스크립트 11 file 아이미르 2012.11.01 3813
125 아이템 VXAce 셋트장비 스크립트 9 file 아이미르 2013.03.08 3642
124 상점 VXAce 상점 스크립트 V0.9 17 아이미르 2012.06.29 5380
123 전투 VXAce 사이드뷰 스크립트 (번역) 23 아이미르 2012.12.10 6356
122 스킬 VXAce 경험치 스킬습득 스크립트 3 file 아이미르 2012.10.27 2726
121 버그픽스 VXAce SP1 2 Alkaid 2013.02.15 2047
120 상점 VXAce SkillShop 스크립트 3 file 아이미르 2012.10.30 2895
119 아이템 VXAce No Recipe 아이템합성 스크립트(버그 수정) 11 file 아이미르 2013.01.07 3308
118 제작도구 VXAce HUD Designer by Cidiomar R. Dias Jr 1 file 습작 2013.01.19 6761
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11