[Ace] Event Animation Loop scripts

So I am not sure how to start this off or if I am in even in right place to ask but I've had this problem for a while now and havent found a solution which has put my project kinda on halt as this feature is pretty essential

Anyway, here is what I am trying to do;
Event starts an animation, loops it till player presses a button and moves to next animation.
Now this part is easy and I have no trouble with it, however the issue is this;

The animation doesnt loop properly, it seems to flicker at start or end (not sure which) of each loop, like, the whole animation vanishes for frame or two or so which looks dreadfully ugly.
So I decided to download some scripts for it.

Now I've tried various scripts for this, I first tried shaz's and this animeskull or something guys script which I cannot find again, they worked for the calling and ending the loop, but they still flickered thus I really could not get proper use out of em.



I then tried victor scripts with the loop animation, which seems to work in terms of not flickering
But I cannot seem to be able to stop the animation in anyway, there doesnt seem to be anyway to do it, or I am misunderstanding how to stop it, cause it is bit confusing.

Please note I wish to use the battle animation in world basiclly, due of the frame specific sounds and the like

So uhhh, what I kinda need help with is either someway to get shaz script not flicker or way to call a stop on victors animation loop or some other solution/script?
Being able to somehow stop victor animation loop script would be probably most preferable as I am using that engine on some other features already, tho shaz's script doesnt really conflict either.
uhh I am sorry if I am to bump or something but I really have been stuck with this still all this time and I've been digging up more and more on this, tested even more stuff, still with no real results and my desperation has been dug rather deep. The flicker just doesnt go away, or the animation just wont stop.
Any sort of explanation would be appreciated how I can get this to work, cause I really cannot continue on with my project if I cant get this feature working.
(Loop animation till button has been pressed x times, then loop another animation till button pressed x times etc)

I did find one more script from this here forum that apparently could work? But it seems to be broken into one long single line that makes very little sense
As posted in the spoiler here;




If anyone would have a non broken version of that script to pastebin or so, that'd be really nice and hopefully it could work for my issue, hopefully.
I've been trying to sort it together myself but cause I dont know ruby, its been resulting kind of... awkward so far.

I also read that there's apparently some sort of directional movement method way to simulate something like this?
Unfortunately I haven't really seen proper examples of it in this context to really get it, and I am pretty sure it lacks the sound effect possibility of call animation which really is a big minus.

I'm just kinda sad im sitting on all these assets ive drawn and sprited for this project only to be halted by this annoyance.
Here is the script with the correct line breaks (but horribly formatted by the code option).  However, I don't think this is going to make any difference for you - it's an antilag script, and lag is not what you're experiencing.  This has no reference to animations looping.

