Custom skill damage calculation formulaVersion: 1.0ßAuthor: Lettuce and YOU!Date: May 14, 2008***Not suitable for those who do not know basic scripting syntax***
Version History
Planned Future Versions
- Version 1.1 will have custom formula for normal attack (though if you study this version, attack formula can easily be changed X_X)
Description
Let you fully customize how skill damages are calculated
Screenshots
Can't post a screenshot for something like this >.<;
Instructions
This is how you do it:
1. Set the base damage of the skill you want to use custom formula with to 9999
2. Set the variance value to something different than others, this will be
used as a reference to the custom formula.
Sorry, typo, should say 9999 in the script comment x_x;;
Example
when 1 #Skill with 9999 base damage AND 1 as variance value will use this formula instead of default one
damage = ( user.spi**2 ) #damage is user's spi squared (50 spi = 2500 damage)
@ignore_def = true #this ignores target's defence
@ignore_guard = true #this ignores guarding mode of target (normally guarding reduce damage by 50%)
**INFO** basic math operator
+ Add
- Subtract
* Multiply
/ Divide
% Modulus; give you the left over value after division (5 % 2
gives you 1 because 5 can be divided by 2 twice with 1 as a
remainder)
** Powering : 5**3 = 5 cubed = 5 x 5 x 5 = 125
Math.exp(x) Exponential : Math.exp(5) = e^5 = 148~
Math.sqrt(x)Square root : Math.sqrt(100) = root(100) = 10
rand(x) Returns random number between 0 and x
.floor Round down number
.ceil Round up number
**Multiplication and division are processed before addition and subtraction!
You can overide this by putting a bracket around addition or subtraction ;P
5*3+2 = 17
5*(3+2) = 15
Lets look at what sort of things you can use:
**user is the one using the skill, self is the target. If the monster is using
the skill, user.hp returns monster's hp and self.agi, return player's agi
user.hp self.hp
user.mp self.mp
user.maxhp self.maxhp
user.maxmp self.maxmp
user.atk self.atk
user.spi self.spi
user.def self.def
user.agi self.agi
user.hit self.hit
user.eva self.eva
and more o.o
Something to be careful of:
- You can use user.level and self.level BUT ONLY if you put
"if user.level != nil" OR "if self.level != nil"
because Monsters DOES NOT HAVE LEVEL! you'll get error if you don't
put that line in there. Same goes for critical
IMPORTANT!!
** total damage MUST be stored in "damage" variable.
** These variables gives you extra control
@varience - value used to derive variance, if you @no_variance is false
@no_variance - set to true if you want fixed value
@is_heal - allows damage to be less than 0. It can still be above 0 and hurt the target though
@ignore_def - ignores target's defense
@ignore_element - ignores element, no bonus or reduction
@ignore_guard - ignore guarding mode, no damage reduction
CUSTOMIZATION BEGINS AT LINE 102!
Script
Spoiler for:
=begin
????????????????????????????????????????????????????????????????????????????????
? *** Custom Skill Damage Calculation *** ?
? By Lettuce. ?
? ?
?**Note** ?
? This idea was first brought to us by someone on creationasylum AGES ago ?
? So if you're that person, please contact me and I'll add your name ^_^ ?
????????????????????????????????????????????????????????????????????????????????
This script lets you create your own damage calculation formula for skills
The default formula takes the base damage and add 400% of user's ATK and
subtract 200% of target's def. Then apply element, skill variance and guard
status
But here you can make a completely custom formula. :D!
INSTRUCTION
This is how you do it:
1. Set the base damage of the skill you want to use custom formula with to 9999
2. Set the variance value to something different than others, this will be
used as a reference to the custom formula.
Example
when 1 #Skill with 9999 base damage AND 1 as variance value will use this formula instead of default one
damage = ( user.spi**2 ) #damage is user's spi squared (50 spi = 2500 damage)
@ignore_def = true #this ignores target's defence
@ignore_guard = true #this ignores guarding mode of target (normally guarding reduce damage by 50%)
**INFO** basic math operator
+ Add
- Subtract
* Multiply
/ Divide
% Modulus; give you the left over value after division (5 % 2
gives you 1 because 5 can be divided by 2 twice with 1 as a
remainder)
** Powering : 5**3 = 5 cubed = 5 x 5 x 5 = 125
Math.exp(x) Exponential : Math.exp(5) = e^5 = 148~
Math.sqrt(x)Square root : Math.sqrt(100) = root(100) = 10
rand(x) Returns random number between 0 and x
.floor Round down number
.ceil Round up number
**Multiplication and division are processed before addition and subtraction!
You can overide this by putting a bracket around addition or subtraction ;P
5*3+2 = 17
5*(3+2) = 15
Lets look at what sort of things you can use:
**user is the one using the skill, self is the target. If the monster is using
the skill, user.hp returns monster's hp and self.agi, return player's agi
user.hp self.hp
user.mp self.mp
user.maxhp self.maxhp
user.maxmp self.maxmp
user.atk self.atk
user.spi self.spi
user.def self.def
user.agi self.agi
user.hit self.hit
user.eva self.eva
and more o.o
Something to be careful of:
- You can use user.level and self.level BUT ONLY if you put
"if user.level != nil" OR "if self.level != nil"
because Monsters DOES NOT HAVE LEVEL! you'll get error if you don't
put that line in there. Same goes for critical
IMPORTANT!!
** total damage MUST be stored in "damage" variable.
** These variables gives you extra control
@varience - value used to derive variance, if you @no_variance is false
@no_variance - set to true if you want fixed value
@is_heal - allows damage to be less than 0. It can still be above 0 and hurt the target though
@ignore_def - ignores target's defense
@ignore_element - ignores element, no bonus or reduction
@ignore_guard - ignore guarding mode, no damage reduction
CUSTOMIZATION BEGINS AT LINE 102!
=end
class Game_Battler
#-------------------------------------------------------------------------
# * Alias List
#-------------------------------------------------------------------------
alias Lettuce_make_obj_damage_value make_obj_damage_value
def make_obj_damage_value(user,obj)
if obj.base_damage == 9999
@varience = user.hit
@no_variance
@is_heal = false
@ignore_def = false
@ignore_element = false
@ignore_guard = false
case obj.variance
#-------------------------------------------------------------------------
# ** Begin customization!
#
#
#-------------------------------------------------------------------------
when 1 #formula for skill with 9999 base damage and 1 variance
multiple = 1
multiple = (user.level / 6).floor + 1 if user.level != nil #every 6 level, this skill get 100% increase
multiple = 10 if multiple > 10 #no more increase after level 30 ;P
damage = (0.7 * self.def * user.spi**2)/(self.def + user.spi)
damage *= multiple
damage = damage.floor #final damage, round down
@ignore_def = true #ignore target's defence
@no_variance = true #fixed damage
when 2 #formula for skill with 9999 base damage and 2 variance
damage = (user.atk**2)
damage = damage.floor #final damage, round down
@ignore_def = true #ignore target's defence
when 3 #skill with 999 base damage and 3 variance will use this
damage = $game_party.gold/100 #1% of your gold
damage = damage.floor #round down to whole number
$game_party.lose_gold(damage) #loose same amoung of gold as the damage
#-------------------------------------------------------------------------
# ** End customization!
#
#
#-------------------------------------------------------------------------
end
unless @ignore_def #this deals with damage decrease from target's def
damage -= self.def * 2 * obj.atk_f
end
damage = 0 if damage < 0
unless @ignore_element
damage *= elements_max_rate(obj.element_set)
damage /= 100
end
#Variance Formula
if @no_variance == false
variance_range = (100 - user.hit) * 2 #skill variance, can change ;D
damage -= rand(variance_range)
end
if @is_heal == false
damage = 0 if damage < 0
end
if @ignore_guard == false
damage = apply_guard(damage)
end
if obj.damage_to_mp
@mp_damage = damage
else
@hp_damage = damage
end
else
Lettuce_make_obj_damage_value
end
end
end
Credit
Thanks
- That person who brought this idea upon us in XP version, I can't remember the name and couldn't find a topic (it was ages ago). Do contact me if you know who that is, and I'll add the name to this list~
Support
Just post here or send me pm XD
Known Compatibility Issues
Used Alias, so should work with anything o,o
Demo
This shouldn't really need a demo ;[ but if you REALLY want it, I can post it up XD
Restrictions
Do whatever with it~ But would be nice if you inform me ^o^