Ace 스크립트

이 시스템은 공격시에 미스가 날때까지의 공격횟수를 세어주면서 그 횟수가 몇이냐에 따라 Cool, Great, Awesome 등의 감탄사를 표시해주는 스크립트입니다. (파티원 전체의 공격을 카운팅합니다.)

잘 응용하면 콤보공격시스템을 개발할 수 있고, TP시스템과 병행하면 엄청나게 머리를 써야 하는 배틀 시스템이 만들어지지 않을까 싶습니다.

출처 : http://yamiworld.wordpress.com/2011/12/17/ikaros-have-evolved/






#==============================================================================
# 겈 YSA Battle Add-On: Party's Combo Counter
# -- Last Updated: 2011.12.16
# -- Level: Easy
# -- Requires: none
#==============================================================================

$imported = {} if $imported.nil?
$imported["YSA-PartyComboCounter"] = true

#==============================================================================
# 겈 Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.16 - Started Script and Finished.
#==============================================================================
# 겈 Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script will make a combo counter for party, which will show Number of Hits,
# Damage and Congratulation Words.
#==============================================================================
# 겈 Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below 겈 Materials/멹띫 but above 겈 Main. Remember to save.
#==============================================================================
# 겈 Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#==============================================================================

module YSA
  module COMBO
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Congratulation Words -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # When you reach a number of combo counts, there will have a congratulation
    # words like Great, Awesome, ... be shown under combo counter.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    CONGRAT_WORDS = { # Do not delete this,
      # ComboCounts       =>       "WORDS",
            3             =>        "Cool!",
            5             =>        "Great!",
            7             =>        "Awesome!",
            9             =>        "GODLIKE!!!",
    } # Do not delete this,
    CONGRAT_FONT = "VL Gothic"    
    CONGRAT_COLOR = [255,255,160] #[R,G,B]
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Mechanical Config -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # About when will stop combo counting.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    # When combo counter is being counting, if next damaged action is enemy's,
    # the combo counter will be stopped and start from zero.
    CANCEL_COMBO_WHEN_ENEMY_HIT = true
    
    # When combo counter is being counting, if next actor's attack is missed, 
    # cancel combo counting.
    CANCEL_COMBO_IF_MISS = true
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Visual Config -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # About when will stop combo counting.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    # FONT
    FONT_NAME = "VL Gothic"
    FONT_SIZE = 28
    
    # POSITION
    COMBO_COUNT_SENTENCE = "%d Hits!"
    COMBO_DAMAGE_SENTENCE = "%d Damage"
    
  end
end

#==============================================================================
# 겈 Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

#==============================================================================
# 걾 Sprite_Combo_Count
#==============================================================================

class Sprite_Combo_Count < Sprite_Base
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :count
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(viewport)
    super(viewport)
    self.opacity = 0
    self.x = Graphics.width - Graphics.width / 4
    self.y = 0
    @count = false
    @number = 0
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return unless SceneManager.scene_is?(Scene_Battle)
    if @count == true && SceneManager.scene.combo_count != nil
      self.zoom_x = self.zoom_y = 1.5 if @number != SceneManager.scene.combo_count
      refresh if @number != SceneManager.scene.combo_count      
      self.opacity = 120 if self.opacity < 120
      self.opacity += 10 if self.opacity < 255      
      self.zoom_x -= 0.1 if self.zoom_x > 1.0
      self.zoom_y -= 0.1 if self.zoom_y > 1.0
      self.y = 0 if self.y != 0
    end
    @count = false if @count == true && SceneManager.scene.combo_count == nil
    if @count == false && (self.bitmap != nil || (self.bitmap != nil && self.bitmap.disposed?))
      self.y -= [1, self.y + 24].min
      self.opacity -= 11
    end
    self.bitmap.dispose if self.opacity == 0 && self.bitmap != nil && !self.bitmap.disposed?
    @number = 0 if self.opacity == 0
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @number = SceneManager.scene.combo_count
    bitmap = Bitmap.new(Graphics.width / 4, 26)
    bitmap.font.name = YSA::COMBO::FONT_NAME
    bitmap.font.size = YSA::COMBO::FONT_SIZE
    bitmap.font.bold = true
    bitmap.font.out_color.set(0, 0, 0, 255)
    bitmap.font.color.set(255, 255, 255)
    text = sprintf(YSA::COMBO::COMBO_COUNT_SENTENCE, @number)
    bitmap.draw_text(0, 0, Graphics.width / 4, 26, text, 2)
    self.bitmap.dispose if self.bitmap != nil
    self.bitmap = bitmap
  end
  
end

#==============================================================================
# 걾 Sprite_Combo_Damage
#==============================================================================