Spoiler
Code:
if true 
	# Script By Dekita // 
	# http://dekitarpg.wordpress.com
	# All Rights Reserved..
	# 
	# $game_system.anti_lag = Boolean
	# ^- Event anti Lag
	#
	# $game_system.anti_lag_ani = Boolean
	# ^- Animation anti Lag

	module Anti_Lag
		Event_Update_Range = 3
		Event_Anti_Lag_On  = true
		Anima_Anti_lag_On  = true
	end

	#===============================================================================
	module SceneManager
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		class << self
			alias :call_antilag  :call
			alias :goto_antilag  :goto
        end
		#-----------------------------------------------------------------------------
		# Call Scene
		#-----------------------------------------------------------------------------
		def self.call(scene_class)
			call_antilag(scene_class)
			dispose_ani_crap
		end
		#-----------------------------------------------------------------------------
		# Goto Scene
		#-----------------------------------------------------------------------------
		def self.goto(scene_class)
			goto_antilag(scene_class)
			dispose_ani_crap
		end
		#-----------------------------------------------------------------------------
		# Dispose Ani Crap
		#-----------------------------------------------------------------------------
		def self.dispose_ani_crap
			return if $game_temp.ani_crap == nil
			$game_temp.ani_crap.each do |ani|
				ani.dispose
			end
			$game_temp.ani_crap = nil
		end
	end

	#===============================================================================
	class Game_Temp
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :init_abs_antilag :initialize
		#-----------------------------------------------------------------------------
		# Pi Variables
		#-----------------------------------------------------------------------------
		attr_accessor :ani_crap
		#-----------------------------------------------------------------------------
		# Initialize
		#-----------------------------------------------------------------------------
		def initialize
			@ani_crap = []
			init_abs_antilag
		end
	end

	#===============================================================================
	class Game_System
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Pi Variables
		#-----------------------------------------------------------------------------
		attr_accessor :anti_lag
		attr_accessor :anti_lag_ani
		#-----------------------------------------------------------------------------
		# Initialize
		#-----------------------------------------------------------------------------
		alias :initantilag :initialize
		def initialize
			@anti_lag     = Anti_Lag::Event_Anti_Lag_On
			@anti_lag_ani = Anti_Lag::Anima_Anti_lag_On
			initantilag
		end
	end

	#===============================================================================
	class Game_Map
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :setup_de_antilag :setup
		#-----------------------------------------------------------------------------
		# Setup
		#-----------------------------------------------------------------------------
		def setup(map_id)
			SceneManager.dispose_ani_crap
			setup_de_antilag(map_id)
		end
	end

	#===============================================================================
	class Game_Event < Game_Character
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Pi Variables
		#-----------------------------------------------------------------------------
		attr_reader :can_update
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :anti_lag_init_GE :initialize
		alias :updt_anti_lag    :update
		#-----------------------------------------------------------------------------
		# Initialize
		#-----------------------------------------------------------------------------
		def initialize(map_id, event)
			@can_anti_lag = $game_system.anti_lag
			@can_update = true
			if $game_map.loop_horizontal? or $game_map.loop_vertical?
				@can_anti_lag = false
			end
			anti_lag_init_GE(map_id, event)
		end
		#-----------------------------------------------------------------------------
		# Update
		#-----------------------------------------------------------------------------
		def update
			update_anti_lag
			return unless @can_update
			updt_anti_lag
		end
		#-----------------------------------------------------------------------------
		# Update Anti Lag
		#-----------------------------------------------------------------------------
		def update_anti_lag
			if @can_anti_lag != $game_system.anti_lag
				@can_anti_lag = $game_system.anti_lag
				if $game_map.loop_horizontal? or $game_map.loop_vertical?
					@can_anti_lag = false
				end
			end
			event_is_on_screen?
		end
		#-----------------------------------------------------------------------------
		# Event Is On Screen ?
		#-----------------------------------------------------------------------------
		def event_is_on_screen?
			return unless @can_anti_lag
			w = Graphics.width / 32
			h = Graphics.height / 32
			@can_update = false
			os = Anti_Lag::Event_Update_Range
			px = ($game_map.display_x).truncate
			py = ($game_map.display_y).truncate
			dx = @x - px
			dy = @y - py
			if dx.between?(0-os,w+os) && dy.between?(0-os,h+os)
				@can_update = true
			end
		end 
	end

	#===============================================================================
	class Sprite_Base < Sprite
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :dispose_antilagani :dispose_animation
		#-----------------------------------------------------------------------------
		# Dispose Animation
		#-----------------------------------------------------------------------------
		def dispose_animation
			if $game_system.anti_lag_ani
				make_ani_into_crap
				return
			end
			dispose_antilagani
		end
		#-----------------------------------------------------------------------------
		# Make Animation Garbage
		#-----------------------------------------------------------------------------
		def make_ani_into_crap
			$game_temp.ani_crap = [] if $game_temp.ani_crap == nil
			if @ani_bitmap1
				@@_reference_count[@ani_bitmap1] -= 1
				if @@_reference_count[@ani_bitmap1] == 0
					$game_temp.ani_crap << @ani_bitmap1
				end
			end
			if @ani_bitmap2
				@@_reference_count[@ani_bitmap2] -= 1
				if @@_reference_count[@ani_bitmap2] == 0
					$game_temp.ani_crap << @ani_bitmap2
				end
			end
			if @ani_sprites
				@ani_sprites.each {|sprite| sprite.dispose }
				@ani_sprites = nil
				@animation = nil
			end
			@ani_bitmap1 = nil
			@ani_bitmap2 = nil
		end
	end

	#===============================================================================
	class Sprite_Character < Sprite_Base
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :anti_lag_update :update
		#-----------------------------------------------------------------------------
		# Update
		#-----------------------------------------------------------------------------
		def update
			if $game_system.anti_lag and @character.is_a?(Game_Event)
				check_can_update_sprite
				return unless self.visible
			end
			anti_lag_update
		end
		#-----------------------------------------------------------------------------
		# Update
		#-----------------------------------------------------------------------------
		def check_can_update_sprite
			if self.visible and [email protected]_update
				reset_sprite_animation
			end
			self.visible = @character.can_update
		end
		#-----------------------------------------------------------------------------
		# Reset Sprite Animation
		#-----------------------------------------------------------------------------

		def reset_sprite_animation
			dispose_animation
		end
	 end
	 
	#===============================================================================
	class Scene_Base
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :term_antilag :terminate
		#-----------------------------------------------------------------------------
		# Terminate
		#-----------------------------------------------------------------------------
		def terminate
			term_antilag
			SceneManager.dispose_ani_crap
		end
	 end
	 
