Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: karldaylo on May 09, 2011, 09:37:09 am

Title: [RESOLVED]Slower than 1 Scrolling speed value
Post by: karldaylo on May 09, 2011, 09:37:09 am
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 :)
Title: Re: Slower than 1 Scrolling speed value
Post by: mcgluszak on May 09, 2011, 11:35:25 am
Show me that script.
Title: Re: Slower than 1 Scrolling speed value
Post by: ForeverZer0 on May 09, 2011, 01:25:02 pm
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.
Title: Re: Slower than 1 Scrolling speed value
Post by: mcgluszak on May 09, 2011, 02:59:57 pm
Use the script call:

$game_map.start_scroll(direction,distance,speed)


Directions:
2  - Down
4  - Left
6  - Right
8  - Up
Title: Re: Slower than 1 Scrolling speed value
Post by: ForeverZer0 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:






Title: Re: Slower than 1 Scrolling speed value
Post by: karldaylo on May 10, 2011, 12:45:45 am
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:
Title: Re: [RESOLVED]Slower than 1 Scrolling speed value
Post by: ForeverZer0 on May 10, 2011, 12:58:59 am
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.