Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Taiine on July 13, 2011, 06:30:01 pm

Title: Change auto tile Animation speed per map
Post by: Taiine on July 13, 2011, 06:30:01 pm
I know you can go into Spriteset_Map and change line 119 @tilemap.update to X.times {@tilemap.update} where X is the new speed to change how fast auto tiles play. But this is a global effect changing every map.

I'd like a script that you can set a speed for the auto tiles per map, and if no setting is made have it go to a default set speed.

I tried doing this before but couldn't figure out away to define the map id's and the auto tile speed. It either errored or had no effect at all on the maps.

So can someone else who knows more about scrips then I do take up this (hopefully) simple request?
Title: Re: Change auto tile Animation speed per map
Post by: ForeverZer0 on July 13, 2011, 06:34:17 pm
Its in Tons.
The defining it for each map feature isn't there, but you can easily do that with a script call in an event.
Title: Re: Change auto tile Animation speed per map
Post by: Taiine on July 13, 2011, 11:04:19 pm
Could you by chance give me what the call is? Looking though TONS trying to find that one script xD Such fun. :3
Title: Re: Change auto tile Animation speed per map
Post by: ForeverZer0 on July 13, 2011, 11:07:48 pm
I'll make you an edit real quick, give me a few minutes.

EDIT:
This should work. Sorry if its a bit sloppy. Just ask if you need any instructions, its pretty self-explanatory,

Spoiler: ShowHide
class Game_Map
 
  def self.map_speeds(map_id)
    case map_id
    # when MAP_ID then SPEED
    when 1, 2, 3
      return 2
    when 4
      return 8
    when 5
      return 16
    end
    return 1
  end
 
  attr_accessor :autotile_speed
 
  alias zer0_autotile_speed setup
  def setup(map_id)
    @autotile_speed = Game_Map.map_speeds(map_id)
    zer0_autotile_speed(map_id)
  end
end

class Tilemap
 
  alias zer0_tilemap_upd update
  def update
    zer0_tilemap_upd if Graphics.frame_count % $game_map.autotile_speed == 0
    zer0_tilemap_upd
  end
end
Title: Re: Change auto tile Animation speed per map
Post by: Taiine on July 14, 2011, 01:28:15 pm
Thanks for the sniplet. Though the rate of the speed change is very little. There's hardly a noticeable difference and at first I thought it wasn't doing anything trying speed 1, 3, 6, etc until I went to like 100, 200, 500, then noticed a slight slowing down but not much.

Where as the way I mentioned before how I was doing it, speed 1 and speed 5 would be vastly different in speed.

Is there away to increase the rate of the speed between the values?
Title: Re: Change auto tile Animation speed per map
Post by: nathmatt on July 14, 2011, 06:44:07 pm
try this then
class Game_Map
 
  def self.map_speeds(map_id)
    case map_id
    # when MAP_ID then SPEED
    when 1, 2, 3
      return 2
    when 4
      return 8
    when 5
      return 16
    end
    return 1
  end
 
  attr_accessor :autotile_speed
 
  alias zer0_autotile_speed setup
  def setup(map_id)
    @autotile_speed = Game_Map.map_speeds(map_id)
    zer0_autotile_speed(map_id)
  end
end

class Tilemap
 
  alias zer0_tilemap_upd update
  def update
    @autotile_speed.times{zer0_tilemap_upd}
  end
end
Title: Re: Change auto tile Animation speed per map
Post by: ForeverZer0 on July 14, 2011, 07:15:50 pm
Yeah, that should do it.
Title: Re: Change auto tile Animation speed per map
Post by: Taiine on July 14, 2011, 11:03:08 pm
Should. But it throws an error.

(http://images.devs-on.net/Image/xntUypwDQlLYvyq-Region.png)
Title: Re: Change auto tile Animation speed per map
Post by: ForeverZer0 on July 14, 2011, 11:50:14 pm
It should be $game_map.autotile_speed in the update method for Tilemap, not just @autotile_speed. :P
Title: Re: Change auto tile Animation speed per map
Post by: Taiine on July 15, 2011, 01:25:05 pm
rofl yes that works perfectly. Now I can alter the speed rather I use my 12 frame river auto tile (nice smoooth motion) or the normal 4 frame tiles.

Thanks muchly both of you <3