RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Autotile Animation Speed Control

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Autotile Animation Speed Control
Version: 1.0
Author: modern algebra
Date: September 27, 2008

Version History


  • <Version 1.0> 09.27.2008 - Original Release

Description


Tired of your waterfall animating so slowly? This script allows you to set the speed that your A1 autotiles animate at.

Features

  • Autotiles can go faster or slower as you please
  • Precise control over autotile speed in frames
  • Can change the speed in-game

Screenshots

N/A

Instructions

See inside Header

Script


Code: [Select]
#==============================================================================
#  Autotile Animation Speed Control
#  Version: 1.0
#  Author: modern algebra (rmrk.net)
#  Date: September 27, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Just paste this script between Materials and Main. To adjust default value
#   autotile frame count, go to line 40 and change the 30 there to the number
#   of frames you want it to wait between animating. Keep in mind that
#   there are 60 frames per second generally. You can also change the number
#   of frames waited in-game with the code:
#
#      $game_system.autotile_anim_frames = integer
#
#    If you use that code, however, you will need to go through a transfer
#   event before it will be applied, as calculations are only done when the map
#   is initialized. You can also transfer to the same map.
#==============================================================================
# ** Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased method - initialize
#    new public writer variable - autotile_anim_speed
#==============================================================================

class Game_System
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :autotile_anim_frames # Controls speed of autotiles
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_autotile_frm_upd_init_84n initialize
  def initialize
    # Run Original Method
    modalg_autotile_frm_upd_init_84n
    # Initialize Autotile variable
    @autotile_anim_frames = 30
  end
end
  
#==============================================================================
# ** Tilemap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#    aliased methods - initialize, update
#==============================================================================
class Tilemap
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_autotile_anim_frme_cntrl_init_93n5 initialize
  def initialize (viewport = nil)
    ma_autotile_anim_frme_cntrl_init_93n5 (viewport)
    # Calculate frame speed of update
    @frame_plus = 30.0 / $game_system.autotile_anim_frames.to_f
    # Initialize counting variables
    @anim_frames = 0.0
    @last_frame = 0
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Frame Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_upd_frame_anim_autotiles_89r4b update
  def update
    # If counting variable has increased another 'frame'
    while @anim_frames >= @last_frame
      # Run Original method
      modalg_upd_frame_anim_autotiles_89r4b
      # Advance count variable
      @last_frame += 1
      if @last_frame == 30
        @anim_frames = 0.0
        @last_frame = 0
      end
    end
    # Advance false count variable
    @anim_frames += @frame_plus
  end
end

Credit


  • modern algebra


Support


Post here at rmrk.net for swiftest response

Known Compatibility Issues

No known compatibility issues at this point

Demo


Not really necessary. But, if requested, I will make one.

Author's Notes


The script aliases the update method of a hidden class, and I am not sure exactly how that method operates. I am acting under the assumption, however, that that method's only function is to update the autotiles. If this assumption is wrong, then the script could potentially cause some strange problems. If you notice anything on your tilemaps acting strangely, then please inform me of the problem and I will look into it.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:52:33 PM by Modern Algebra »

**
Rep:
Level 84
Nice script i think i will use this one. Of course with credit to you lol.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Am I able to set a speed from the A1 waterfalls and the A1 water tiles? I would imagine having the water tide in and out so quickly would be in accurate, but having the waterfall tiles fall quickly would be logical. Lol. Just wondering if I'd be able to set them at different speeds or if it just controls all of the A1 tiles. Thanks :)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I'm sorry, no :(

TileMap is a hidden class, so I don't really know what goes on in there. All I do now is make it space out how often it is updated, and all A1 tile are controlled in that update method. It's not a good way to write this script, but I don't know how to do it any other way :( sorry.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
No problem :)