end # if true
@TheoAllen has character animation loop script also. Maybe you want to have a try, right here.
Here is the script with the correct line breaks (but horribly formatted by the code option).  However, I don't think this is going to make any difference for you - it's an antilag script, and lag is not what you're experiencing.  This has no reference to animations looping.

Spoiler
Code:
if true 
	# Script By Dekita // 
	# http://dekitarpg.wordpress.com
	# All Rights Reserved..
	# 
	# $game_system.anti_lag = Boolean
	# ^- Event anti Lag
	#
	# $game_system.anti_lag_ani = Boolean
	# ^- Animation anti Lag

	module Anti_Lag
		Event_Update_Range = 3
		Event_Anti_Lag_On  = true
		Anima_Anti_lag_On  = true
	end

	#===============================================================================
	module SceneManager
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		class << self
			alias :call_antilag  :call
			alias :goto_antilag  :goto
        end
		#-----------------------------------------------------------------------------
		# Call Scene
		#-----------------------------------------------------------------------------
		def self.call(scene_class)
			call_antilag(scene_class)
			dispose_ani_crap
		end
		#-----------------------------------------------------------------------------
		# Goto Scene
		#-----------------------------------------------------------------------------
		def self.goto(scene_class)
			goto_antilag(scene_class)
			dispose_ani_crap
		end
		#-----------------------------------------------------------------------------
		# Dispose Ani Crap
		#-----------------------------------------------------------------------------
		def self.dispose_ani_crap
			return if $game_temp.ani_crap == nil
			$game_temp.ani_crap.each do |ani|
				ani.dispose
			end
			$game_temp.ani_crap = nil
		end
	end

	#===============================================================================
	class Game_Temp
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :init_abs_antilag :initialize
		#-----------------------------------------------------------------------------
		# Pi Variables
		#-----------------------------------------------------------------------------
		attr_accessor :ani_crap
		#-----------------------------------------------------------------------------
		# Initialize
		#-----------------------------------------------------------------------------
		def initialize
			@ani_crap = []
			init_abs_antilag
		end
	end

	#===============================================================================
	class Game_System
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Pi Variables
		#-----------------------------------------------------------------------------
		attr_accessor :anti_lag
		attr_accessor :anti_lag_ani
		#-----------------------------------------------------------------------------
		# Initialize
		#-----------------------------------------------------------------------------
		alias :initantilag :initialize
		def initialize
			@anti_lag     = Anti_Lag::Event_Anti_Lag_On
			@anti_lag_ani = Anti_Lag::Anima_Anti_lag_On
			initantilag
		end
	end

	#===============================================================================
	class Game_Map
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :setup_de_antilag :setup
		#-----------------------------------------------------------------------------
		# Setup
		#-----------------------------------------------------------------------------
		def setup(map_id)
			SceneManager.dispose_ani_crap
			setup_de_antilag(map_id)
		end
	end

	#===============================================================================
	class Game_Event < Game_Character
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Pi Variables
		#-----------------------------------------------------------------------------
		attr_reader :can_update
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :anti_lag_init_GE :initialize
		alias :updt_anti_lag    :update
		#-----------------------------------------------------------------------------
		# Initialize
		#-----------------------------------------------------------------------------
		def initialize(map_id, event)
			@can_anti_lag = $game_system.anti_lag
			@can_update = true
			if $game_map.loop_horizontal? or $game_map.loop_vertical?
				@can_anti_lag = false
			end
			anti_lag_init_GE(map_id, event)
		end
		#-----------------------------------------------------------------------------
		# Update
		#-----------------------------------------------------------------------------
		def update
			update_anti_lag
			return unless @can_update
			updt_anti_lag
		end
		#-----------------------------------------------------------------------------
		# Update Anti Lag
		#-----------------------------------------------------------------------------
		def update_anti_lag
			if @can_anti_lag != $game_system.anti_lag
				@can_anti_lag = $game_system.anti_lag
				if $game_map.loop_horizontal? or $game_map.loop_vertical?
					@can_anti_lag = false
				end
			end
			event_is_on_screen?
		end
		#-----------------------------------------------------------------------------
		# Event Is On Screen ?
		#-----------------------------------------------------------------------------
		def event_is_on_screen?
			return unless @can_anti_lag
			w = Graphics.width / 32
			h = Graphics.height / 32
			@can_update = false
			os = Anti_Lag::Event_Update_Range
			px = ($game_map.display_x).truncate
			py = ($game_map.display_y).truncate
			dx = @x - px
			dy = @y - py
			if dx.between?(0-os,w+os) && dy.between?(0-os,h+os)
				@can_update = true
			end
		end 
	end

	#===============================================================================
	class Sprite_Base < Sprite
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :dispose_antilagani :dispose_animation
		#-----------------------------------------------------------------------------
		# Dispose Animation
		#-----------------------------------------------------------------------------
		def dispose_animation
			if $game_system.anti_lag_ani
				make_ani_into_crap
				return
			end
			dispose_antilagani
		end
		#-----------------------------------------------------------------------------
		# Make Animation Garbage
		#-----------------------------------------------------------------------------
		def make_ani_into_crap
			$game_temp.ani_crap = [] if $game_temp.ani_crap == nil
			if @ani_bitmap1
				@@_reference_count[@ani_bitmap1] -= 1
				if @@_reference_count[@ani_bitmap1] == 0
					$game_temp.ani_crap << @ani_bitmap1
				end
			end
			if @ani_bitmap2
				@@_reference_count[@ani_bitmap2] -= 1
				if @@_reference_count[@ani_bitmap2] == 0
					$game_temp.ani_crap << @ani_bitmap2
				end
			end
			if @ani_sprites
				@ani_sprites.each {|sprite| sprite.dispose }
				@ani_sprites = nil
				@animation = nil
			end
			@ani_bitmap1 = nil
			@ani_bitmap2 = nil
		end
	end

	#===============================================================================
	class Sprite_Character < Sprite_Base
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :anti_lag_update :update
		#-----------------------------------------------------------------------------
		# Update
		#-----------------------------------------------------------------------------
		def update
			if $game_system.anti_lag and @character.is_a?(Game_Event)
				check_can_update_sprite
				return unless self.visible
			end
			anti_lag_update
		end
		#-----------------------------------------------------------------------------
		# Update
		#-----------------------------------------------------------------------------
		def check_can_update_sprite
			if self.visible and [email protected]_update
				reset_sprite_animation
			end
			self.visible = @character.can_update
		end
		#-----------------------------------------------------------------------------
		# Reset Sprite Animation
		#-----------------------------------------------------------------------------

		def reset_sprite_animation
			dispose_animation
		end
	 end
	 
	#===============================================================================
	class Scene_Base
	#===============================================================================
		#-----------------------------------------------------------------------------
		# Alias List
		#-----------------------------------------------------------------------------
		alias :term_antilag :terminate
		#-----------------------------------------------------------------------------
		# Terminate
		#-----------------------------------------------------------------------------
		def terminate
			term_antilag
			SceneManager.dispose_ani_crap
		end
	 end
	 