class Sprite_Combo_Damage < Sprite_Base
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :count
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(viewport)
    super(viewport)
    self.opacity = 0
    self.x = Graphics.width - Graphics.width / 4
    self.y = 26
    @count = false
    @number = 0
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return unless SceneManager.scene_is?(Scene_Battle)
    if @count == true && SceneManager.scene.combo_damage != nil
      refresh if @number != SceneManager.scene.combo_damage      
      self.opacity = 120 if self.opacity < 120
      self.opacity += 10 if self.opacity < 255      
    end
    @count = false if @count == true && SceneManager.scene.combo_damage == nil
    if @count == false && (self.bitmap != nil || (self.bitmap != nil && self.bitmap.disposed?))
      self.opacity -= 11
    end
    self.bitmap.dispose if self.opacity == 0 && self.bitmap != nil && !self.bitmap.disposed?
    @number = 0 if self.opacity == 0
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @number += [SceneManager.scene.combo_damage - @number, (12 + rand(20)) * ((SceneManager.scene.combo_damage - @number) / 1000 + 1)].min
    bitmap = Bitmap.new(Graphics.width / 4, 26)
    bitmap.font.name = YSA::COMBO::FONT_NAME
    bitmap.font.size = YSA::COMBO::FONT_SIZE
    bitmap.font.bold = true
    bitmap.font.out_color.set(0, 0, 0, 255)
    bitmap.font.color.set(255, 255, 255)
    text = sprintf(YSA::COMBO::COMBO_DAMAGE_SENTENCE, @number)
    bitmap.draw_text(0, 0, Graphics.width / 4, 26, text, 2)
    self.bitmap.dispose if self.bitmap != nil
    self.bitmap = bitmap
  end
  
end

#==============================================================================
# 걾 Sprite_Combo_Congrat
#==============================================================================

class Sprite_Combo_Congrat < Sprite_Base

  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(viewport)
    super(viewport)
    self.opacity = 0
    self.x = Graphics.width - Graphics.width / 4
    self.y = 52
    @number = 0
    @count = false
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return unless SceneManager.scene_is?(Scene_Battle)
    @count = SceneManager.scene.sprite_combo_count.count
    if @count == true && SceneManager.scene.combo_count != nil
      refresh if @number != SceneManager.scene.combo_count
      self.opacity = 120 if self.opacity < 120
      self.opacity += 10 if self.opacity < 255      
      self.zoom_x -= 0.1 if self.zoom_x > 1.0
      self.zoom_y -= 0.1 if self.zoom_y > 1.0
    end
    @count = false if @count == true && SceneManager.scene.combo_count == nil
    if @count == false && (self.bitmap != nil || (self.bitmap != nil && self.bitmap.disposed?))
      self.opacity -= 14
    end
    self.bitmap.dispose if self.opacity == 0 && self.bitmap != nil && !self.bitmap.disposed?
    @number = 0 if self.opacity == 0
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    @number = SceneManager.scene.combo_count
    if YSA::COMBO::CONGRAT_WORDS[@number] != nil
      self.zoom_x = self.zoom_y = 2.0
      bitmap = Bitmap.new(Graphics.width / 4, 36)
      bitmap.font.name = YSA::COMBO::CONGRAT_FONT
      bitmap.font.size = 36
      bitmap.font.bold = true
      bitmap.font.out_color.set(0, 0, 0, 255)
      color = YSA::COMBO::CONGRAT_COLOR
      bitmap.font.color.set(color[0], color[1], color[2])
      text = YSA::COMBO::CONGRAT_WORDS[@number]
      bitmap.draw_text(0, 0, Graphics.width / 4, 36, text, 2)
      self.bitmap.dispose if self.bitmap != nil
      self.bitmap = bitmap
    end
  end
  
end

#==============================================================================
# 걾 Game_Battler
#==============================================================================

class Game_Battler < Game_BattlerBase
  
  #--------------------------------------------------------------------------
  # alias method: execute_damage
  #--------------------------------------------------------------------------
  alias combo_execute_damage execute_damage
  def execute_damage(user)
    combo_execute_damage(user)
    if user.actor?
      SceneManager.scene.combo_count = 0 if SceneManager.scene.combo_count == nil
      SceneManager.scene.combo_damage = 0 if SceneManager.scene.combo_damage == nil
      SceneManager.scene.sprite_combo_count.count = true
      SceneManager.scene.sprite_combo_damage.count = true
      SceneManager.scene.combo_count += 1
      SceneManager.scene.combo_damage += @result.hp_damage
    end
    SceneManager.scene.combo_count = nil if user.enemy? && YSA::COMBO::CANCEL_COMBO_WHEN_ENEMY_HIT
    SceneManager.scene.combo_damage = nil if user.enemy? && YSA::COMBO::CANCEL_COMBO_WHEN_ENEMY_HIT
  end
  
  #--------------------------------------------------------------------------
  # alias method: item_apply
  #--------------------------------------------------------------------------
  alias combo_item_apply item_apply
  def item_apply(user, item)
    combo_item_apply(user, item)
    SceneManager.scene.combo_count = nil if item.damage.none?
    SceneManager.scene.combo_damage = nil if item.damage.none?
    SceneManager.scene.combo_count = nil if user.actor? && @result.missed && YSA::COMBO::CANCEL_COMBO_IF_MISS
    SceneManager.scene.combo_damage = nil if user.actor? && @result.missed && YSA::COMBO::CANCEL_COMBO_IF_MISS
  end
  
