Ace 스크립트

Source Thread: http://www.hbgames.org/forums/viewtopic.php?f=11&t=75877


  RMVX Ace가 체험판만 나온 상태에서 이미 스크립트를 만든 분이 나왔습니다(VX Ace 항목이 없는 상태라서 임시로 VX쪽에 올림).  제목 그대로 대미지 수치를 띄우는 스크립트입니다(VX나 VX Ace의 텍스트창을 통한 표시가 아닌 XP식의 대미지 표시).



#==============================================================================
# ** Damage Popup
#------------------------------------------------------------------------------
#   © Dargor, 2011
#  01/12/11
#  Version 1.0
#------------------------------------------------------------------------------
#  VERSION HISTORY:
#   - 1.0 (01/12/11), Initial release
#------------------------------------------------------------------------------
#  INSTRUCTIONS:
#   - Paste this above main
#   - Edit the constants in Damage_Popup module
#==============================================================================
 
#==============================================================================
# ** Damage Popup Customization Module
#==============================================================================
 
module Damage_Popup
  HP_Damage_Color = Color.new(255,255,255)
  MP_Damage_Color = Color.new(172,0,234)
  TP_Damage_Color = Color.new(253,157,62)
  HP_Recover_Color = Color.new(0,255,0)
  MP_Recover_Color = Color.new(48,192,255)
  TP_Recover_Color = Color.new(255,242,0)
end  
 
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  This sprite is used to display battlers. It observes a instance of the
# Game_Battler class and automatically changes sprite conditions.
#==============================================================================
 
class Sprite_Battler < Sprite_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias dargor_ace_dmgpopup_sprite_battler_initialize initialize
  alias dargor_ace_dmgpopup_sprite_battler_setup_new_effect setup_new_effect
  alias dargor_ace_dmgpopup_sprite_battler_start_effect start_effect
  alias dargor_ace_dmgpopup_sprite_battler_update_effect update_effect
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(viewport, battler = nil)
    # The Usual
    dargor_ace_dmgpopup_sprite_battler_initialize(viewport, battler)
    # Create damage sprite
    @damage_sprite = Sprite_Base.new(viewport)
    @damage_sprite.bitmap = Bitmap.new(160,48)
    @damage_sprite.bitmap.font.bold = true
    @damage_sprite.bitmap.font.outline = true
    @damage_sprite.bitmap.font.size = 32
    @damage_sprite.visible = false
    @damage_duration = 0
    @damage_effect = nil
  end
  #--------------------------------------------------------------------------
  # * Setup New Effect
  #--------------------------------------------------------------------------
  def setup_new_effect
    # The Usual
    dargor_ace_dmgpopup_sprite_battler_setup_new_effect
     # Check for HP Damage
    if display_damage_sprite?        && @battler.result.hp_damage > 0
      start_damage(:hp_damage)
     # Check for MP Damage
    elsif display_damage_sprite? && @battler.result.mp_damage > 0
      start_damage(:mp_damage)
    # Check for TP Damage
    elsif display_damage_sprite? && @battler.result.tp_damage > 0
      start_damage(:tp_damage)
     # Check for HP Recover
    elsif display_damage_sprite? && @battler.result.hp_damage < 0
      start_damage(:hp_recover)
     # Check for MP Recover
    elsif display_damage_sprite? && @battler.result.mp_damage < 0
      start_damage(:mp_recover)
    # Check for TP Recover
    elsif display_damage_sprite? && @battler.result.tp_damage < 0
      start_damage(:tp_recover)
    end
  end
  #--------------------------------------------------------------------------
  # * Damage Display Test
  #--------------------------------------------------------------------------
  def display_damage_sprite?
    return (@battler.result.success && @damage_duration == 0)
  end
  #--------------------------------------------------------------------------
  # * Start Damage Effect
  #--------------------------------------------------------------------------
  def start_damage(effect_type)
    @damage_effect = effect_type
    @damage_duration = 60
    case @damage_effect
    when :hp_damage
      @damage_sprite.bitmap.font.color = Damage_Popup::HP_Damage_Color
    when :mp_damage
      @damage_sprite.bitmap.font.color = Damage_Popup::MP_Damage_Color
    when :tp_damage
      @damage_sprite.bitmap.font.color = Damage_Popup::TP_Damage_Color
    when :hp_recover
      @damage_sprite.bitmap.font.color = Damage_Popup::HP_Recover_Color
    when :mp_recover
      @damage_sprite.bitmap.font.color = Damage_Popup::MP_Recover_Color
    when :tp_recover
      @damage_sprite.bitmap.font.color = Damage_Popup::TP_Recover_Color
    end
    update_damage_popup_position
    update_damage_popup_text
    @damage_sprite.visible = true
    @damage_sprite.opacity = 255
  end
  #--------------------------------------------------------------------------
  # * Update Effects
  #--------------------------------------------------------------------------
  def update_effect
    # Update effects
    if @damage_duration > 0
      @damage_duration -= 1
      update_damage
      if @damage_duration == 0
        @damage_sprite.visible = false
        @damage_type = nil
        @battler.result.clear_hit_flags
      end  
    end
    # The Usual
    dargor_ace_dmgpopup_sprite_battler_update_effect
  end
  #--------------------------------------------------------------------------
  # * Update Damage Sprite Potision
  #--------------------------------------------------------------------------
  def update_damage_popup_position
    if @battler && @battler.use_sprite?
      @damage_sprite.x = @battler.screen_x
      @damage_sprite.y = @battler.screen_y - 48
      @damage_sprite.z = @battler.screen_z + 10
    end
  end
  #--------------------------------------------------------------------------
  # * Update Damage Sprite Text
  #--------------------------------------------------------------------------
  def update_damage_popup_text
    case @damage_effect
    when :hp_damage, :hp_recover
      string = @battler.result.hp_damage.abs.to_s
    when :mp_damage, :mp_recover
      string = @battler.result.mp_damage.abs.to_s
    when :tp_damage, :tp_recover
      string = @battler.result.tp_damage.abs.to_s
    end
    rect = @damage_sprite.bitmap.text_size(string)
    @damage_sprite.bitmap.clear
    @damage_sprite.bitmap.draw_text(rect, string, 1)
  end
  #--------------------------------------------------------------------------
  # * Update Damage
  #--------------------------------------------------------------------------
  def update_damage
    case @damage_duration
    when 58..59
      @damage_sprite.y -= 4
    when 56..57
      @damage_sprite.y -= 2
    when 54..55
      @damage_sprite.y += 2
    when 48..53
      @damage_sprite.y += 4
    end
    if @damage_duration <= 20
      @damage_sprite.opacity = @damage_duration * 11
    end
  end
end 




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
3 전투 콤보 카운팅 시스템 4 아르피쥐 2011.12.18 4625
2 기타 Yanfly Engine Ace Alkaid 2011.12.10 4414
» 전투 [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