end # if true


Well thats a bummer, thanks anyway tho! Maybe someone else might get use out of that script tho, its a real shame lot of scripts in the forum tend to have gone broke
 

@TheoAllen has character animation loop script also. Maybe you want to have a try, right here.


Oh neat, this looks like it could potentially work
Unfortunantly I get an error;
 


Script 'Theo Loop' line 132: NoMethodError occurred.


undefined method `position' for {}:Hash

so I cannot tell if it can or not.

I tried to mess around more with shaz's script tho with the movement route method, unfortunantly, no dice there either, still flickering.

I still cant make head or tails how to actually limit the amount of loops with the victor's script or stop em as I've been testing that too, it should be used in comment box but there isn't really clear exsample how the "have effect only when used together with x, otherwise have no effect" ones work or are suppoused to be imported cause in same comment or in different seriously dont make a difference it seems. Not to mention its bit unclear if I can use variables with that.

(I've made sure to comment out the scripts not used while testing with em to make sure they dont clash)

However, I ran across this post as I kept on digging and digging;




Which makes me wonder, does this anomaly effect shaz's loop script? which I feel might do it (tho bit odd how victors isnt effected?), if so is there some sort of simple math for this or so which would allow to pinpoint the frame count to keep things smooth or if this is even related at all? Currently the animation loops I have are not really the most longest frame wise, but I could add extra frames/loops of the animation if I can be able to pinpoint the exact amount, but I dont wanna start making them wonky.

I really want to get the bottom of this so I can finally progress, so I am sorry if my question is getting bit wider or messier than it should.
Hey, this can be now locked, I finally found a solution through ton of digging up

If anyone has the similar issue and wants to solve it, this is what I did;

With victor loop animation script,
Use states


Make it so that you add the <map loop animation: x> to a new state which should effect the player within map.


Change the state for the player actor in the event. Then remove the state to stop the animation.
with loops and conditional branches for your button input and stuff, remember that the wait time between state changes should be animation frame count * 4 if you want to keep the transitions smooth.

Now I can finally move on with this project.

Original thread: https://forums.rpgmakerweb.com/threads/ace-event-animation-loop-scripts.67005/