[RESOLVED]Slower than 1 Scrolling speed value

Started by karldaylo, May 09, 2011, 09:37:09 am

Previous topic - Next topic

karldaylo

May 09, 2011, 09:37:09 am Last Edit: May 10, 2011, 12:47:07 am by karldaylo
well erm, let say i want to scroll a graphic on a scene.. i have the scripts and the things to do it(yes,... those things :naughty:)

the speed "1" is a bit faster for what i want for my graphics to scroll
i tried 0.5 but it wont work(it freezes)
i tried @speed = OH_YEAH / 2 (lol i run out of "variable name" ideas) still it runs same as "1"
i only know few basics of ruby scripting... not really what you call a "ruby scripter",but apprentice........... maybe :P

:facepalm: ughh what am i saying....... anyways... help will be trully appriciated

thanks :)
RESPECT LIST:Blizzard, Game_guy, Foreverzer0, Winkio, Nathmatt

mcgluszak


ForeverZer0

Its the default RTP script he's referring to.

I can help you, but I'm at work at the moment, so just hold on a few hours.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

mcgluszak

Use the script call:

$game_map.start_scroll(direction,distance,speed)


Directions:
2  - Down
4  - Left
6  - Right
8  - Up

ForeverZer0

May 09, 2011, 04:22:58 pm #4 Last Edit: May 09, 2011, 05:48:23 pm by Pedomon
He knows this. His problem is the lowest value he can use for "speed" is 1, and that is still too fast.


EDIT:

Here's the script.
Spoiler: ShowHide
class Game_Map
   
  alias zer0_slower_scroll_init initialize
  def initialize
    @scroll_modifier = 1
    zer0_slower_scroll_init
  end
 
  def start_scroll(direction, distance, speed, modifier = 1)
    @scroll_direction = direction
    @scroll_rest = distance * 128
    @scroll_speed = speed
    @scroll_modifier = modifier > 0 ? modifier : 1
  end
 
  def scroll_down(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_y = [@display_y + distance, (self.height - 15) * 128].min
    end
  end

  def scroll_left(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_x = [@display_x - distance, 0].max
    end
  end

  def scroll_right(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_x = [@display_x + distance, (self.width - 20) * 128].min
    end
  end

  def scroll_up(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_y = [@display_y - distance, 0].max
    end
  end
end


Use this script call:
$game_map.start_scroll(DIRECTION, DISTANCE, SPEED, MODIFIER)


Replace the above values as follows:

  • DIRECTION = The direction the screen moves (2=Down, 4=Left, 6=Right, 8=Up)

  • DISTANCE = The number of tiles to scroll

  • SPEED = The speed. Keep this number of 1 as you normally would.

  • MODIFIER = A number that will slow it down. Must be 1 or above, or you can omit it and things will behave normally. It limits the number of times the map scrolling will be updated.

    ex. A value of two will update the scroll every other frame, a value of 3 will update the scroll only every third frame. Any values to high will make it appear to move kinda jerky, but I found that values of 2 and 3 have a pretty good effect.







I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

karldaylo

Quote from: Pedomon on May 09, 2011, 04:22:58 pm
He knows this. His problem is the lowest value he can use for "speed" is 1, and that is still too fast.


EDIT:

Here's the script.
Spoiler: ShowHide
class Game_Map
   
  alias zer0_slower_scroll_init initialize
  def initialize
    @scroll_modifier = 1
    zer0_slower_scroll_init
  end
 
  def start_scroll(direction, distance, speed, modifier = 1)
    @scroll_direction = direction
    @scroll_rest = distance * 128
    @scroll_speed = speed
    @scroll_modifier = modifier > 0 ? modifier : 1
  end
 
  def scroll_down(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_y = [@display_y + distance, (self.height - 15) * 128].min
    end
  end

  def scroll_left(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_x = [@display_x - distance, 0].max
    end
  end

  def scroll_right(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_x = [@display_x + distance, (self.width - 20) * 128].min
    end
  end

  def scroll_up(distance)
    if (Graphics.frame_count % @scroll_modifier) == 0
      @display_y = [@display_y - distance, 0].max
    end
  end
end


Use this script call:
$game_map.start_scroll(DIRECTION, DISTANCE, SPEED, MODIFIER)


Replace the above values as follows:

  • DIRECTION = The direction the screen moves (2=Down, 4=Left, 6=Right, 8=Up)

  • DISTANCE = The number of tiles to scroll

  • SPEED = The speed. Keep this number of 1 as you normally would.

  • MODIFIER = A number that will slow it down. Must be 1 or above, or you can omit it and things will behave normally. It limits the number of times the map scrolling will be updated.

    ex. A value of two will update the scroll every other frame, a value of 3 will update the scroll only every third frame. Any values to high will make it appear to move kinda jerky, but I found that values of 2 and 3 have a pretty good effect.




:oops: i thought its simple that itll take only 3 to 5 line scripts
:^_^': sorry for botherin you to solve this  :sorry:

and this is exactly what im lookin for..... thanks :bow:


:stupid: :knight:
RESPECT LIST:Blizzard, Game_guy, Foreverzer0, Winkio, Nathmatt

ForeverZer0

It wasn't hard.
I just had to add the same branch to four existing methods, since RMXP splits them up, modify one method to accept a fourth argument, and another to create an instance variable. It only took about 3 minutes. No big deal.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.