end

#==============================================================================
# 걾 Spriteset_Battle
#==============================================================================

class Spriteset_Battle
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :viewportCombo

  #--------------------------------------------------------------------------
  # alias method: create_viewports
  #--------------------------------------------------------------------------
  alias combo_viewport_create_viewports create_viewports
  def create_viewports
    combo_viewport_create_viewports
    @viewportCombo = Viewport.new
    @viewportCombo.z = 250
  end
  
end

#==============================================================================
# 걾 Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :combo_count
  attr_accessor :combo_damage
  attr_accessor :sprite_combo_count
  attr_accessor :sprite_combo_damage
  
  #--------------------------------------------------------------------------
  # alias method: create_all_windows
  #--------------------------------------------------------------------------
  alias combo_create_all_windows create_all_windows
  def create_all_windows
    combo_create_all_windows
    @sprite_combo_count = Sprite_Combo_Count.new(SceneManager.scene.spriteset.viewportCombo)
    @combo_count = nil
    @sprite_combo_damage = Sprite_Combo_Damage.new(SceneManager.scene.spriteset.viewportCombo)
    @combo_damage = nil
    @sprite_combo_congrat = Sprite_Combo_Congrat.new(SceneManager.scene.spriteset.viewportCombo)
  end
  
  #--------------------------------------------------------------------------
  # alias method: dispose_spriteset
  #--------------------------------------------------------------------------
  alias combo_dispose_spriteset dispose_spriteset
  def dispose_spriteset
    combo_dispose_spriteset
    @combo_count = nil
    @combo_damage = nil
    @sprite_combo_count.dispose
    @sprite_combo_damage.dispose
    @sprite_combo_congrat.dispose
  end
  
  #--------------------------------------------------------------------------
  # alias method: update_basic
  #--------------------------------------------------------------------------
  alias combo_update_basic update_basic
  def update_basic
    combo_update_basic
    @sprite_combo_count.update if @sprite_combo_count != nil
    @sprite_combo_damage.update if @sprite_combo_damage != nil
    @sprite_combo_congrat.update if @sprite_combo_congrat != nil
    @combo_count = nil if BattleManager.turn_end? && @combo_count != nil
    @combo_damage = nil if BattleManager.turn_end? && @combo_damage != nil
  end
  
end
#==============================================================================
# 겈 End of File
#==============================================================================

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 5592
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 29395
217 기타 '결정 키로 이벤트 시작' 조건분기 추가 file Bunny_Boy 2016.01.16 1188
216 기타 (링크)RPG VX ACE 블랙잭 스크립트 게임애호가 2017.06.18 1029
215 기타 77er 월드 맵 1.0 by 77er 3 file 77ER. 2013.08.14 2311
214 이동 및 탈것 8 방향 이동 스크립트 ( 사선 이동 캐릭터 그래픽 지원 ) 9 file 미루 2013.07.11 4873
213 전투 Ace 경험치 직접 설정 12 쿠쿠밥솥 2012.02.05 4028
212 장비 Ace 장비 착용의 제한 스크립트 11 아이미르 2012.09.01 2812
211 기타 ACE) 오블리비언 락픽 구현 V0.5.2 7 file 77이알 2012.09.02 4826
210 기타 ACE) 캐릭터 사전 by 77ER 19 77이알 2012.09.17 3961
209 메뉴 ace용 mog메뉴와 mog전투 10 file 꿈꾸는사람 2012.08.04 6078
208 액터 Actor Creation System by Tsukihime 4 Alkaid 2012.09.16 3572
207 메시지 Advanced Text System by modern algebra 2 Alkaid 2013.02.04 2355
206 메시지 ATS: Special Message Codes 1.0 by Modern Algebra 1 file Alkaid 2012.01.15 4738
205 오디오 Audio Pump Up: FMOD Ex by mikb89 2 Alkaid 2012.09.08 2099
204 전투 Basic Enemy HP Bars 2.1 by V.M 10 Alkaid 2013.02.21 4234
203 전투 Code Crush VXAce-RGSS3-21 프론트뷰 改 2 15 Alkaid 2013.01.28 4295
202 전투 CP's Battle Engine by Neon Black 20 Alkaid 2013.02.14 4989
201 퀘스트 CSCA]콜로세움 시스템 4 file 글쎄,왜 난 적용이 안될까? 2013.06.09 3652
200 메뉴 Customizable Main Menu 1.0b by modern algebra 4 file Alkaid 2012.02.13 5476
199 기타 Dialog Extractor 1.04 (VXA/VX/XP) 6 AltusZeon 2014.01.16 11713
198 전투 Drop Options by modern algebra 3 Alkaid 2012.09.17 2873
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11