[VX] Rupture System

Rupture System
Version: 1.0
By: Dargor


Introduction

I made this script 2 years ago and always wanted to post it. I didn't because it was requested by another member who didn't wanted it to be public at first
but now he doesn't use the script anymore.

What is the Rupture System?
The battlers start with a new gauge that drops each time this battler is attacked.
When an actors loses all his Rupture Points he fells in the Rupture State.
When in Rupture State, all attacks are automatically critical hits and if the battler is the victim of a "Rupture Skill", then the damage taken is multiplied by a customizable value. The battler is unable to act for 2 turns and once these 2 turns are over, he recovers 50% of his Rupture Points and the state is lifted.

Features

  • Both Actors and Enemies have Rupture Points and can fall in Rupture State.
  • Can specify a "Rupture Skill" by flagging it with a customizable Element
  • Customizable Gauge Color
  • Customizable Damage Multiplier
  • Customizable RP Increase formula for actors.

Script

script Spoiler
  1. #==============================================================================
  2. # ** Rupture System
  3. #------------------------------------------------------------------------------
  4. #  © Dargor, 2008
  5. #  16/10/08
  6. #  Version 1.0
  7. #  Requested by Çauzfhie
  8. #------------------------------------------------------------------------------
  9. #  VERSION HISTORY:
  10. #   - 1.0 (16/10/08), Initial release
  11. #------------------------------------------------------------------------------
  12. #  INSTRUCTIONS:
  13. #   - Paste this above main
  14. #   - Edit the constants in the Rupture module
  15. #==============================================================================
  16.  
  17. # Vocabulary
  18. Vocab::RP = 'RP'
  19. Vocab::RP_a = 'R'
  20. Vocab::RPActorDamage     = "%s loses %s #{Vocab::RP}!"
  21. Vocab::RPEnemyDamage     = "%s loses %s #{Vocab::RP}!"
  22.  
  23. #==============================================================================
  24. # ** Rupture Configuration Module
  25. #==============================================================================
  26.  
  27. module Rupture
  28.   # Actors MAXRP Formula
  29.   RP_Max_Formula = "(self.maxhp + self.maxmp) / 2"
  30.   # Enemies RP
  31.   Enemy_RP = {
  32.                 1 => 1000
  33.              }
  34.   # Default Enemy RP          
  35.   Enemy_RP.default = 100  
  36.   # Element needed for the multiplier to take effect
  37.   Element = 17
  38.   # State inflicted when RP drops to 0
  39.   State = 18
  40.   # Damage multiplier when in Rupture state
  41.   Multiplier = 7.0
  42.   # Rupture bar colors
  43.   Gauge_Color1 = 10
  44.   Gauge_Color2 = 2
  45. end
  46.  
  47. #==============================================================================
  48. # ** Game_Battler
  49. #------------------------------------------------------------------------------
  50. #  This class deals with battlers. It's used as a superclass of the Game_Actor
  51. # and Game_Enemy classes.
  52. #==============================================================================
  53.  
  54. class Game_Battler
  55.   #--------------------------------------------------------------------------
  56.   # * Public Instance Variables
  57.   #--------------------------------------------------------------------------
  58.   attr_reader :rp_damage
  59.   #--------------------------------------------------------------------------
  60.   # * Alias Listing
  61.   #--------------------------------------------------------------------------
  62.   alias dargor_vx_rupture_battler_initialize initialize
  63.   alias dargor_vx_rupture_battler_remove_state remove_state
  64.   alias dargor_vx_rupture_battler_execute_damage execute_damage
  65.   #--------------------------------------------------------------------------
  66.   # * Object Initialization
  67.   #--------------------------------------------------------------------------
  68.   def initialize
  69.     # The Usual
  70.     dargor_vx_rupture_battler_initialize
  71.     @rp = 0
  72.     @rp_damage = 0
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # * RP
  76.   #--------------------------------------------------------------------------
  77.   def rp
  78.     return @rp
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # * Set RP
  82.   #--------------------------------------------------------------------------
  83.   def rp=(new_rp)
  84.     @rp = [[new_rp, maxrp].min, 0].max
  85.     if @rp == 0 and not state?(Rupture::State)
  86.       add_state(Rupture::State)    # Add incapacitated (state #1)
  87.       @added_states.push(Rupture::State)
  88.     elsif @rp > 0 and state?(Rupture::State)
  89.       remove_state(Rupture::State) # Remove incapacitated (state #1)
  90.       @removed_states.push(Rupture::State)
  91.     end
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # * MAXRP
  95.   #--------------------------------------------------------------------------
  96.   def maxrp
  97.     return 0
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # * Remove State
  101.   #--------------------------------------------------------------------------
  102.   def remove_state(state_id)
  103.     if state_id == Rupture::State
  104.       @rp = self.maxrp / 2
  105.     end
  106.     # The Usual
  107.     dargor_vx_rupture_battler_remove_state(state_id)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # * Damage Reflection
  111.   #     user : User of skill or item
  112.   #    @hp_damage, @mp_damage, or @absorbed must be calculated before this
  113.   #    method is called.
  114.   #--------------------------------------------------------------------------
  115.   def execute_damage(user)
  116.     if !@critical && state?(Rupture::State) && !prevent_critical
  117.       @critical = true
  118.       @hp_damage *= 3
  119.     end
  120.     # The Usual
  121.     dargor_vx_rupture_battler_execute_damage(user)
  122.     # Calculate RP damage
  123.     if user.element_set.include?(Rupture::Element)
  124.       @rp_damage = @hp_damage * Rupture::Multiplier
  125.     else
  126.       @rp_damage = ((@hp_damage.to_f / 100.0) * Rupture::Multiplier).ceil
  127.     end
  128.     self.rp -= @rp_damage
  129.   end
  130. end
  131.  
  132. #==============================================================================
  133. # ** Game_Actor
  134. #------------------------------------------------------------------------------
  135. #  This class handles actors. It's used within the Game_Actors class
  136. # ($game_actors) and referenced by the Game_Party class ($game_party).
  137. #==============================================================================
  138.  
  139. class Game_Actor < Game_Battler
  140.   #--------------------------------------------------------------------------
  141.   # * Alias Listing
  142.   #--------------------------------------------------------------------------
  143.   alias dargor_vx_rupture_actor_initialize initialize
  144.   #--------------------------------------------------------------------------
  145.   # * Object Initialization
  146.   #--------------------------------------------------------------------------
  147.   def initialize(actor_id)
  148.     dargor_vx_rupture_actor_initialize(actor_id)
  149.     @rp = maxrp
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # * MAXRP
  153.   #--------------------------------------------------------------------------
  154.   def maxrp
  155.     return eval(Rupture::RP_Max_Formula)
  156.   end
  157. end
  158.  
  159. #==============================================================================
  160. # ** Game_Enemy
  161. #------------------------------------------------------------------------------
  162. #  This class handles enemy characters. It's used within the Game_Troop class
  163. # ($game_troop).
  164. #==============================================================================
  165.  
  166. class Game_Enemy < Game_Battler
  167.   #--------------------------------------------------------------------------
  168.   # * Alias Listing
  169.   #--------------------------------------------------------------------------
  170.   alias dargor_vx_rupture_enemy_initialize initialize
  171.   #--------------------------------------------------------------------------
  172.   # * Object Initialization
  173.   #--------------------------------------------------------------------------
  174.   def initialize(index, enemy_id)
  175.     dargor_vx_rupture_enemy_initialize(index, enemy_id)
  176.     @rp = maxrp
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # * MAXRP
  180.   #--------------------------------------------------------------------------
  181.   def maxrp
  182.     if Rupture::Enemy_RP[@enemy_id] != nil
  183.       return Rupture::Enemy_RP[@enemy_id]
  184.     else
  185.       return Rupture::Enemy_RP.default
  186.     end
  187.   end
  188. end
  189.  
  190. #==============================================================================
  191. # ** Window_Base
  192. #------------------------------------------------------------------------------
  193. #  This is a superclass of all windows in the game.
  194. #==============================================================================
  195.  
  196. class Window_Base
  197.   #--------------------------------------------------------------------------
  198.   # * Alias Listing
  199.   #--------------------------------------------------------------------------
  200.   alias dargor_vx_rupture_window_base_draw_actor_name draw_actor_name
  201.   #--------------------------------------------------------------------------
  202.   # * Draw Actor RP
  203.   #--------------------------------------------------------------------------
  204.   def draw_actor_rp(actor, x, y)
  205.     draw_actor_rp_gauge(actor, x, y)
  206.     self.contents.font.color = system_color
  207.     self.contents.draw_text(x,y,120,WLH,Vocab::RP_a)
  208.     self.contents.font.color = normal_color
  209.     self.contents.draw_text(x,y,120,WLH,"#{actor.rp}/#{actor.maxrp}",2)
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # * Draw Name
  213.   #     actor : actor
  214.   #     x     : draw spot x-coordinate
  215.   #     y     : draw spot y-coordinate
  216.   #--------------------------------------------------------------------------
  217.   def draw_actor_name(actor, x, y)
  218.     draw_actor_rp_gauge(actor, x, y, 112) if !$scene.is_a?(Scene_Status)
  219.     dargor_vx_rupture_window_base_draw_actor_name(actor, x, y)
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # * Draw RP gauge
  223.   #     actor : actor
  224.   #     x     : draw spot x-coordinate
  225.   #     y     : draw spot y-coordinate
  226.   #     width : Width
  227.   #--------------------------------------------------------------------------
  228.   def draw_actor_rp_gauge(actor, x, y, width = 120)
  229.     gw = width * actor.rp / actor.maxrp
  230.     gc1 = text_color(Rupture::Gauge_Color1)
  231.     gc2 = text_color(Rupture::Gauge_Color2)
  232.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  233.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  234.   end
  235. end
  236.  
  237. #==============================================================================
  238. # ** Window_Status
  239. #------------------------------------------------------------------------------
  240. #  This window displays full status specs on the status screen.
  241. #==============================================================================
  242.  
  243. class Window_Status < Window_Base
  244.   #--------------------------------------------------------------------------
  245.   # * Draw Basic Information
  246.   #     x : Draw spot X coordinate
  247.   #     y : Draw spot Y coordinate
  248.   #--------------------------------------------------------------------------
  249.   def draw_basic_info(x, y)
  250.     draw_actor_level(@actor, x, y + WLH * 0)
  251.     draw_actor_state(@actor, x, y + WLH * 1)
  252.     draw_actor_hp(@actor, x, y + WLH * 2)
  253.     draw_actor_mp(@actor, x, y + WLH * 3)
  254.     draw_actor_rp(@actor, x, y + WLH * 4)
  255.   end
  256. end
  257.  
  258. #==============================================================================
  259. # ** Scene_Battle
  260. #------------------------------------------------------------------------------
  261. #  This class performs battle screen processing.
  262. #==============================================================================
  263.  
  264. class Scene_Battle
  265.   #--------------------------------------------------------------------------
  266.   # * Object Initialization
  267.   #--------------------------------------------------------------------------
  268.   alias dargor_vx_rupture_battle_end battle_end
  269.   alias dargor_vx_rupture_display_damage display_damage
  270.   #--------------------------------------------------------------------------
  271.   # * End Battle
  272.   #     result : Results (0: win, 1: escape, 2:lose)
  273.   #--------------------------------------------------------------------------
  274.   def battle_end(result)
  275.     for member in $game_party.members
  276.       member.rp = member.maxrp
  277.     end
  278.     dargor_vx_rupture_battle_end(result)
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # * Show Damage
  282.   #     target : Target
  283.   #     obj    : Skill or item
  284.   #--------------------------------------------------------------------------
  285.   def display_damage(target, obj = nil)
  286.     dargor_vx_rupture_display_damage(target)
  287.     if !target.missed && !target.evaded
  288.       display_rp_damage(target)
  289.     end
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # * Show HP Damage
  293.   #     target : Target
  294.   #     obj    : Skill or item
  295.   #--------------------------------------------------------------------------
  296.   def display_rp_damage(target)
  297.     if target.rp_damage > 0              # Damage
  298.       if target.actor?
  299.         text = sprintf(Vocab::RPActorDamage, target.name, target.rp_damage)
  300.         Sound.play_actor_damage
  301.         $game_troop.screen.start_shake(5, 5, 10)
  302.       else
  303.         text = sprintf(Vocab::RPEnemyDamage, target.name, target.rp_damage)
  304.         Sound.play_enemy_damage
  305.         target.blink = true
  306.       end
  307.     else                                    # Recovery
  308.       fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
  309.       text = sprintf(fmt, target.name, Vocab::RP, -target.rp_damage)
  310.       Sound.play_recovery
  311.     end
  312.     @message_window.add_instant_text(text)
  313.     wait(30)
  314.   end
  315. end
Expand to see the code.


Instructions

Place this script above Main and edit the constants in the Rupture module.

Compatibility

Should be compatible with everything.

Credits and Thanks

Parts of the credit goes to Çauzfhie who originally requested the script.

Terms and Conditions

As usual, don't forget to give me credits!

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=71012