by Dargor
Version 1.1
Introduction
What is battle frenzy? When a battler's hp reaches 1/4 of his max hp, the battler have a chance (in percent) to enter in a frenzy while attacking. The frenzy multiplies the action by a customizable value. For exemple, Ralph is about to die and he tries to attack a mighty slime. He enters in a frenzy and attacks the slime 4 times in a row! Guess what? Ralph won the battle!
This is script works for both actors and enemies.
Script
Please read the instructions in the script header.
Code:
#==============================================================================
# ** Battle Frenzy
#------------------------------------------------------------------------------
# © Dargor, 2008
# 13/06/08
# Version 1.1
#------------------------------------------------------------------------------
# VERSION HISTORY:
# - 1.0 (04/03/08), Initial release
# - 1.1 (13/06/08), Added 'Class Based' Battle Frenzy
#------------------------------------------------------------------------------
# INSTRUCTIONS:
# - Edit the constants in the Frenzy module and enjoy!
#==============================================================================
# Text displayed in the battle text window when someone is in a frenzy
Vocab::InFrenzy = "%s is in a frenzy!"
#==============================================================================
# ** Frenzy Configuration
#==============================================================================
module Frenzy
# Actors that can enter in frenzy
Actors = [1,2]
# Enemies that can enter in frenzy
Enemies = [1]
# Classes that can enter in frenzy
# (does not take Actors into conssideration)
Classes = [1,2,3,4]
# Determine if Actors battle frenzy depends on the actor itself or
# the actor's class
Use_Classes = false
# Frenzy constants for actors
module Actor
Rate = { 1 => 75, 2 => 25}
Rate.default = 25
Multiplier = { 1 => 4, 2 => 4}
Multiplier.default = 2
end
# Frenzy constants for enemies
module Enemy
Rate = { 1 => 100, 2 => 25}
Rate.default = 25
Multiplier = { 1 => 3, 2 => 4}
Multiplier.default = 2
end
# Frenzy constants for actors
module Class
Rate = { 1 => 75, 2 => 25}
Rate.default = 25
Multiplier = { 1 => 4, 2 => 4}
Multiplier.default = 2
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass of the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Application of Slip Damage Effects
#--------------------------------------------------------------------------
def in_frenzy?
if self.is_a?(Game_Actor)
if Frenzy::Use_Classes
return false unless Frenzy::Classes.include?(self.class.id)
rate = Frenzy::Class::Rate[self.id]
rate = Frenzy::Class::Rate.default if rate.nil?
else
return false unless Frenzy::Actors.include?(self.id)
rate = Frenzy::Actor::Rate[self.id]
rate = Frenzy::Actor::Rate.default if rate.nil?
end
elsif self.is_a?(Game_Enemy)
return false unless Frenzy::Enemies.include?(self.enemy_id)
rate = Frenzy::Enemy::Rate[self.enemy_id]
rate = Frenzy::Enemy::Rate.default if rate.nil?
end
if self.hp <= self.maxhp / 8 && rand(100) <= rate
return true
else
return false
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Alias listing
#--------------------------------------------------------------------------
alias dargor_frenzy_action_attack execute_action_attack
#--------------------------------------------------------------------------
# * Execute Battle Action: Attack
#--------------------------------------------------------------------------
def execute_action_attack
if @active_battler.in_frenzy?
text = sprintf(Vocab::InFrenzy, @active_battler.name)
@message_window.add_instant_text(text)
wait(20)
if @active_battler.is_a?(Game_Actor)
if Frenzy::Use_Classes
multiplier = Frenzy::Class::Multiplier[@active_battler.class.id]
multiplier = Frenzy::Class::Multiplier.default if multiplier.nil?
else
multiplier = Frenzy::Actor::Multiplier[@active_battler.id]
multiplier = Frenzy::Actor::Multiplier.default if multiplier.nil?
end
elsif @active_battler.is_a?(Game_Enemy)
multiplier = Frenzy::Enemy::Multiplier[@active_battler.enemy_id]
multiplier = Frenzy::Enemy::Multiplier.default if multiplier.nil?
end
for i in 1..multiplier
dargor_frenzy_action_attack
@message_window.back_one
end
else
dargor_frenzy_action_attack
end
end
end
Notes
This script is compatible with my Weapon Unleash Script.
Don't forget to give me credit!
Hope you like it!
-Dargor