Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX Snippet] Auto-Repeat Animation

Auto-Repeat Animation
Version 1.0
by Woratana
Release Date: 21/05/2008


Introduction
This is a little snippet that will allow you to set repeat animation on character in map.

Repeat animation will show again and again after the last animation in that character finished~

Enjoy~  :lol:


Screenshots
It's not needed, but I have if you want~  :P
http://i32.tinypic.com/2v80ot5.jpg[/img]


Script
Place it above main
http://i28.tinypic.com/25thhqt.jpg[/img]
Code:
#===============================================================
# ? [VX Snippet] ? Auto-Repeat Animation ? ?
# * Show animation again and again on character in map~ *
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Released on: 21/05/2008
# ? Version: 1.0
#--------------------------------------------------------------

#==================================================================
# ** HOW TO USE **
#-----------------------------------------------------------------
# To set repeat animation to character, call script:
#   set_anim(character, animation_id)
#
# * character: What character you want to set repeat animation?
# ** -1 for 'Player', 0 for 'This Event', and 1 or more for Event ID
# * animation_id: ID of the animation you want to set as repeat animation
# ** use 0 to remove repeat animation~

# For example:
#   set_anim(10, 5)
# * Script above will set Animation ID 5 as repeat animation for Event ID 10
#==================================================================

class Game_Interpreter
  def set_anim(character, anim_id)
	get_character(character).repeat_anim = anim_id
  end
end

class Game_Character
  attr_accessor :repeat_anim
  alias wora_autorepani_gamcha_ini initialize
  def initialize
	@repeat_anim = 0
	wora_autorepani_gamcha_ini
  end
end

class Sprite_Character < Sprite_Base
  alias wora_autorepani_sprcha_upd update
  def update
	wora_autorepani_sprcha_upd
	unless @animation_duration > 0
	  @character.animation_id = @character.repeat_anim
	end
  end
end


Instruction
To set repeat animation to character, call script:
Code:
   set_anim(character, animation_id)

* character: What character you want to set repeat animation?
** -1 for 'Player', 0 for 'This Event', and 1 or more for Event ID
* animation_id: ID of the animation you want to set as repeat animation
** use 0 to remove repeat animation~

For example:
Code:
   set_anim(10, 5)
* Script above will set Animation ID 5 as repeat animation for Event ID 10


Author's Notes
Free for use in your work if credit is included.

Please do not redistribute this script without permission. If you want to post it on any forum, please link to this topic.


Bug Report?
Please give me these informations:
- What is it says in error window?
- When is it get error? (Right after run game, when you choose something, etc.)
- Do you have any other scripts running in your game that may crash with this script?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top