[XP] Extra Parameter Change (ver1.0)
Version: 1.0
Author: Logan Forrests
Date: 01 February 2013
Version History
- <Version 1.0> 2013.02.01 - Original Release
Planned Future Versions
- Only one: Allow for the default parameters (HP/SP/STR etc) to be decreased with items.
Other than that, none are planned. I will probably ignore suggestions since XP isn't my main scripting preference. Apologies.
I may, however, provide support and compatibility fixes at my own discretion.
Description
A script that allows the player to increase or decrease additional in game parameters.
In version 1.0, these stats include:
attack (atk)
physical defence (pdef)
magical defence (mdef)
evasion (eva)
Features
- Let's you increase or decrease parameters like ATK, PDEF, MDEF and EVA with the use of consumable items.
- Multiple parameters can be changed at the same time. You can have an item that trades 5 PDEF for 5 MDEF or increases PDEF by 10 and ATK by 5, for example.
- Works with other item properties. An item that restores 5% HP and increase ATK by 1? You got it.
Instructions
Check the 'Directions' section in the script. If you have any difficulties let me know and I will help you out.
Script
#------------------------------------------------------------------------------
# Extra Parameter Change (ver 1.0) [XP]
#
#==============================================================================
# About
#------------------------------------------------------------------------------
# Title: Extra Parameter Change XP
#
# A script that allows the player to increase or decrease additional
# in game parameters. In version 1.0, these stats include:
# attack (atk) physical defence (pdef) magical defence (mdef)
# evasion (eva)
#
#
# Version: 1.0
# # 1.0 - Initial Release
#
# Date Published: 01 February 2013
# Last Updated : 01 February 2012
# Author: Logan Forrests
# Hosted on: RMRK.net only.
#
# Permissions for use of this script can be found here:
# - http://rmrk.net/index.php/topic,45481.0.html
#
# Redistribution of this script is stricly prohibited with prior permission.
#==============================================================================
# Directions
#------------------------------------------------------------------------------
# Items which are designed to increase or decrease any of these additional
# parameters must be defined under BATTLE_STAT_ITEMS. The ID of the item
# is required and is used to check if the item being used is one that will
# modify the base parameter.
# Follow the example provided in the relevant section to set up items that
# will have the desired effect of modifying these extra parameters.
#
# A maximum bonus can also be set for each extra parameter. By default,
# these values have been set to 999.
#==============================================================================
module LFXP
module STAT_PLUS
#------------------------------------------------------------------------
# * Set which items change these parameters
#------------------------------------------------------------------------
BATTLE_STAT_ITEMS = { #Do Not Remove
# Item ID => {:atk => #, :pdef => #, :mdef => #, :eva => #},
#
# Ex. To make Item ID 35 increase ATK by 5:
# 35 => {:atk => 5, :pdef => 0, :mdef => 0, :eva => 0},
# Insert your items in the space below:
} #Do Not Remove
#------------------------------------------------------------------------
# * Maximum bonus attainable for each parameter type
#------------------------------------------------------------------------
MAX_BONUS = { # Do Not Remove
:atk => 999,
:pdef => 999,
:mdef => 999,
:eva => 999,
} #Do Not Remove
end
end
#==============================================================================
# DO NOT EDIT BELOW THIS LINE ::::::::::::::: DO NOT EDIT BELOW THIS LINE #
#==============================================================================
$imported ||= {}
$imported[:lfxp_statplus] = true
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Base Class attr_readers for extra stat bonuses
# Prevents errors from no method defined in base class use
#--------------------------------------------------------------------------
def lfxp_sp_atk; 0; end
def lfxp_sp_dpef; 0; end
def lfxp_sp_mdef; 0; end
def lfxp_sp_eva; 0; end
def lfxp_sp_statplus(*args); 0; end
#--------------------------------------------------------------------------
# * Application of Item Effects
# item : item
#--------------------------------------------------------------------------
alias lfxp_statplus_itmeff_gb_lk93 item_effect
def item_effect(item, *args, &block)
#Set effective flag to false (ie. has a change occured in stat)
effective = false
#If item is a stat boost item as defined in LFXP::STAT_PLUS config
boost = LFXP::STAT_PLUS::BATTLE_STAT_ITEMS[item.id]
if boost
boost.each_pair do |s, v|
#Take result of changing the stat
result = lfxp_sp_statplus(s, v)
# if result is true, then stat_changed is true
# once stat_changed is true, it will remain true despite result
if result then effective = true end
end
end
return (lfxp_statplus_itmeff_gb_lk93(item, *args, &block) or effective)
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lfxp_statplus_init_ga_aqwq initialize
def initialize(*args, &block)
#Create new varaibles for holding base stat bonus for atk, pdef, mdef, eva
@lfxp_sp_base = [0, 0, 0, 0]
#run original method
lfxp_statplus_init_ga_aqwq(*args, &block)
end
#--------------------------------------------------------------------------
# * Base Class attr_readers for extra stat bonuses
# Prevents errors from no method defined in base class use
#--------------------------------------------------------------------------
def lfxp_sp_atk; @lfxp_sp_base[0]; end #ATK
def lfxp_sp_pdef; @lfxp_sp_base[1]; end #PDEF
def lfxp_sp_mdef; @lfxp_sp_base[2]; end #MDEF
def lfxp_sp_eva; @lfxp_sp_base[3]; end #EVA
#--------------------------------------------------------------------------
# * Stat Plus method
# Increases or decreases appropriate stats
# Returns true if a parameter change occurs, false if not
#--------------------------------------------------------------------------
def lfxp_sp_statplus(stat, value)
#Change the relative value
case stat
when :atk
orig_value = lfxp_sp_atk #original attack
@lfxp_sp_base[0] = [[lfxp_sp_atk + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:atk].min
return true if orig_value != lfxp_sp_atk
when :pdef
orig_value = lfxp_sp_pdef #original pdef
@lfxp_sp_base[1] = [[lfxp_sp_pdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:pdef].min
return true if orig_value != lfxp_sp_pdef
when :mdef
orig_value = lfxp_sp_mdef #original mdef
@lfxp_sp_base[2] = [[lfxp_sp_mdef + value, 0].max, LFXP::STAT_PLUS::MAX_BONUS[:mdef].min
return true if orig_value != lfxp_sp_mdef
when :eva
orig_value = lfxp_sp_eva #original eva
@lfxp_sp_base[3] = [[lfxp_sp_eva + value, 0].max, LFXP::STAT_PLUS::MAX_BONUSeva].min
return true if orig_value != lfxp_sp_eva
end
#In all cases, or when no case
return false #not effective
end
#--------------------------------------------------------------------------
# * Sub class method definitions.
# Also retrieves value from Superclass in case changes are added
# By default, all super values are 0
#--------------------------------------------------------------------------
def base_atk
super + lfxp_sp_atk
end
def base_pdef
super + lfxp_sp_pdef
end
def base_mdef
super + lfxp_sp_mdef
end
def base_eva
super + lfxp_sp_eva
end
end
Credit
- Logan Forrests - There is an 's' at the end.
Thanks
- bloodyhowling - For bringing up the idea.
Support
Post in this thread, I'll see what I can do.
Known Compatibility Issues
If there are some, let me know. Otherwise, I don't know of any.
Demo
None exists, and none is really required. It's quite simple to set up.
Author's Notes
I don't know if such a script already exists, but I always like to write my own if I can. It's like a personal challenge.
There really isn't enough XP scripters in this place. I wouldn't want to do anything crazy with RGSS/XP, but for these kinds of scripts it doesn't really matter which platform is used outside of what Ruby code you can actually use in 1.8.1 compared to 1.9.1.
I'll tell you what I do miss, though... note boxes. Those note boxes are so damn useful.
Y u no av XP?
Terms of Use
Whilst relating to VX Ace, these same terms apply to this script.
Terms of Use