Hi!
I have a little Problem ...
Thing is, i need the possibility to show 2 or more Animations at the same Time on an event and/or Player instead of only just one. I found on this forum an old Topic about it and there was posted a Script by Trickster.
It's from Sephiroth ... from that what i understand its excactly that, what i need. Showing more animations at the same time on player/Events.
So ... i tried it and here is the Problem ... it doesnt work! I dont know .. maybe i'm doing smth. wrong. I'm calling the animations just as normal (Show Animation - > Player). But still i get only one Animation shown (the last one) when i try 2 Show Animation Codes.
I have the SDK (2.4) installed (part 1 what is just needed for this one) ... and i already tested it with the full SDK.
But it just doesn't work ... hope someone can help me.
greetz
I have a little Problem ...
Thing is, i need the possibility to show 2 or more Animations at the same Time on an event and/or Player instead of only just one. I found on this forum an old Topic about it and there was posted a Script by Trickster.
Code:
#==============================================================================
# ** Multiple Animations
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1
# 2007-03-06
# SDK : Version 2.0, Part 1
#------------------------------------------------------------------------------
# * Version History :
#
# Version 1 ---------------------------------------------------- (2007-03-06)
#------------------------------------------------------------------------------
# * Description :
#
# This script was designed to show multiple animation sprites at the same
# time. When an animation sprite is created, it is immediately added to an
# array of animation sprites. From there, each animation sprite is handeled
# the same way the default animation sprite is handeled. This also delays
# animations to prevent multiple damages being displayed at once.
#------------------------------------------------------------------------------
# * Instructions :
#
# Place The Script Below the SDK and Above Main.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Multiple Animations', 'SephirothSpawn', 1, '2007-03-06')
SDK.check_requirements(2, [1])
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Multiple Animations')
#==============================================================================
# ** RPG::Sprite
#==============================================================================
class RPG::Sprite < ::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @seph_multianim_stack.nil?
alias_method :seph_multianim_rpgs_init, :initialize
alias_method :seph_multianim_rpgs_disp, :dispose
alias_method :seph_multianim_rpgs_updt, :update
@seph_multianim_stack = true
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(viewport = nil)
# Original Initialization
seph_multianim_rpgs_init(viewport)
# Create Animation Sprite Array
@_multi_animation_sprites = []
@_multi_animation_duration = []
@_multi_animation_data = []
# Damage Delay Count
@_animations_delay_count = 0
@_animations_pops_coming = []
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Original Dispose
seph_multianim_rpgs_disp
# Pass Through Multi-Animations Sprites
@_multi_animation_duration.size.times { dispose_multi_animations }
end
#--------------------------------------------------------------------------
# * Dispose Multi Animations
#--------------------------------------------------------------------------
def dispose_multi_animations(index = 0)
# Get Sprites
sprites = @_multi_animation_sprites[index]
# If Non-nil sprites
unless sprites.nil?
# Get First Sprite
sprite = sprites[0]
unless sprite.nil?
@@_reference_count[sprite.bitmap] -= 1
sprite.bitmap.dispose if @@_reference_count[sprite.bitmap] == 0
end
for sprite in sprites
sprite.dispose
end
@_multi_animation_sprites[index] = nil
@_multi_animation_duration[index] = 0
@_multi_animation_data[index] = []
end
end
#--------------------------------------------------------------------------
# * Animation
#--------------------------------------------------------------------------
def animation(animation, hit)
# Adds Animation to Pop List
unless animation.nil? && hit.nil?
@_animations_pops_coming << [animation, hit]
end
# Return If Animation Delay
return if @_animations_delay_count > 0
# Start Animation Count
@_animations_delay_count = 8
# Gets Pops Coming
animation, hit = *@_animations_pops_coming.shift
# Return if Nil Animation
return if animation.nil?
# Sets Animation & Hit Data
@_multi_animation_data << [animation, hit]
# Set Animation Duration
@_multi_animation_duration << animation.frame_max
# Create Sprites
animation_name = animation.animation_name
animation_hue = animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
@@_reference_count[bitmap] = 0 unless @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
sprites = []
if animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap, sprite.visible = bitmap, false
sprites.push(sprite)
end
end
# Add Animation Sprites
@_multi_animation_sprites << sprites
# Update Multi Animation
update_multi_animation(@_multi_animation_data.size - 1)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Animation Delaying
if @_animations_delay_count > 0
@_animations_delay_count -= 1
# If Animation Not Delaying
else
# If Animation Waiting to Be Popped
if @_animations_pops_coming.size > 0
# Create Animation Sprite
animation(nil, nil)
end
end
# Original Update
seph_multianim_rpgs_updt
# If Animation Sprites Exist & Frame Reset
if @_multi_animation_duration.size > 0 && Graphics.frame_count % 2 == 0
# Update Multi-animations
update_multi_animations
end
end
#--------------------------------------------------------------------------
# * Frame Update : Multi-Animations
#--------------------------------------------------------------------------
def update_multi_animations
# Pass Through All Animation Data
for i in 0...@_multi_animation_duration.size
# Decrease Animation Duration
@_multi_animation_duration[i] -= 1 rescue p @_multi_animation_duration, i
# Update Multi Animation
update_multi_animation(i)
end
# Deletes Nil Elements
for index in 0...@_multi_animation_duration.size
if @_multi_animation_sprites[index].nil? &&
@_multi_animation_duration[index] == 0 &&
@_multi_animation_data[index] == []
@_multi_animation_sprites.delete_at(index)
@_multi_animation_duration.delete_at(index)
@_multi_animation_data.delete_at(index)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update : Multi-Animation
#--------------------------------------------------------------------------
def update_multi_animation(i = 0)
# If Duraction Greater Than 0
if @_multi_animation_duration[i] > 0
# Get Animation Data
anim, hit = *@_multi_animation_data[i]
# Get Sprites, Cell Data & Position
sprites = @_multi_animation_sprites[i]
frame_index = anim.frame_max - @_multi_animation_duration[i]
cell_data = anim.frames[frame_index].cell_data
position = anim.position
# Processes Animation Sprites
animation_set_sprites(sprites, cell_data, position)
# Pass Through Timings
for timing in anim.timings
# If Frame Index
if timing.frame == frame_index
# Processing Animation Timing
animation_process_timing(timing, hit)
end
end
# If 0 Duration
else
dispose_multi_animations(i)
end
end
end
#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end
It's from Sephiroth ... from that what i understand its excactly that, what i need. Showing more animations at the same time on player/Events.
So ... i tried it and here is the Problem ... it doesnt work! I dont know .. maybe i'm doing smth. wrong. I'm calling the animations just as normal (Show Animation - > Player). But still i get only one Animation shown (the last one) when i try 2 Show Animation Codes.
I have the SDK (2.4) installed (part 1 what is just needed for this one) ... and i already tested it with the full SDK.
But it just doesn't work ... hope someone can help me.
greetz