Advertisement
LiTTleDRAgo

[RGSS/2/3] Character Speed Changer

Apr 22nd, 2012
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.48 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  2. # Character Speed Changer
  3. # Version: 1.10
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  6. #
  7. # Explanation :
  8. #   This script can change all the character speed by value of variable
  9. #
  10. # To decrease the speed, use negative value
  11. # To increase the speed, use positive value
  12. #
  13. # Value will reset to 0 once speed has changed
  14. #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  15. class Scene_Map
  16.   #--------------------------------------------------------------------------
  17.   # * Constant Variables
  18.   #--------------------------------------------------------------------------
  19.   SPEED_CHANGE_VARIABLE = 1
  20.   SPEED_PLAYER_INCLUDED = true
  21.   #--------------------------------------------------------------------------
  22.   # * Alias Listing
  23.   #--------------------------------------------------------------------------
  24.   alias_method :drg128_upd, :update
  25.   #--------------------------------------------------------------------------
  26.   # * Frame Update
  27.   #--------------------------------------------------------------------------
  28.   def update
  29.     drg128_upd
  30.     change_speed_update
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # * Change Speed Update
  34.   #--------------------------------------------------------------------------
  35.   def change_speed_update
  36.     change = $game_variables[SPEED_CHANGE_VARIABLE]
  37.     return unless change != 0
  38.     $game_map.events.keys.sort.each {|i|
  39.         move_speed = $game_map.events[i].move_speed
  40.         $game_map.events[i].move_speed = [move_speed +change,0].max
  41.         if SPEED_PLAYER_INCLUDED
  42.           $game_player.move_speed = [$game_player.move_speed +change,0].max
  43.         end }
  44.     $game_variables[SPEED_CHANGE_VARIABLE] = 0
  45.   end
  46. end
  47.  
  48. #==============================================================================
  49. # ** Game_Character
  50. #------------------------------------------------------------------------------
  51. #  This class deals with characters. It's used as a superclass for the
  52. #  Game_Player and Game_Event classes.
  53. #==============================================================================
  54. class Game_Character
  55.   #--------------------------------------------------------------------------
  56.   # * Public Instance Variables
  57.   #--------------------------------------------------------------------------
  58.   attr_accessor :move_speed
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement