Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Skill Damage Effects (Version 3.0), A basic script that allows you to tag special effects to skills.
Twilight
post Sep 10 2008, 02:57 PM
Post #1


Real name, Lily White
Group Icon

Group: Revolutionary
Posts: 227
Type: Developer
RM Skill: Advanced




This script basically allows you to alter the damage algorithms of skills with various effects.

Had to completely rewrite the script from the ground up since I noticed an issue with using multiple effects with the same name (Gravity:HP and Gravity:MP would only read gravity HP) So I rewrote each method with it's own name

CODE
]#===========================================================================
# ** Custom Skill Effects
#---------------------------------------------------------------------------
#  By Lowell
#   Also known as Twilight/Adalwulf
#---------------------------------------------------------------------------
#  03/11/09 (Version 3 Btw)
#   A much needed update that fixed issues with some skills reading from the same source.
#   each effect has it's own note tag now so compatibility issues should be nonexistant.
#   not heavily tested so post any bugs.
#  03/17/08
# Version 2.00
#   Once again changed how a few skills were setup. If you prefer to original names
#   you can change the name Initial Word Setup.
#   New Effects include variable based damage which brings the grand total to 17!
# Version 1.08
#   Fixes a nasty and unseen bug that made it ignore several things such as element rates and variance.

# Version 1.07
#   Fixed a few issues and made the setup a little easier to read
#   A few if the effects were removed as they didn't really do anything.
#===========================================================================
#  Special Thanks goes to
#   Diedrupo, For helping me with the script in it's initial stages
#   Trickster, For teaching me the bits and pieces I needed to get started
#   Space not Far, For creating such a simple method for using the notes field
#===========================================================================

=begin
NOTE FIELD

** Pre PARAM Modifier [HP & MP]
    CUR: - Reads from Current HP|MP
    MAX: - Reads from Maximum HP|MP
    DIF: - Reads from Maximum HP|MP - Current HP|MP
    RED: - Reduces HP|MP by defined amount.
    SET: - Sets HP|MP to defined amount.

** Pre PARAM Modifier [STATS]    
    PER: - Reads from a percentage of the define stat. 100 is normal.

** PARAM Modifier
    HP - Reads from the HP Stat
    MP - Reads from the MP Stat
    
    ATK - Reads from the attack parameter
    DEF - Reads from the defense parameter
    SPI - Reads from the spirit parameter
    AGI - Reads from the agility parameter
    HIT - Reads from the hit rate parameter
    EVA - Reads from the evasion parameter
    CRI - Reads from the critical parameter
    
    VAR - Reads from the define variable
    GP - Reads from the current gold value
    SET - Deals the exact amount of damage
    NONHP - Leaves the target with the HP Defined
    NONMP - Leaves the target with the MP Defined

** Post PARAM Modifier [Actor & Enemy]
    -ACT - Will use the actors parameter
    -FOE - Will use the targets parameter

** EXAMPLES
    <CUR:MP-ACT=125> - Deals Damage equal to your current MP x1.25
    <MAX:HP-FOE=25> - Deals damage equal to 1/4 the targets Max HP
    <PER:ATK-ACT=400> - Deals damage equal to your attack x4
    <VAR=10> - Will deal damage equal to whatever Variable 10 is (Be sure to define it)
    <SET:HP-FOE=1> - Sets the enemies HP to 1 (remove variance or it will most likely kill them)
    <SET=1000> - Deals exactly 1000 Damage to the target (Obviously affected by resistances)
    <RED:MP-FOE=100> Deals 100 Damage to the targets MP
=end
class Game_Battler
    #----------------------------
    # PARAM Modifiers HP
    #----------------------------
    LOW_CURHP_1    =    "CUR:HP-ACT"
    LOW_CURHP_2    =    "CUR:HP-FOE"
    LOW_MAXHP_1    =    "MAX:HP-ACT"
    LOW_MAXHP_2    =    "MAX:HP-FOE"
    LOW_DIFHP_1    =    "DIF:HP-ACT"
    LOW_DIFHP_2    =    "DIF:HP-FOE"
    LOW_REDHP_1    =    "RED:HP-ACT"
    LOW_REDHP_2    =    "RED:HP-FOE"
    LOW_SETHP_1    =    "SET:HP-ACT"
    LOW_SETHP_2    =    "SET:HP-FOE"
    #----------------------------
    # PARAM Modifiers MP
    #----------------------------
    LOW_CURMP_1    =    "CUR:MP-ACT"
    LOW_CURMP_2    =    "CUR:MP-FOE"
    LOW_MAXMP_1    =    "MAX:MP-ACT"
    LOW_MAXMP_2    =    "MAX:MP-FOE"
    LOW_DIFMP_1    =    "DIF:MP-ACT"
    LOW_DIFMP_2    =    "DIF:MP-FOE"
    LOW_REDMP_1    =    "RED:MP-ACT"
    LOW_REDMP_2    =    "RED:MP-FOE"
    LOW_SETMP_1    =    "SET:MP-ACT"
    LOW_SETMP_2    =    "SET:MP-FOE"
    #----------------------------
    # PARAM Modifiers STATS
    #----------------------------
    LOW_PERATK_1 =    "PER:ATK-ACT"
    LOW_PERATK_2 =    "PER:ATK-FOE"
    LOW_PERDEF_1 =    "PER:DEF-ACT"
    LOW_PERDEF_2 =    "PER:DEF-FOE"
    LOW_PERSPI_1 =    "PER:SPI-ACT"
    LOW_PERSPI_2 =    "PER:SPI-FOE"
    LOW_PERAGI_1 =    "PER:AGI-ACT"
    LOW_PERAGI_2 =    "PER:AGI-FOE"
    LOW_PERHIT_1 =    "PER:HIT-ACT"
    LOW_PERHIT_2 =    "PER:HIT-FOE"
    LOW_PEREVA_1 =    "PER:EVA-ACT"
    LOW_PEREVA_2 =    "PER:EVA-FOE"

    #----------------------------
    # SPECIAL Modifiers
    #----------------------------
    LOW_VAR =    "VAR"
    LOW_GP =    "GP"
    LOW_SET =    "SET"
    LOW_NONHP =    "NONHP"
    LOW_NONMP =    "NONMP"
    #----------------------------
    # HEAL Modifiers HP
    #----------------------------
    LOW_HEALCURHP_1    =    "HEAL:CUR:HP-ACT"
    LOW_HEALCURHP_2    =    "HEAL:CUR:HP-FOE"
    LOW_HEALMAXHP_1    =    "HEAL:MAX:HP-ACT"
    LOW_HEALMAXHP_2    =    "HEAL:MAX:HP-FOE"
    LOW_HEALDIFHP_1    =    "HEAL:DIF:HP-ACT"
    LOW_HEALDIFHP_2    =    "HEAL:DIF:HP-FOE"
    #----------------------------
    # HEAL Modifiers MP
    #----------------------------
    LOW_HEALCURMP_1    =    "HEAL:CUR:MP-ACT"
    LOW_HEALCURMP_2    =    "HEAL:CUR:MP-FOE"
    LOW_HEALMAXMP_1    =    "HEAL:MAX:MP-ACT"
    LOW_HEALMAXMP_2    =    "HEAL:MAX:MP-FOE"
    LOW_HEALDIFMP_1    =    "HEAL:DIF:MP-ACT"
    LOW_HEALDIFMP_2    =    "HEAL:DIF:MP-FOE"
    #----------------------------
    # HEAL Modifiers STATS
    #----------------------------
    LOW_HEALATK_1 =    "HEAL:ATK-ACT"
    LOW_HEALATK_2 =    "HEAL:ATK-FOE"
    LOW_HEALDEF_1 =    "HEAL:DEF-ACT"
    LOW_HEALDEF_2 =    "HEAL:DEF-FOE"
    LOW_HEALSPI_1 =    "HEAL:SPI-ACT"
    LOW_HEALSPI_2 =    "HEAL:SPI-FOE"
    LOW_HEALAGI_1 =    "HEAL:AGI-ACT"
    LOW_HEALAGI_2 =    "HEAL:AGI-FOE"
    LOW_HEALHIT_1 =    "HEAL:HIT-ACT"
    LOW_HEALHIT_2 =    "HEAL:HIT-FOE"
    LOW_HEALEVA_1 =    "HEAL:EVA-ACT"
    LOW_HEALEVA_2 =    "HEAL:EVA-FOE"
    #------------------------------------------------------------------
    # Custom Skill Effects Start
    #------------------------------------------------------------------
    alias skill_damage_effects_make_obj_damage_value make_obj_damage_value
    def make_obj_damage_value(user, obj)
        skill_damage_effects_make_obj_damage_value(user, obj)
        damage = obj.base_damage
        if damage > 0

        #----------------------------
        # Current HP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_CURHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (user.hp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Current HP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_CURHP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (self.hp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Maximum HP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_MAXHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (user.maxhp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Maximum HP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_MAXHP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (self.maxhp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Difference HP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_DIFHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.maxhp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Difference HP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_DIFHP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.maxhp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Reduce HP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += user.maxhp - memo[i].to_i
            end
        end
        #----------------------------
        # Reduce HP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDHP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += self.maxhp - memo[i].to_i
            end
        end
        #----------------------------
        # Set HP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                user.hp = memo[i].to_i
            end
        end
        #----------------------------
        # Set HP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                user.hp = memo[i].to_i
            end
        end
        #=====================================================================
        #----------------------------
        # Current MP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_CURMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (user.mp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Current MP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_CURMP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (self.mp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Maximum MP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_MAXMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (user.maxmp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Maximum MP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_MAXMP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += (self.maxmp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Difference MP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_DIFMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.maxmp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Difference MP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_DIFMP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.maxmp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Reduce MP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += user.maxmp - memo[i].to_i
            end
        end
        #----------------------------
        # Reduce MP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDMP_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += self.maxmp - memo[i].to_i
            end
        end
        #----------------------------
        # Set MP - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                user.mp = memo[i].to_i
            end
        end
        #----------------------------
        # Set MP - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_REDMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                user.mp = memo[i].to_i
            end
        end
        #=====================================================================
        #----------------------------
        # Percentile ATK - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERATK_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.atk * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile DEF - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERDEF_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.def * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile SPI - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERSPI_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.spi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile AGI - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERAGI_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.agi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile HIT - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERHIT_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.hit * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile EVA - Actor
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PEREVA_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (user.eva * (memo[i].to_f / 100)).to_int
            end
        end

        #----------------------------
        # Percentile ATK - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERATK_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.atk * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile DEF - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERDEF_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.def * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile SPI - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERSPI_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.spi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile AGI - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERAGI_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.agi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile HIT - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PERHIT_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.hit * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Percentile EVA - Enemy
        #----------------------------
        memo = obj.note.scan(/<#{LOW_PEREVA_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  (self.eva * (memo[i].to_f / 100)).to_int
            end
        end

        #--------------------------------------------------------------------
        #----------------------------
        # Special Modifier - Variable
        #----------------------------
        memo = obj.note.scan(/<#{LOW_VAR}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += $game_variables[memo[i].to_i]
            end
        end
        #----------------------------
        # Special Modifier - Gold
        #----------------------------
        memo = obj.note.scan(/<#{LOW_GP}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage +=  ($game_party.gold * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Special Modifier - SET
        #----------------------------
    memo = obj.note.scan(/<#{LOW_SET}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage += memo[i+1].to_i
            end
        end
        #----------------------------
        # Special Modifier - Non Fatal HP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_NONHP}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                self.hp += memo[i+1].to_i
            end
        end
        #----------------------------
        # Special Modifier - Non Fatal MP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_NONHP}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                self.mp += memo[i+1].to_i
            end
        end
        #---------------------------------------------------------------------
        #----------------------------
        # Heal Modifier - Current HP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALCURHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.hp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Maximum HP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALMAXHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.maxhp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Difference HP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDIFHP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.maxhp * (memo[i].to_f / 100)).to_int
            end
        end

        #----------------------------
        # Heal Modifier - Current MP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALCURMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.mp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Maximum MP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALMAXMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.maxmp * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Difference MP
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDIFMP_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.maxmp * (memo[i].to_f / 100)).to_int
            end
        end
        
        #----------------------------
        # Heal Modifier - Attack
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALATK_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.atk * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Defense
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDEF_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.def * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Spirit
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDEF_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.spi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Agility
        #----------------------------
    memo = obj.note.scan(/<#{LOW_HEALDEF_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.agi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Hit Rate
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDEF_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.hit * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Evasion
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDEF_1}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (user.eva * (memo[i].to_f / 100)).to_int
            end
        end

        #--------------------------------------------------------------------
        #----------------------------
        # Heal Modifier - Attack
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALATK_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (self.atk * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Defense
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDEF_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (self.def * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Spirit
        #----------------------------
      memo = obj.note.scan(/<#{LOW_HEALDEF_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (self.spi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Agility
        #----------------------------
    memo = obj.note.scan(/<#{LOW_HEALDEF_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (self.agi * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Hit Rate
        #----------------------------
    memo = obj.note.scan(/<#{LOW_HEALDEF_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (self.hit * (memo[i].to_f / 100)).to_int
            end
        end
        #----------------------------
        # Heal Modifier - Evasion
        #----------------------------
    memo = obj.note.scan(/<#{LOW_HEALDEF_2}=(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                damage -= (self.eva * (memo[i].to_f / 100)).to_int
            end
        end
        #-------------------------------------------
        # Skill Damage Effects - Final Calculations
        #-------------------------------------------
      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
    if obj.damage_to_mp
      @mp_damage = damage                     # damage MP
    else
      @hp_damage = damage                     # damage HP
    end  
  end
end
Go to the top of the page
 
+Quote Post
   
Kolid
post Sep 10 2008, 03:09 PM
Post #2


Level 19
Group Icon

Group: Revolutionary
Posts: 396
Type: Artist
RM Skill: Skilled




QUOTE (Twilight @ Sep 10 2008, 02:19 PM) *
This script for the most part lets you tag skills with special properties to change the amount of damage they do, or added new effects to skills.

As usual paste it above main.

CODE
#===========================================================================
# ** Custom Skill Effects
#---------------------------------------------------------------------------
#  Twilight, 2008
#  Special Thanks
#   Diedrupo, Trickster, Space not Far
#  03/17/08
#  Version 1.04 as of 9/4/08
#==============================================================================
# Ver 1.04
# Added Desperation and Drain Effects
#
# Ver 1.03
# Fixed an issue where it would ignore the base damage of the skill
# used.
# Multiply now has Exact and Base Damage versions
#
# Ver 1.02
# Script received a major overhall and has been cleaned up a great deal.
# Most of the old effects have been removed as a result.
#
# Ver 1.01 and before don't have any logs.
#---------------------------------------------------------------------------
=begin

@Max Gravity
Deals damage based on the targets maximum HP,
divided by the number defined

@Gravity
Deals damage based on the targets current HP,
divided by the number defined

@Multiply
Multiply deals damage based on the users parameter
multiplied by a user defined value

@Desperation
Life Strike and Minus Strike deal damage based on HP
Life will do more damage the higher your current HP * n
Minus will do more damage the lower your HP and higher your max HP * n

Mana Strike and Vital Strike are the same as HP but are based on MP
Mana deals more damage the higher your MP * n
Vital deals more damage the lower your MP is from your max * n

@Drain
Life Eater has two different types
M drains the targets HP and multiplies it by n
D drains the targets HP and divides it by n

Soul Eater has two different types as well
M drains the targets MP and multiplies it by n
D drains the targets MP and divideds it by n
----------------------------------------
n = user defined value
Stat = Str, Def, Agi, Spi.
EStat uses that exact variables
(EStr will be completely based on the users strength)
Type = M for Multiplication, D for Division. Might add Addition and
Subtraction at a later date
----------------------------------------

----------------------------------------
  ** TAGS for Skills Note Field **

  <MaxGravity:n>
  <Gravity:n>
  <Multiply:Stat:n>
  <LifeStrike:n>
  <MinusStrike:n>
  <ManaStrike:n>
    <VitalStrike:n>
    <LifeEater:Type:n>
    <SoulEater:Type:n>

  ----------------------------------------
=end
class Game_Battler
    ADAL_MGRAVITY = "MaxGravity"
    ADAL_GRAVITY = "Gravity"
    ADAL_MULTIPLIER ="Multiply"
    ADAL_DESP_HP_1 = "LifeStrike"
    ADAL_DESP_HP_2 = "MinusStrike"
    ADAL_DESP_MP_1 = "ManaStrike"
    ADAL_DESP_MP_2 = "VitalStrike"
    ADAL_HP_DRAIN = "LifeEater"
    ADAL_MP_DRAIN = "SoulEater"
    #ADAL_HP_HUNT = "Hunt"
    #ADAL_MP_HUNT = "SoulHunt"
    #------------------------------------------------------------------
    # Custom Skill Effects Code (Do Not Touch)
    #------------------------------------------------------------------
    alias adal_skill_effects_make_obj_damage_value make_obj_damage_value
    def make_obj_damage_value(user, obj)
        adal_skill_effects_make_obj_damage_value(user, obj)
        #------------------------------------------------------------------
        # Max Gravity Code
        #------------------------------------------------------------------
        memo = obj.note.scan(/<#{ADAL_MGRAVITY}:(\S+>)/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                @hp_damage = self.maxhp / memo[i].to_i
            end
        end
        #------------------------------------------------------------------
        # Gravity Code
        #------------------------------------------------------------------
        memo = obj.note.scan(/<#{ADAL_GRAVITY}:(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                @hp_damage =  self.hp / memo[i].to_i
            end
        end
        #------------------------------------------------------------------
        # Multiplier Code
        #------------------------------------------------------------------
        memo = obj.note.scan(/<#{ADAL_MULTIPLIER}:(\S+),(\S+)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                # Strength
                if memo[i] == "Str"
                    @hp_damage += user.atk * memo[i+1].to_i
                end
                # Defense
                if memo[i] == "Def"
                    @hp_damage += user.def * memo[i+1].to_i
                end
                # Agility
                if memo[i] == "Agi"
                    @hp_damage += user.agi * memo[i+1].to_i
                end
                # Spirit
                if memo[i] == "Spi"
                    @hp_damage += user.spi * memo[i+1].to_i
                end
                # Exact Strength
                if memo[i] == "EStr"
                    @hp_damage = user.atk * memo[i+1].to_i
                end
                #Exact Defense
                if memo[i] == "EDef"
                    @hp_damage = user.def * memo[i+1].to_i
                end
                #Exact Agility
                if memo[i] == "EAgi"
                    @hp_damage = user.agi * memo[i+1].to_i
                end
                #Exact Spirit
                if memo[i] == "ESpi"
                    @hp_damage = user.spi * memo[i+1].to_i
                end
            end
        end
        #------------------------------------------------------------------
        # Desperation Effects
        #------------------------------------------------------------------
        # Based on Current HP * Value
        memo = obj.note.scan(/<#{ADAL_DESP_HP_1}:(\S+>)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                @hp_damage += user.hp * memo[i].to_i
            end
        end        
        # Based on Max HP - Current HP * Value
        memo = obj.note.scan(/<#{ADAL_DESP_HP_2}:(\S+>)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                @hp_damage += (user.maxhp - user.hp) * memo[i].to_i
            end
        end    
        # Based on Current MP * Value
        memo = obj.note.scan(/<#{ADAL_DESP_MP_1}:(\S+>)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                @hp_damage += user.mp * memo[i].to_i
            end
        end    
            # Based on Max MP - Current MP * Value
        memo = obj.note.scan(/<#{ADAL_DESP_MP_1}:(\S+>)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                @hp_damage += (user.maxmp - user.mp) * memo[i].to_i
            end
        end    
        #------------------------------------------------------------------
        # Drain Effects
        #------------------------------------------------------------------
        # HP Drain
        memo = obj.note.scan(/<#{ADAL_HP_DRAIN}:(\S+>):(\S+>)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                if memo[i] == "M"
                    user.hp += @hp_damage * memo[i+1].to_i
                end            
                if memo[i] == "D"
                    user.hp += @hp_damage / memo[i+1].to_i
                end
            end
        end
        # MP Drain
        memo = obj.note.scan(/<#{ADAL_MP_DRAIN}:(\S+>):(\S+>)>/)
        memo = memo.flatten
        if memo != nil and not memo.empty?
            for i in 0..memo.size-1
                if memo[i] == "M"
                    user.mp += @mp_damage * memo[i+1].to_i
                end            
                if memo[i] == "D"
                    user.mp += @mp_damage / memo[i+1].to_i
                end
            end
        end
        #------------------------------------------------------------------
        # Custom Skill Effects End
        #------------------------------------------------------------------
    end
end


If you have any additional effects you would like to see them let me know. I'm still learning how to script myself so it would be a great deal of help.

[Show/Hide] Effects

Current Effects

Multiply (Deals more damage times a specified stat)
Gravity (Deals damage based on targets current hp)
Max Gravity (Deals damage based on targets max hp)
Desperation (Deals damage based on the attackers HP/MP. 4 Variations)
HP/MP Drain

Effects to be Added

Hunt (Deal more damage the lower the targets HP)
Variable Attack (Deals a random amount of damage set by the user)

Outstanding work! I am totally using this script, especially when Variable Attack comes out (1000 Needles, anyone? ;o)

Just a quick question, does can Gravity land the killing blow? Or is it cap at 1 HP?


__________________________
Jade Elegy Progress ;o
Go to the top of the page
 
+Quote Post
   
Twilight
post Sep 10 2008, 05:22 PM
Post #3


Real name, Lily White
Group Icon

Group: Revolutionary
Posts: 227
Type: Developer
RM Skill: Advanced




At the moment, it will kill the target. I can probably add something to do no damage when HP is dropped to one though
Go to the top of the page
 
+Quote Post
   
mudducky
post Sep 11 2008, 02:52 AM
Post #4


Level 19
Group Icon

Group: Revolutionary
Posts: 392
Type: None
RM Skill: Beginner




I haven't tested this out yet, but amusing it all works this is very impressive. smile.gif
Go to the top of the page
 
+Quote Post
   
lahandi
post Sep 15 2008, 09:40 PM
Post #5


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: Artist
RM Skill: Skilled




Nice script!

I have question and suggestion.

1. Is the effect could be applied as an enemy skill?
2. About Gravity and Max Gravity, will it ignore defense? I mean if the n=2 for Max Gravity, no matter how high is the target defense stat, the target will dead on 2 Max Gravity strike. Like that?
3. Could you make an effect that if the skill performed it will make the target HP = 1

Big thanks :)




__________________________
Go to the top of the page
 
+Quote Post
   
Znikomek
post Sep 16 2008, 12:30 PM
Post #6


Level 3
Group Icon

Group: Member
Posts: 36
Type: None
RM Skill: Undisclosed




Somebody works other skills other than gravity and max gravity?
Go to the top of the page
 
+Quote Post
   
RuGeaR1277
post Sep 16 2008, 10:51 PM
Post #7


Level 12
Group Icon

Group: Revolutionary
Posts: 213
Type: None
RM Skill: Beginner




anymore other effects you're planning on working on? sounds interesting! happy.gif


__________________________
(ALL TEMPORARY PAUSED)

Current Project


Last Updated on 27th Oct


Click to check it out! ^_^

Go to the top of the page
 
+Quote Post
   
Ashvir
post Sep 17 2008, 01:41 AM
Post #8


Level 4
Group Icon

Group: Member
Posts: 58
Type: Event Designer
RM Skill: Skilled




Is it just me or is Minus Strike not working? I've tried changing the value of n to ridiculously high numbers and I'm still not seeing an increase in damage when my character is low on HP.


__________________________


My current project: Lost Heaven (RPG Maker VX)
Demo: http://www.rpgrevolution.com/forums/?showtopic=12291
Go to the top of the page
 
+Quote Post
   
Twilight
post Sep 17 2008, 10:35 PM
Post #9


Real name, Lily White
Group Icon

Group: Revolutionary
Posts: 227
Type: Developer
RM Skill: Advanced




I'll check on it, rewriting the script to include a few more effects and changing how things are setup.
If all goes well Gravities coding will read from a percent so you don't have to do the math.
A skill can be tagged with mercy to leave them with a user set amount of HP/MP
and the Variance modifier will work better.

QUOTE
1. Is the effect could be applied as an enemy skill?
2. About Gravity and Max Gravity, will it ignore defense? I mean if the n=2 for Max Gravity, no matter how high is the target defense stat, the target will dead on 2 Max Gravity strike. Like that?
3. Could you make an effect that if the skill performed it will make the target HP = 1


1. It modifies the skill itself so if an enemy uses it on an actor it will have the same effect
2. Gravity ignores basic defenses but if I recall correctly, is still altered by element resistances
3. Sure thing, I will add it in the next update

Edit
Updated the script and change how a lot of the effects are setup. I will have a demo up soon
but everything should work right now

This post has been edited by Twilight: Sep 18 2008, 07:29 PM
Go to the top of the page
 
+Quote Post
   
Twilight
post Sep 19 2008, 09:02 AM
Post #10


Real name, Lily White
Group Icon

Group: Revolutionary
Posts: 227
Type: Developer
RM Skill: Advanced




Double post but, updated to 1.05 for those that were curious. Had to disable several of the effects
Go to the top of the page
 
+Quote Post
   
Ashvir
post Sep 19 2008, 10:52 AM
Post #11


Level 4
Group Icon

Group: Member
Posts: 58
Type: Event Designer
RM Skill: Skilled




Awesome, everything works fine from what I've tested.


__________________________


My current project: Lost Heaven (RPG Maker VX)
Demo: http://www.rpgrevolution.com/forums/?showtopic=12291
Go to the top of the page
 
+Quote Post
   
Twilight
post Sep 28 2008, 05:12 AM
Post #12


Real name, Lily White
Group Icon

Group: Revolutionary
Posts: 227
Type: Developer
RM Skill: Advanced




Yet another update! Mercy should work so you can tag it to any skill.
Rewrote how the skill effects are controlled to improve compatibility and make it simpler to setup
I removed a few effects that can be reimplemented by combining certain effects. Let me know if you need any other effects/help
EDIT
Forgot to add the stock break skill, coding this now
EDIT Take II
Fixed

This post has been edited by Twilight: Sep 28 2008, 05:26 AM
Go to the top of the page
 
+Quote Post
   
Knoll318
post Sep 28 2008, 05:53 AM
Post #13


Level 3
Group Icon

Group: Member
Posts: 30
Type: Event Designer
RM Skill: Skilled




Wow, this looks like a really nice script. I have got to use it.
Go to the top of the page
 
+Quote Post
   
Lyradia
post Oct 5 2008, 12:53 PM
Post #14



Group Icon

Group: Member
Posts: 2
Type: Event Designer
RM Skill: Beginner




I would like to use this script, but I have the problem not to know how (or where) I must insert my values in this script. And how do I have to connect a skill to a specified custom effect? I must apologize but I'm a beginner working on my first project happy.gif

I guess a little example where to insert the values and how to call the script in my game would be enuogh...

Being able to use the script would be awesome laugh.gif
Go to the top of the page
 
+Quote Post
   
Twilight
post Oct 6 2008, 11:02 AM
Post #15


Real name, Lily White
Group Icon

Group: Revolutionary
Posts: 227
Type: Developer
RM Skill: Advanced




Basically, in the notes field in the skills tab in your database, you place the tag you want to use.

For a skill thats based on your strength x3 you would use
<Str:User:300>

Hope that helps :3
Go to the top of the page
 
+Quote Post
   
icecold49
post Oct 6 2008, 02:53 PM
Post #16


My rmvx project is taking longer than I expected...
Group Icon

Group: Revolutionary
Posts: 116
Type: Developer
RM Skill: Advanced




Yo, this script is BOSS! This is useful for almost any project including my own. Thanks Twilight. smile.gif


__________________________
Go to the top of the page
 
+Quote Post
   
VileoSufora
post Oct 6 2008, 04:17 PM
Post #17


This is not Sparta! This is...What is this I don't even
Group Icon

Group: Revolutionary
Posts: 169
Type: Event Designer
RM Skill: Skilled




I like this, it seems useful. Much easier than using common events. Thanks!


__________________________
Formerly HotSpot6


Anime-Planet.com - anime | manga | reviews
~ ~ ~
Go to the top of the page
 
+Quote Post
   
Lyradia
post Oct 7 2008, 01:40 AM
Post #18



Group Icon

Group: Member
Posts: 2
Type: Event Designer
RM Skill: Beginner




Soooo easy O_O

Wow, it's a wonderful script, thank you!
Go to the top of the page
 
+Quote Post
   
Twilight
post Dec 22 2008, 01:54 PM
Post #19


Real name, Lily White
Group Icon

Group: Revolutionary
Posts: 227
Type: Developer
RM Skill: Advanced




Updated with new effects and several bug fixes
Go to the top of the page
 
+Quote Post
   
Genshyu
post Jan 5 2009, 05:07 PM
Post #20


Level 8
Group Icon

Group: Revolutionary
Posts: 118
Type: Scripter
RM Skill: Intermediate




This script is amazing, very nice work.


__________________________
My current Scripts.

[Show/Hide] Save / Load Scripts.



Things I am currently Learning:
RGSS2.
If you use a script you don't have to give credit :D I'm nice like that. However, if you wan't to give credit then Give Credit to Craig Ramsey.
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 12:42 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker