Advertisement
Rafael_Sol_Maker

RAFAEL_SOL_MAKER's VX SMALL TWEAKS v1.1 (9 in 1)

Nov 17th, 2011
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.65 KB | None | 0 0
  1. #===============================================================================
  2. #               RAFAEL_SOL_MAKER's VX SMALL TWEAKS v1.1 (9 in 1)
  3. #-------------------------------------------------------------------------------
  4. # Description:  Collection of small adjustments to improve the usability of VX
  5. #               and fix some bugs or inconveniences.
  6. #               Among the 9 adjustments, this version of the script includes:
  7. #               - Set the message of escape from battle
  8. #               - Adjust the making of enemies' names
  9. #               - Recover HP and MP when you level up
  10. #               - The encounter rate will be halved if you are in a vehicle
  11. #               - Airship now triggers events with priority 'Above the Hero'
  12. #               - Corrected position of battlers (resolution add-on, optional)
  13. #               - Sound effect in the expressions
  14. #               - Modify the starting party's money with ease
  15. #               - Change easily the flight altitude of the Airship
  16. #-------------------------------------------------------------------------------
  17. # How to Use: -
  18. #-------------------------------------------------------------------------------
  19. # Special Thanks: João B, Yellow Magic, Maliki79, ScreWe.
  20. #                 (http://www.rpgrevolution.com/)
  21. #-------------------------------------------------------------------------------
  22. #===============================================================================
  23.  
  24. module PowerPackVX_General_Configs  
  25.   # BASIC ENGINE ADJUSTS
  26.   Recover_When_Level_Up = true  # Recover HP and MP when level up?
  27.   Starting_Money = 150          # Starting Money
  28.   Airship_Altitude = 48         # Airship altitude
  29. end
  30.  
  31. module Vocab  
  32.   # EDITED TERMS
  33.   EscapeStart   = "The %s's party tries to escape..."  
  34.   EscapeFailure = "Your party couldn't escape!"  
  35.   # NEW TERMS
  36.   EscapeEnd     = "Your party escaped with success."
  37. end
  38.  
  39. module Sound
  40.   # SOUND EFFECT FOR EXPRESSIONS
  41.   def self.play_baloon
  42.     Audio.se_play('Audio/SE/Jump1', 100, 100)
  43.   end  
  44. end
  45.  
  46. #===============================================================================
  47. # Adjust on the escape battle message
  48. #===============================================================================
  49.   def process_escape
  50.     @info_viewport.visible = false
  51.     @message_window.visible = true
  52.     text = sprintf(Vocab::EscapeStart, $game_party.name)
  53.     $game_message.texts.push(text)
  54.     wait_text = '\.\.'
  55.     if $game_troop.preemptive
  56.       success = true
  57.     else
  58.       success = (rand(100) < @escape_ratio)
  59.     end    
  60.     if success
  61.       Sound.play_escape
  62.       $game_message.texts.push(wait_text + Vocab::EscapeEnd)
  63.       wait_for_message
  64.       battle_end(1)
  65.     else
  66.       @escape_ratio += 10
  67.       $game_message.texts.push(wait_text + Vocab::EscapeFailure)
  68.       wait_for_message
  69.       $game_party.clear_actions
  70.       start_main
  71.     end
  72.   end
  73.  
  74. end
  75.  
  76. #===============================================================================
  77. # Adjust on the making of unique enemies names
  78. #===============================================================================
  79. class Game_Troop < Game_Unit
  80.  
  81.   alias sol_maker_make_unique_names make_unique_names unless $@
  82.   def make_unique_names
  83.     sol_maker_make_unique_names
  84.     for enemy in members
  85.       enemy.letter = ' ' + enemy.letter
  86.     end
  87.   end
  88.  
  89. end
  90.  
  91. #===============================================================================
  92. # Recover HP and MP when level up
  93. #===============================================================================
  94. class Game_Actor < Game_Battler  
  95.   include PowerPackVX_General_Configs
  96.  
  97.   alias sol_maker_level_up level_up unless $@
  98.   def level_up
  99.     sol_maker_level_up
  100.     if Recover_When_Level_Up
  101.       self.hp += maxhp; self.mp += maxmp
  102.     end
  103.   end
  104.  
  105. end
  106.  
  107. #===============================================================================
  108. # If you are in a vehicle, the encounter rate will be halved
  109. #===============================================================================
  110. class Game_Player < Game_Character
  111.  
  112.   def update_encounter
  113.     return if in_airship?
  114.     return if $TEST and Input.press?(Input::CTRL)  
  115.     if $game_map.bush?(@x, @y)
  116.       if in_vehicle?
  117.         @encounter_count = @encounter_count.to_f - 1
  118.       else
  119.         @encounter_count -= 2
  120.       end
  121.     else
  122.       if in_vehicle?
  123.         @encounter_count = @encounter_count.to_f - 0.5
  124.       else
  125.         @encounter_count -= 1
  126.       end
  127.     end    
  128.   end
  129.  
  130. #===============================================================================
  131. # Events with priority 'Above the Hero' can be triggered in Airship
  132. #===============================================================================  
  133.   def check_touch_event
  134.     return check_event_trigger_here([1,2])
  135.   end
  136.   def check_action_event
  137.     return true if check_event_trigger_here([0])
  138.     return check_event_trigger_there([0,1,2])
  139.   end
  140.  
  141.   alias sol_maker_check_event_trigger_here check_event_trigger_here unless $@
  142.   def check_event_trigger_here(triggers)    
  143.     return false if $game_map.interpreter.running? # Repeated command...
  144.    
  145.     for event in $game_map.events_xy(@x, @y)
  146.       return false if in_airship? and event.priority_type != 2  
  147.     end
  148.     sol_maker_check_event_trigger_here(triggers)    
  149.   end
  150.  
  151.   alias sol_maker_check_event_trigger_there check_event_trigger_there unless $@
  152.   def check_event_trigger_there(triggers)
  153.     return false if $game_map.interpreter.running? # Repeated command...
  154.    
  155.     front_x = $game_map.x_with_direction(@x, @direction)
  156.     front_y = $game_map.y_with_direction(@y, @direction)
  157.     for event in $game_map.events_xy(front_x, front_y)
  158.       return false if in_airship? and event.priority_type != 2
  159.     end
  160.     sol_maker_check_event_trigger_there(triggers)
  161.   end
  162.  
  163. end
  164.  
  165. #===============================================================================
  166. #  Battlers(monsters) now have corrected positions on all resolutions
  167. #===============================================================================
  168. class Sprite_Battler < Sprite_Base
  169.  
  170.   def update
  171.     super
  172.     if @battler == nil
  173.       self.bitmap = nil
  174.     else
  175.       @use_sprite = @battler.use_sprite?
  176.       if @use_sprite
  177.         ax =  @battler.screen_x.to_f * (Graphics.width.to_f / 544)
  178.         ay =  @battler.screen_y.to_f * (Graphics.height.to_f / 416)
  179.         self.x = ax.to_i        
  180.         self.y = ay.to_i
  181.         self.z = @battler.screen_z
  182.         update_battler_bitmap
  183.       end
  184.       setup_new_effect
  185.       update_effect
  186.     end
  187.   end
  188.  
  189. end
  190.  
  191. #===============================================================================
  192. # Sound Effect for Expressions
  193. #===============================================================================
  194. class Sprite_Character < Sprite_Base
  195.  
  196.   alias sol_maker_start_balloon start_balloon unless $@
  197.   def start_balloon
  198.     Sound.play_baloon
  199.     sol_maker_start_balloon
  200.   end
  201.  
  202. end
  203.  
  204. #===============================================================================
  205. # Change the money at the beginning of the game
  206. #===============================================================================
  207. class Game_Party < Game_Unit  
  208.   include PowerPackVX_General_Configs
  209.  
  210.   alias sol_maker_initialize initialize unless $@
  211.   def initialize
  212.     sol_maker_initialize
  213.     @gold = Starting_Money
  214.   end
  215.  
  216. end
  217.  
  218. #===============================================================================
  219. # Change the Airship altitude
  220. #===============================================================================  
  221. class Game_Vehicle < Game_Character
  222.   MAX_ALTITUDE = PowerPackVX_General_Configs::Airship_Altitude
  223. end
  224.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement