애니메이션이 동시에 두개가 나가는 스크립트입니다
하나는 스킬에 지정한 애니메이션 하나는 스크립트에 지정한 애니메이션입니다
시간이 없어서 번역은 못함 ㅠ ㅈㅅ
주의사항은 너무 복잡한 애니메이션 두개를 동시에 하시면 렉이 걸릴수도있다는것;;
#---------------여기서부터
#==============================================================================
# 걾 ?긳깑귺긦긽?긘깈깛 by Claimh
#------------------------------------------------------------------------------
# 갋긚긌깑럊뾭렄궻뫮뤭뫀귺긦긽?긘깈깛귩볫뢣돸갃
# 갋딈?밒궸룉뿚궕뢣궘궶귡됀?맜궇귟갃
#-< 띋믦? >-------------------------------------------------------------------
# RPG::Sprite
# initialize, dispose, update, effect?, x=(), y=()
#==============================================================================
module Double_Animation
DOUBLE_ANIME = []
#==============================================================================
# 걽 긇긚??귽긛START
#==============================================================================
# 스킬별 더블 애니메이션의 세팅 하심되요ㅎㅎㅎㅎㅎㅎ
# DOUBLE_ANIME [스킬ID] = 애니메이션ID
DOUBLE_ANIME[1] = 0 #스킬에 지정하신 애니메이션하고 여기지정한 애니하고
DOUBLE_ANIME[5] = 0 #같이 뜹니다 ㅎㅎ
#==============================================================================
# 걽 긇긚??귽긛END
#==============================================================================
module_function
#--------------------------------------------------------------------------
# 걶 ?긳깑귺긦긽?긘깈깛궻롦벦
#--------------------------------------------------------------------------
def get_double_anime(skill_id)
unless DOUBLE_ANIME[skill_id].nil?
return DOUBLE_ANIME[skill_id]
else
return 0
end
end
end
#==============================================================================
# 걾 Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# 걶 긲깒??뛛륷 (긽귽깛긲긃?긛 긚긡긞긵 1 : 귺긏긘깈깛?뷈)
#--------------------------------------------------------------------------
alias update_phase4_step1_double_anime update_phase4_step1
def update_phase4_step1
# ?긳깑귺긦긽?긘깈깛궻룊딖돸
@double_animation_id = 0
update_phase4_step1_double_anime
end
#--------------------------------------------------------------------------
# 걶 긚긌깑귺긏긘깈깛 뙅됈띿맟
#--------------------------------------------------------------------------
alias make_skill_action_result_double_anime make_skill_action_result
def make_skill_action_result
make_skill_action_result_double_anime
if @phase4_step != 1
# ?긳깑귺긦긽?긘깈깛궻롦벦궴SET
@double_animation_id = Double_Animation.get_double_anime(@skill.id)
end
end
#--------------------------------------------------------------------------
# 걶 긲깒??뛛륷 (긽귽깛긲긃?긛 긚긡긞긵 4 : 뫮뤭뫀귺긦긽?긘깈깛)
#--------------------------------------------------------------------------
alias update_phase4_step4_double_anime update_phase4_step4
def update_phase4_step4
update_phase4_step4_double_anime
# 뫮뤭뫀귺긦긽?긘깈깛 [?긳깑]
for target in @target_battlers
target.double_animation_id = @double_animation_id
end
end
end
#==============================================================================
# 걾 Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# 걶 뚺둎귽깛긚?깛긚빾릶
#--------------------------------------------------------------------------
attr_accessor :double_animation_id # ?긳깑귺긦긽?긘깈깛 ID
#--------------------------------------------------------------------------
# 걶 긆긳긙긃긏긣룊딖돸
#--------------------------------------------------------------------------
alias init_double_anime initialize
def initialize
init_double_anime
@double_animation_id = 0
end
end
#==============================================================================
# 걾 Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# 걶 긲깒??뛛륷
#--------------------------------------------------------------------------
alias update_double_anime update
def update
# 긫긣깋?궕 nil 궻뤾뜃
if @battler == nil
return
end
# 됀럨궻뤾뜃
if @battler_visible
# ?긳깑귺긦긽?긘깈깛
if @battler.double_animation_id != 0
animation = $data_animations[@battler.double_animation_id]
animation2(animation, @battler.animation_hit)
@battler.double_animation_id = 0
end
end
update_double_anime
end
end
#==============================================================================
# 걾 RPG::Sprite
#==============================================================================
module RPG
class Sprite < ::Sprite
@@_animations2 = []
@@_reference_count2 = {}
# 귽긦긘긿깑룉뿚 [띋믦?]
def initialize(viewport = nil)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_animation_duration2 = 0
@_blink = false
end
# 긚긵깋귽긣뤑땸 [띋믦?]
def dispose
dispose_damage
dispose_animation
dispose_animation2
dispose_loop_animation
super
end
# 귺긦긽?긘깈깛띿맟 [?긳깑]
def animation2(animation, hit)
dispose_animation2
@_animation2 = animation
return if @_animation2 == nil
@_animation_hit2 = hit
@_animation_duration2 = @_animation2.frame_max
animation_name = @_animation2.animation_name
animation_hue = @_animation2.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count2.include?(bitmap)
@@_reference_count2[bitmap] += 1
else
@@_reference_count2[bitmap] = 1
end
@_animation_sprites2 = []
if @_animation2.position != 3 or not @@_animations2.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites2.push(sprite)
end
unless @@_animations2.include?(animation)
@@_animations2.push(animation)
end
end
update_animation2
end
# 귺긦긽?긘깈깛뤑땸 [?긳깑]
def dispose_animation2
if @_animation_sprites2 != nil
sprite = @_animation_sprites2[0]
if sprite != nil
@@_reference_count2[sprite.bitmap] -= 1
if @@_reference_count2[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites2
sprite.dispose
end
@_animation_sprites2 = nil
@_animation2 = nil
end
end
# 긄긲긃긏긣뭷갎 [띋믦?]
def effect?
@_whiten_duration > 0 or
@_appear_duration > 0 or
@_escape_duration > 0 or
@_collapse_duration > 0 or
@_damage_duration > 0 or
@_animation_duration > 0 or
@_animation_duration2 > 0
end
# 긚긵깋귽긣?긲깒??뛛륷 [띋믦?]
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
if @_damage_duration > 0
@_damage_duration -= 1
case @_damage_duration
when 38..39
@_damage_sprite.y -= 4
when 36..37
@_damage_sprite.y -= 2
when 34..35
@_damage_sprite.y += 2
when 28..33
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
if @_damage_duration == 0
dispose_damage
end
end
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_animation2 != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration2 -= 1
update_animation2
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
@@_animations2.clear
end
# 귺긦긽?긘깈깛뛛륷 [?긳깑]
def update_animation2
if @_animation_duration2 > 0
frame_index = @_animation2.frame_max - @_animation_duration2
cell_data = @_animation2.frames[frame_index].cell_data
position = @_animation2.position
animation_set_sprites(@_animation_sprites2, cell_data, position)
for timing in @_animation2.timings
if timing.frame == frame_index
animation_process_timing(timing, @_animation_hit2)
end
end
else
dispose_animation2
end
end
# 긚긵깋귽긣x댧뭫뛛륷 [띋믦?]
def x=(x)
sx = x - self.x
if sx != 0
if @_animation_sprites != nil
for i in 0..15
@_animation_sprites[i].x += sx
end
end
if @_animation_sprites2 != nil
for i in 0..15
@_animation_sprites2[i].x += sx
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites[i].x += sx
end
end
end
super
end
# 긚긵깋귽긣y댧뭫뛛륷 [띋믦?]
def y=(y)
sy = y - self.y
if sy != 0
if @_animation_sprites != nil
for i in 0..15
@_animation_sprites[i].y += sy
end
end
if @_animation_sprites2 != nil
for i in 0..15
@_animation_sprites2[i].y += sy
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites[i].y += sy
end
end
end
super
end
end
end
#-----------------끝!!
사용법
우선 찔르신후 16~19줄에 가보시면 제가 주석으로 설명을 대충 적었지만 모를수도 있으니
대충 설명더 해드립니다.
16~19줄가시면
DOUBLE_ANIME[1] = 0 이런거 잇을건데요
여기서 DOUBLE_ANIME[스킬id(번호임)] = 애니메이션아이디(번호)
이렇게 지정하시면 됩니다.
스크립트에 지정한 애니메이션과 스킬에 지정한것이 동시에 나갑니다
출처는 Code Crush 입니다
하나는 스킬에 지정한 애니메이션 하나는 스크립트에 지정한 애니메이션입니다
시간이 없어서 번역은 못함 ㅠ ㅈㅅ
주의사항은 너무 복잡한 애니메이션 두개를 동시에 하시면 렉이 걸릴수도있다는것;;
#---------------여기서부터
#==============================================================================
# 걾 ?긳깑귺긦긽?긘깈깛 by Claimh
#------------------------------------------------------------------------------
# 갋긚긌깑럊뾭렄궻뫮뤭뫀귺긦긽?긘깈깛귩볫뢣돸갃
# 갋딈?밒궸룉뿚궕뢣궘궶귡됀?맜궇귟갃
#-< 띋믦? >-------------------------------------------------------------------
# RPG::Sprite
# initialize, dispose, update, effect?, x=(), y=()
#==============================================================================
module Double_Animation
DOUBLE_ANIME = []
#==============================================================================
# 걽 긇긚??귽긛START
#==============================================================================
# 스킬별 더블 애니메이션의 세팅 하심되요ㅎㅎㅎㅎㅎㅎ
# DOUBLE_ANIME [스킬ID] = 애니메이션ID
DOUBLE_ANIME[1] = 0 #스킬에 지정하신 애니메이션하고 여기지정한 애니하고
DOUBLE_ANIME[5] = 0 #같이 뜹니다 ㅎㅎ
#==============================================================================
# 걽 긇긚??귽긛END
#==============================================================================
module_function
#--------------------------------------------------------------------------
# 걶 ?긳깑귺긦긽?긘깈깛궻롦벦
#--------------------------------------------------------------------------
def get_double_anime(skill_id)
unless DOUBLE_ANIME[skill_id].nil?
return DOUBLE_ANIME[skill_id]
else
return 0
end
end
end
#==============================================================================
# 걾 Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# 걶 긲깒??뛛륷 (긽귽깛긲긃?긛 긚긡긞긵 1 : 귺긏긘깈깛?뷈)
#--------------------------------------------------------------------------
alias update_phase4_step1_double_anime update_phase4_step1
def update_phase4_step1
# ?긳깑귺긦긽?긘깈깛궻룊딖돸
@double_animation_id = 0
update_phase4_step1_double_anime
end
#--------------------------------------------------------------------------
# 걶 긚긌깑귺긏긘깈깛 뙅됈띿맟
#--------------------------------------------------------------------------
alias make_skill_action_result_double_anime make_skill_action_result
def make_skill_action_result
make_skill_action_result_double_anime
if @phase4_step != 1
# ?긳깑귺긦긽?긘깈깛궻롦벦궴SET
@double_animation_id = Double_Animation.get_double_anime(@skill.id)
end
end
#--------------------------------------------------------------------------
# 걶 긲깒??뛛륷 (긽귽깛긲긃?긛 긚긡긞긵 4 : 뫮뤭뫀귺긦긽?긘깈깛)
#--------------------------------------------------------------------------
alias update_phase4_step4_double_anime update_phase4_step4
def update_phase4_step4
update_phase4_step4_double_anime
# 뫮뤭뫀귺긦긽?긘깈깛 [?긳깑]
for target in @target_battlers
target.double_animation_id = @double_animation_id
end
end
end
#==============================================================================
# 걾 Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# 걶 뚺둎귽깛긚?깛긚빾릶
#--------------------------------------------------------------------------
attr_accessor :double_animation_id # ?긳깑귺긦긽?긘깈깛 ID
#--------------------------------------------------------------------------
# 걶 긆긳긙긃긏긣룊딖돸
#--------------------------------------------------------------------------
alias init_double_anime initialize
def initialize
init_double_anime
@double_animation_id = 0
end
end
#==============================================================================
# 걾 Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# 걶 긲깒??뛛륷
#--------------------------------------------------------------------------
alias update_double_anime update
def update
# 긫긣깋?궕 nil 궻뤾뜃
if @battler == nil
return
end
# 됀럨궻뤾뜃
if @battler_visible
# ?긳깑귺긦긽?긘깈깛
if @battler.double_animation_id != 0
animation = $data_animations[@battler.double_animation_id]
animation2(animation, @battler.animation_hit)
@battler.double_animation_id = 0
end
end
update_double_anime
end
end
#==============================================================================
# 걾 RPG::Sprite
#==============================================================================
module RPG
class Sprite < ::Sprite
@@_animations2 = []
@@_reference_count2 = {}
# 귽긦긘긿깑룉뿚 [띋믦?]
def initialize(viewport = nil)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_animation_duration2 = 0
@_blink = false
end
# 긚긵깋귽긣뤑땸 [띋믦?]
def dispose
dispose_damage
dispose_animation
dispose_animation2
dispose_loop_animation
super
end
# 귺긦긽?긘깈깛띿맟 [?긳깑]
def animation2(animation, hit)
dispose_animation2
@_animation2 = animation
return if @_animation2 == nil
@_animation_hit2 = hit
@_animation_duration2 = @_animation2.frame_max
animation_name = @_animation2.animation_name
animation_hue = @_animation2.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count2.include?(bitmap)
@@_reference_count2[bitmap] += 1
else
@@_reference_count2[bitmap] = 1
end
@_animation_sprites2 = []
if @_animation2.position != 3 or not @@_animations2.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites2.push(sprite)
end
unless @@_animations2.include?(animation)
@@_animations2.push(animation)
end
end
update_animation2
end
# 귺긦긽?긘깈깛뤑땸 [?긳깑]
def dispose_animation2
if @_animation_sprites2 != nil
sprite = @_animation_sprites2[0]
if sprite != nil
@@_reference_count2[sprite.bitmap] -= 1
if @@_reference_count2[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites2
sprite.dispose
end
@_animation_sprites2 = nil
@_animation2 = nil
end
end
# 긄긲긃긏긣뭷갎 [띋믦?]
def effect?
@_whiten_duration > 0 or
@_appear_duration > 0 or
@_escape_duration > 0 or
@_collapse_duration > 0 or
@_damage_duration > 0 or
@_animation_duration > 0 or
@_animation_duration2 > 0
end
# 긚긵깋귽긣?긲깒??뛛륷 [띋믦?]
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
if @_damage_duration > 0
@_damage_duration -= 1
case @_damage_duration
when 38..39
@_damage_sprite.y -= 4
when 36..37
@_damage_sprite.y -= 2
when 34..35
@_damage_sprite.y += 2
when 28..33
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
if @_damage_duration == 0
dispose_damage
end
end
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_animation2 != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration2 -= 1
update_animation2
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
@@_animations2.clear
end
# 귺긦긽?긘깈깛뛛륷 [?긳깑]
def update_animation2
if @_animation_duration2 > 0
frame_index = @_animation2.frame_max - @_animation_duration2
cell_data = @_animation2.frames[frame_index].cell_data
position = @_animation2.position
animation_set_sprites(@_animation_sprites2, cell_data, position)
for timing in @_animation2.timings
if timing.frame == frame_index
animation_process_timing(timing, @_animation_hit2)
end
end
else
dispose_animation2
end
end
# 긚긵깋귽긣x댧뭫뛛륷 [띋믦?]
def x=(x)
sx = x - self.x
if sx != 0
if @_animation_sprites != nil
for i in 0..15
@_animation_sprites[i].x += sx
end
end
if @_animation_sprites2 != nil
for i in 0..15
@_animation_sprites2[i].x += sx
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites[i].x += sx
end
end
end
super
end
# 긚긵깋귽긣y댧뭫뛛륷 [띋믦?]
def y=(y)
sy = y - self.y
if sy != 0
if @_animation_sprites != nil
for i in 0..15
@_animation_sprites[i].y += sy
end
end
if @_animation_sprites2 != nil
for i in 0..15
@_animation_sprites2[i].y += sy
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites[i].y += sy
end
end
end
super
end
end
end
#-----------------끝!!
사용법
우선 찔르신후 16~19줄에 가보시면 제가 주석으로 설명을 대충 적었지만 모를수도 있으니
대충 설명더 해드립니다.
16~19줄가시면
DOUBLE_ANIME[1] = 0 이런거 잇을건데요
여기서 DOUBLE_ANIME[스킬id(번호임)] = 애니메이션아이디(번호)
이렇게 지정하시면 됩니다.
스크립트에 지정한 애니메이션과 스킬에 지정한것이 동시에 나갑니다
출처는 Code Crush 입니다