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 5605
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 29441
17 타이틀/게임오버 코아 코스튬씨의 랜덤 타이틀 스크립트를 VX Ace용으로 변환 (완성판) 2 Alkaid 2012.01.25 4017
16 이동 및 탈것 RPG VX ACE ( RGSS3_8direction_move_v1.01 ) 8방향 스크립트 17 file 쿠쿠밥솥 2012.01.24 5466
15 전투 Sideview08 Ace 테스트 버전 (인 듯 합니다) 5 재규어 2012.01.24 4412
14 이름입력 한글 이름입력창 23 file 에틴 2012.01.23 11775
13 미니맵 미니맵 표시 스크립트 21 file 아방스 2012.01.16 6519
12 전투 XAS Hero Edition Ace Experimental 0.5 6 Alkaid 2012.01.15 6166
11 메시지 ATS: Special Message Codes 1.0 by Modern Algebra 1 file Alkaid 2012.01.15 4743
10 아이템 물품 이름 컬러 변경 14 까까까 2012.01.04 5668
9 전투 RPG VX Ace 전투 대사 한글화 37 재규어 2012.01.04 20330
8 타이틀/게임오버 코아 코스튬씨의 랜덤 타이틀 출력 스크립트를 VX Ace용으로 변환 (테스트용) 1 Alkaid 2011.12.29 3213
7 기타 Picture Gallery Ace by MogHunter 1 Alkaid 2011.12.28 3487
6 변수/스위치 TYPE74RX-T: 셀프 스위치를 실시간으로 조작 Alkaid 2011.12.23 3361
5 기타 Victor Engine 1 Alkaid 2011.12.21 4100
4 스킬 스킬 스틸 시스템 5 아르피쥐 2011.12.18 3913
» 전투 콤보 카운팅 시스템 4 아르피쥐 2011.12.18 4625
2 기타 Yanfly Engine Ace Alkaid 2011.12.10 4414
1 전투 [VX Ace] Damage Popup by Dargor 7 Alkaid 2011.12.04 5483
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11