12-08-2011, 11:31 PM
(Questo messaggio è stato modificato l'ultima volta il: 04-01-2012, 11:48 PM da Johnny 97.)
DESCRIZIONE:
rompe i limiti dei principali parametri (HP, MP). Ovvero, se il limite normale è 9.999, con questo script il limite può essere 99.999
AUTORE/I:
R. Johnson (El Conductor)
ISTRUZIONI:
Inserire sopra main
SCRIPT:
[SPOILER]
[/SPOILER]
BUG E CONFLITTI NOTI:
Nessuno
___________________________________________________________
*EDIT by Johnny 97*: Modificato il post seguendo il template per postare gli script messo in rilievo. Cercate di seguirlo tutti per rendere tutto più ordinato e piacevole da leggere!
rompe i limiti dei principali parametri (HP, MP). Ovvero, se il limite normale è 9.999, con questo script il limite può essere 99.999
AUTORE/I:
R. Johnson (El Conductor)
ISTRUZIONI:
Inserire sopra main
SCRIPT:
[SPOILER]
Codice:
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Break Limits VX +
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# By: R. Johnson aka.(El Conductor) +
# Updated: July/22/08 +
# Version: 3.0 +
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#----------------------------------------------------------------------------
# What it Does:
# Actors HP and SP can now go above 9999 when certian armor that breaks
# the limit are equipped. By default damage wasn't limited like HP & SP.
# So I made a Limit that can be broken with certian weapons. I made the
# limits values and which weapons and armors break those limits easy to
# customize in the Module Break_Limits.
#
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# How it Works:
#
# This script defines Default and Broken limit values in Module
# Break_Limits. These values are used in the Game_Battler class's maxhp
# & maxsp methods.
#
# Lengths and settings for limits are stored in Module Break_Limits.
#
# New and altered scripts are:
#
# - Module Break_Limits
# - Game_Actor
# - Game_Battler
#
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# How to Use This Script:
# Just copy it and paste it above Main.
#
# To change the limits and other settings go to Module Break_Limits
# and change the values there.
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Comments:
# I hope my script is easy for you to use and modify. Study this script
# to learn the ways of RGSS and join the ranks of those known as 'Scripters'.
#----------------------------------------------------------------------------
#==============================================================================
# Module Break_Limits
#------------------------------------------------------------------------------
# Houses limit values and the arrays of equipment that break the limits.
#==============================================================================
module Break_Limits
# Set values to Constants
# Set HP and SP Limits
DEFAULT_HP_LIMIT = 9999
BROKEN_HP_LIMIT = 999999
BROKEN_ACTOR_HP_LIMIT = 99999
DEFAULT_MP_LIMIT = 9999
BROKEN_MP_LIMIT = 999999
BROKEN_ACTOR_MP_LIMIT = 99999
# Set a limit for damage
DAMAGE_LIMIT = 9999
# Set an array of ID's of weapons you want to break the damage limit
# Example King's Sword ID is 30. So we have 30 in the array
BROKEN_WEAPONS = [30]
# Set an array of ID's of armors you want to break the hp limit
BROKEN_ARMORS_HP = [29]
# Set an array of ID's of armors you want to break the mp limit
BROKEN_ARMORS_MP = [26, 30]
end
#==============================================================================
# ** Game_Battler (part 1 and 3)
#------------------------------------------------------------------------------
# Methods that deal with max HP & SP have been adjusted to work with new
# system. Methods attack_effect & skill_effect have been modified to handle
# weapons the don't break the limit.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Get Maximum HP Limit
#--------------------------------------------------------------------------
def maxhp_limit
return Break_Limits::BROKEN_HP_LIMIT
end
#--------------------------------------------------------------------------
# * Get Maximum MP Limit
#--------------------------------------------------------------------------
def maxmp_limit
return Break_Limits::BROKEN_MP_LIMIT
end
#--------------------------------------------------------------------------
# * Set Maximum HP
# new_maxhp : new maximum HP
#--------------------------------------------------------------------------
def maxhp=(new_maxhp)
limit = Break_Limits::BROKEN_HP_LIMIT
@maxhp_plus += new_maxhp - self.maxhp
@maxhp_plus = [[@maxhp_plus, -limit].max, limit].min
@hp = [@hp, self.maxhp].min
end
#--------------------------------------------------------------------------
# * Set Maximum MP
# new_maxmp : new maximum MP
#--------------------------------------------------------------------------
def maxmp=(new_maxmp)
limit = Break_Limits::BROKEN_MP_LIMIT
@maxmp_plus += new_maxmp - self.maxmp
@maxmp_plus = [[@maxmp_plus, -limit].max, limit].min
@mp = [@mp, self.maxmp].min
end
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
def maxhp
return [[base_maxhp + @maxhp_plus, 1].max, maxhp_limit].min
end
#--------------------------------------------------------------------------
# * Get Maximum MP
#--------------------------------------------------------------------------
def maxmp
return [[base_maxmp + @maxmp_plus, 0].max, maxmp_limit].min
end
#--------------------------------------------------------------------------
# * Calculation of Damage From Normal Attack
# attacker : Attacker
# The results are substituted for @hp_damage
#--------------------------------------------------------------------------
def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2 # base calculation
damage = 0 if damage < 0 # if negative, make 0
damage *= elements_max_rate(attacker.element_set) # elemental adjustment
damage /= 100
if damage == 0 # if damage is 0,
damage = rand(2) # half of the time, 1 dmg
elsif damage > 0 # a positive number?
@critical = (rand(100) < attacker.cri) # critical hit?
@critical = false if prevent_critical # criticals prevented?
damage *= 3 if @critical # critical adjustment
end
damage = apply_variance(damage, 20) # variance
damage = apply_guard(damage) # guard adjustment
# Only check if attacke is an actor
unless attacker.is_a?(Game_Enemy)
# Perform check if damage is limited only if actors weapon
# doesn't break the limit.
unless attacker.breaks_limit?
# If damage is higher than limit
if damage > Break_Limits::DAMAGE_LIMIT
# Set damage equal to limit
damage = Break_Limits::DAMAGE_LIMIT
end
end
end
@hp_damage = damage # damage HP
end
#--------------------------------------------------------------------------
# * Calculation of Damage Caused by Skills or Items
# user : User of skill or item
# obj : Skill or item (for normal attacks, this is nil)
# The results are substituted for @hp_damage or @mp_damage.
#--------------------------------------------------------------------------
def make_obj_damage_value(user, obj)
damage = obj.base_damage # get base damage
if damage > 0 # a positive number?
damage += user.atk * 4 * obj.atk_f / 100 # Attack F of the user
damage += user.spi * 2 * obj.spi_f / 100 # Spirit F of the user
unless obj.ignore_defense # Except for ignore defense
damage -= self.def * 2 * obj.atk_f / 100 # Attack F of the target
damage -= self.spi * 1 * obj.spi_f / 100 # Spirit F of the target
end
damage = 0 if damage < 0 # If negative, make 0
elsif damage < 0 # a negative number?
damage -= user.atk * 4 * obj.atk_f / 100 # Attack F of the user
damage -= user.spi * 2 * obj.spi_f / 100 # Spirit F of the user
end
damage *= elements_max_rate(obj.element_set) # elemental adjustment
damage /= 100
damage = apply_variance(damage, obj.variance) # variance
damage = apply_guard(damage) # guard adjustment
# Only check if attacke is an actor
unless user.is_a?(Game_Enemy)
# Perform check if damage is limited only if actors weapon
# doesn't break the limit.
unless user.breaks_limit?
# If damage is higher than limit
if damage > Break_Limits::DAMAGE_LIMIT
# Set damage equal to limit
damage = Break_Limits::DAMAGE_LIMIT
end
end
end
if obj.damage_to_mp
@mp_damage = damage # damage MP
else
@hp_damage = damage # damage HP
end
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# New limit attributes have been added that the modified maxhp & maxsp
# methods will use. Other new methods check if any armor equiped breaks any
# limits, and whether the actors weapon breaks the limit.
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
#attr_accessor :hp_limit # Current HP limit
#attr_accessor :sp_limit # Current SP limit
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias limit_game_actor_setup setup
alias limit_game_actor_change_equip change_equip
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
# Set limits to default values stored in Module Break_Limits
@hp_limit = Break_Limits::DEFAULT_HP_LIMIT
@mp_limit = Break_Limits::DEFAULT_MP_LIMIT
setup(actor_id)
@last_skill_id = 0
end
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup(actor_id)
# Original method
limit_game_actor_setup(actor_id)
# New method calls
# Check if initial equipment breaks the limit
check_armor_hp_limit
check_armor_mp_limit
end
#--------------------------------------------------------------------------
# * Get Maximum HP Limit
#--------------------------------------------------------------------------
def maxhp_limit
return @hp_limit
end
#--------------------------------------------------------------------------
# * Get Maximum MP Limit
#--------------------------------------------------------------------------
def maxmp_limit
return @mp_limit
end
#--------------------------------------------------------------------------
# * Change Equipment (designate object)
# equip_type : Equip region (0..4)
# item : Weapon or armor (nil is used to unequip)
# test : Test flag (for battle test or temporary equipment)
#--------------------------------------------------------------------------
def change_equip(equip_type, item, test = false)
# Original method actions
limit_game_actor_change_equip(equip_type, item, test = false)
# New method calls
check_armor_hp_limit
check_armor_sp_limit
end
#--------------------------------------------------------------------------
# * Checks every armor equiped for break HP limit
#--------------------------------------------------------------------------
def check_armor_hp_limit
# Check if any currently equiped armor breaks the limit
# If so, then set limit to the broken value
if @armor1_id != 0 and Break_Limits::BROKEN_ARMORS_HP.include?(@armor1_id)
@hp_limit = Break_Limits::BROKEN_ACTOR_HP_LIMIT
elsif @armor2_id != 0 and Break_Limits::BROKEN_ARMORS_HP.include?(@armor2_id)
@hp_limit = Break_Limits::BROKEN_ACTOR_HP_LIMIT
elsif @armor3_id != 0 and Break_Limits::BROKEN_ARMORS_HP.include?(@armor3_id)
@hp_limit = Break_Limits::BROKEN_ACTOR_HP_LIMIT
elsif @armor4_id != 0 and Break_Limits::BROKEN_ARMORS_HP.include?(@armor4_id)
@hp_limit = Break_Limits::BROKEN_ACTOR_HP_LIMIT
# Otherwise set the actors limit to the default
else
@hp_limit = Break_Limits::DEFAULT_HP_LIMIT
# If current HP is higher than limit, correct it
if @hp > maxhp
@hp = maxhp
end
end
end
#--------------------------------------------------------------------------
# * Checks every armor equiped for break SP limit
#--------------------------------------------------------------------------
def check_armor_mp_limit
# Check if any currently equiped armor breaks the limit
# If so, then set limit to the broken value
if @armor1_id != 0 and Break_Limits::BROKEN_ARMORS_MP.include?(@armor1_id)
@mp_limit = Break_Limits::BROKEN_ACTOR_MP_LIMIT
elsif @armor2_id != 0 and Break_Limits::BROKEN_ARMORS_MP.include?(@armor2_id)
@mp_limit = Break_Limits::BROKEN_ACTOR_MP_LIMIT
elsif @armor3_id != 0 and Break_Limits::BROKEN_ARMORS_MP.include?(@armor3_id)
@mp_limit = Break_Limits::BROKEN_ACTOR_MP_LIMIT
elsif @armor4_id != 0 and Break_Limits::BROKEN_ARMORS_MP.include?(@armor4_id)
@mp_limit = Break_Limits::BROKEN_ACTOR_MP_LIMIT
# Otherwise set the actors limit to the default
else
@mp_limit = Break_Limits::DEFAULT_MP_LIMIT
# If current HP is higher than limit, correct it
if @mp > maxmp
@mp = maxmp
end
end
end
#--------------------------------------------------------------------------
# * Checks if actors current weapon breaks the damage limit and return
# true or false to its caller. Is called from Game_Battler attack_effect.
#--------------------------------------------------------------------------
def breaks_limit?
# Check if actor has a weapon at all
if @weapon_id != 0
return Break_Limits::BROKEN_WEAPONS.include?(@weapon_id) # Return limit_broken
else # If not then,
return false # Return false
end
end
end
BUG E CONFLITTI NOTI:
Nessuno
___________________________________________________________
*EDIT by Johnny 97*: Modificato il post seguendo il template per postare gli script messo in rilievo. Cercate di seguirlo tutti per rendere tutto più ordinato e piacevole da leggere!