Advertisement
roninator2

Ellye Custom Move Speed - Mod

Dec 7th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.21 KB | None | 0 0
  1. #-------------------------------------------------------------------
  2. # Custom Movement Speed
  3. # A simple script made by Ellye.
  4. # This is a free and unencumbered script, provided "as is", no warranties.
  5. # Modified by Roninator2
  6. # Now allows to specify which maps have different speeds.
  7. #-------------------------------------------------------------------
  8. module R2_Map_Speed
  9.     # change the number to include the maps where your speed needs to be changed
  10. MAP_SPEED = { :crawl => [19, 20],
  11.                             :slow  => [1, 3, 4, 5, 6],
  12.                             :normal => [7, 8, 9, 10],
  13.                             :fast  => [2, 11,12,13,14,15,16],
  14.                             :ultra => [17, 18]
  15.             }
  16. SPEED_OFF = 4  # switch used to turn on map speed control above
  17. # turn switch on to use the map id for speed control.
  18. #-------------------------------------------------------------------
  19. # * Options:
  20. #-------------------------------------------------------------------
  21.  
  22. # Base speed for every moving character. Default RPG Maker value is 4.
  23. Base_character_speed = 4
  24.  
  25. # Player movement speed. Default RPG Maker value is 4. Use either 3, 4 or 5.
  26. Player_speed = 4
  27.  
  28. # Player dashing speed bonus. Default RPG Maker value is 1.
  29. # You can also set a negative value, so that you'd have a
  30. # "Walk / Sneaky Button" instead of a "Dash Button".
  31. Dash_speed = 1
  32.  
  33. # Vehicules movement speed. Default RPG Maker values are 5, 6 and 7.
  34. Boat_speed = 4
  35. Ship_speed = 5
  36. Airship_speed = 6
  37.  
  38. # when switch is on this will add to the speed when in a vehicle.
  39. # Optional
  40. Vehicle_bonus = 0
  41. end
  42. #-------------------------------------------------------------------
  43. #-------------------------------------------------------------------
  44. #-------------------------------------------------------------------
  45.  
  46.  
  47. class Game_CharacterBase
  48.   #Add custom movement speed to characters Init
  49.   alias :old_init_public_members :init_public_members
  50.   def init_public_members
  51.     old_init_public_members
  52.     @move_speed = R2_Map_Speed::Base_character_speed
  53.   end
  54.  
  55.   #Add custom dash bonus speed
  56.   alias :old_real_move_speed :real_move_speed
  57.   def real_move_speed
  58.     old_real_move_speed
  59.     return @move_speed + (dash? ? R2_Map_Speed::Dash_speed : 0)
  60.   end
  61.  
  62. end
  63.  
  64. class Game_Player
  65.   #Add custom movement speed to player Init
  66.   alias :old_initialize :initialize
  67.   def initialize
  68.     old_initialize
  69.     @move_speed = R2_Map_Speed::Player_speed
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # * Execute Player Transfer
  73.   #--------------------------------------------------------------------------
  74.   def perform_transfer
  75.     if transfer?
  76.       set_direction(@new_direction)
  77.       if @new_map_id != $game_map.map_id
  78.         $game_map.setup(@new_map_id)
  79.         $game_map.autoplay
  80.       end
  81.       moveto(@new_x, @new_y)
  82.       @move_speed = R2_Map_Speed::Player_speed
  83.       if $game_switches[R2_Map_Speed::SPEED_OFF] == true
  84.         if R2_Map_Speed::MAP_SPEED[:crawl].include?($game_map.map_id)
  85.           @move_speed -= 2
  86.         elsif R2_Map_Speed::MAP_SPEED[:slow].include?($game_map.map_id)
  87.           @move_speed -= 1
  88.         elsif R2_Map_Speed::MAP_SPEED[:normal].include?($game_map.map_id)
  89.           @move_speed = 4
  90.         elsif R2_Map_Speed::MAP_SPEED[:fast].include?($game_map.map_id)
  91.           @move_speed += 1
  92.         elsif R2_Map_Speed::MAP_SPEED[:ultra].include?($game_map.map_id)
  93.           @move_speed += 2
  94.         end
  95.       else
  96.       end
  97.       clear_transfer_info
  98.     end
  99.   end
  100.  
  101.   #The default get_off_vehicle method sets the player speed to 4...
  102.   alias :old_get_off_vehicule :get_off_vehicle
  103.   def get_off_vehicle
  104.       old_get_off_vehicule
  105.       @move_speed = R2_Map_Speed::Player_speed
  106.       if $game_switches[R2_Map_Speed::SPEED_OFF] == true
  107.         if R2_Map_Speed::MAP_SPEED[:crawl].include?($game_map.map_id)
  108.           @move_speed -= 2
  109.         elsif R2_Map_Speed::MAP_SPEED[:slow].include?($game_map.map_id)
  110.           @move_speed -= 1
  111.         elsif R2_Map_Speed::MAP_SPEED[:normal].include?($game_map.map_id)
  112.           @move_speed = 4
  113.         elsif R2_Map_Speed::MAP_SPEED[:fast].include?($game_map.map_id)
  114.           @move_speed += 1
  115.         elsif R2_Map_Speed::MAP_SPEED[:ultra].include?($game_map.map_id)
  116.           @move_speed += 2
  117.         end
  118.       end
  119.   end
  120. end
  121.  
  122. class Game_Vehicle
  123.   #Set custom Vehicle speeds
  124.   alias r2_move_get_on_speed  get_on
  125.   def get_on
  126.     r2_move_get_on_speed
  127.     @move_speed = R2_Map_Speed::Boat_speed if @type == :boat
  128.     @move_speed = R2_Map_Speed::Ship_speed if @type == :ship
  129.     @move_speed = R2_Map_Speed::Airship_speed if @type == :airship
  130.         if $game_switches[R2_Map_Speed::SPEED_OFF] == true
  131.             if R2_Map_Speed::MAP_SPEED[:crawl].include?(@map_id)
  132.                 @move_speed += R2_Map_Speed::Vehicle_bonus
  133.             elsif R2_Map_Speed::MAP_SPEED[:slow].include?(@map_id)
  134.                 @move_speed += R2_Map_Speed::Vehicle_bonus
  135.             elsif R2_Map_Speed::MAP_SPEED[:normal].include?(@map_id)
  136.                 @move_speed += R2_Map_Speed::Vehicle_bonus
  137.             elsif R2_Map_Speed::MAP_SPEED[:fast].include?(@map_id)
  138.                 @move_speed += R2_Map_Speed::Vehicle_bonus
  139.             elsif R2_Map_Speed::MAP_SPEED[:ultra].include?(@map_id)
  140.                 @move_speed += R2_Map_Speed::Vehicle_bonus
  141.             else
  142.                 @move_speed += R2_Map_Speed::Vehicle_bonus
  143.             end
  144.         else
  145.         end
  146.   end
  147. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement