Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Custom Skill Algorithms

Custom Skill Algorithms
Version: 2.01

Introduction

This script more or less lets you add additional damage scopes to the skills

Features
  • Minus Strike (Damage based on Health Lost) and Life Strike (Damage based on maximum health)
  • Damage based on a percentage of Attack, Defense, Spirit, and Agility, Evasion, and Hit Rate
  • Modified Healing Effects
  • More unnamed effects like Gravity

Screenshots

Can screenshots really be of use for this type of script?
Demo

No demo as of yet, I'll upload one in a bit

Script

Code:
#===========================================================================

# ** Custom Skill Effects

#---------------------------------------------------------------------------

#  By Twilight aka Adalwulf

#---------------------------------------------------------------------------

#  03/17/08

# Version 2.01

#   Additional Healing Effects

# 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

#----------------------------------

# Skill Scope Setup Descriptions

#----------------------------------

 

1. Parameter Effects

   

  Note Code

   <Parameter:Scope:Effect>

   

   Scopes

   * HP/MP

    1. [Current]  Deals damage based on current HP/MP

    2. [Max]      Deals damage based on Max HP/MP - Current HP/MP

    3. [Absorb]   Absorbs damage dealt into HP/MP

    

    * ATK/DEF/SPI/AGI/HIT/EVA

    1. [Actor]    Deals damage based on the characters parameter

    2. [Target]   Deals damage based on the enemies parameter    

    3. *Not Implemented* [Weapon] Deals damage based on the weapons parameter

    4. *Not Implemented* [Armor] Deals damage based on the armors parameter

#=======================================================================

2. Healing

  Note Code

  <Healing:Scope:Effect>

  Example

  <Healing:MAXHP:50>

    Heals based on half the users Maximum HP

  

  Scopes

  1.  White Wind Effect      

      [HP/MAXHP] or [MP/MAXMP]

        Heals based on a percentage of users...

        A. HP/MAXHP

        B. MP/MAXMP

        

      [T-HP/T-MAXHP] or [T-MP/T-MAXMP]

        Heals based on a percentage of targets...

        A. HP/MAXHP

        B. MP/MAXMP

 

  2.  Variable Effect

      [VAR]

        Heals Based on Variable ID

 

  3.  Parameter Effect

      [ATK/DEF/SPI/AGI/HIT/EVA]

        Heals based on a percentage of users...

        A. Attack

        B. Defense

        C. Spirit

        D. Agility

        E. Hit Rate

        F. Evasion

 

      [T-ATK/T-DEF/T-SPI/T-AGI/T-HIT/T-EVA]

        Heals based on a percentage of targets...

        A. Attack

        B. Defense

        C. Spirit

        D. Agility

        E. Hit Rate

        F. Evasion

 

#=======================================================================

3. State (Untested)

  Note Code

  <State:State_ID:Multiplier>

  1. State_ID = ID in the Database the enemy must be inflicted with

  2. Multiplier is the amount the damage is multiplied by

#=======================================================================  

4. Gold

  Note Code

  <GP:Multiplier>

  Damage is based on gold multiplier

#=======================================================================

5. Mercy

  Note Code

  <Mercy:Value>

  Leaves the target with the HP Set in value if the skill would normally kill

#=======================================================================

6. Plus

  Note Code

  <Plus:Amount>

  Adds specified damage to the attack.

  Can be used for skills like 1000 Needles.

#=======================================================================

7. Minus

  Note Code

  <Minus:HP>

  Reduces specified damage to the attack.

  Included just because~

#=======================================================================

8. Gravity

  Note Code

  <Gravity:Scope:Amount>

  

  Scopes

  [Current-HP] Damage% based on Current HP

  [Current-MP] Damage% based on Current MP

  [Max-HP]     Damage% based on Max HP

  [Max-MP]     Damage% based on Max HP

#=======================================================================

9. Reduce

  Note Code

  <Reduce:Scope:Amount>

  

  Scopes

  [HP]    Reduces HP to Amount

  [MP]    Reduces MP to Amount

#=======================================================================  

10. Variable Effect

  Note Code

  <Variable:Variable_ID>

  Variable_ID is the variable in the database.

  

  NOTE: Be sure to initiate the variable before using the skill or else

  it won't work

#=======================================================================

=end

#---------------------------------------------------------------------------

# Start Custom Skill Effects Part A - Damage Algorithms

#---------------------------------------------------------------------------

class Game_Battler

  #=========================

  # Initial Word Setup Start

  #=========================

  

  #------------------

  # Parameter Effects

  #------------------

  CSE_HP         = "HP"

  CSE_MP         = "MP"

  CSE_ATK        = "ATK"

  CSE_DEF        = "DEF"

  CSE_SPI        = "SPI"

  CSE_AGI        = "AGI"

  CSE_HIT        = "HIT"

  CSE_EVA        = "EVA"  

  

  #------------------

  # Healing Effects

  #------------------

  CSE_HEAL      = "Healing"

  

  #------------------

  # State Effects

  #------------------

  CSE_STATE      = "State"

  

  #------------------

  # Special Effects

  #------------------

  CSE_GOLD       = "GP"

  CSE_MERCY      = "Mercy"

  CSE_PLUS       = "Plus"  

  CSE_MINUS      = "Minus"  

  CSE_GRAVITY    = "Gravity"

  CSE_REDUCE     = "Reduce"

  CSE_VARIABLE   = "Variable"  

  #=========================

  # Initial Word Setup End

  #=========================

  #------------------------------------------------------------------

  # Custom Skill Effects Start

  #------------------------------------------------------------------

  alias adalwulf_damage_effects_make_obj_damage_value make_obj_damage_value

  def make_obj_damage_value(user, obj)

    adalwulf_damage_effects_make_obj_damage_value(user, obj)

    damage = obj.base_damage

    if damage > 0

    #------------------------------------------------------------------

    # HP Based Damage

    # ** CSE001

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_HP}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Current"

          damage +=  (user.hp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Max"

          damage +=  (user.maxhp - user.hp) * (memo[i+1].to_f / 100).to_int

        end

        if memo[i] == "Absorb"

          user.hp +=  damage * (memo[i+1].to_f / 100).to_int

        end

      end

    end

 

    #------------------------------------------------------------------

    # MP Based Damage

    # ** CSE002

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_MP}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Current"

          damage +=  (user.mp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Max"

          damage +=  (user.maxmp - user.mp) * (memo[i+1].to_f / 100).to_int

        end        

        if memo[i] == "Absorb"

          user.mp +=  damage * (memo[i+1].to_f / 100).to_int

        end

      end

    end

 

    #------------------------------------------------------------------

    # Attack Based Damage

    # ** CSE003

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_ATK}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Actor"

          damage +=  (user.atk * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Target"

          damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

        end

#~         if memo[i] == "Weapon"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

#~         if memo[i] == "Armor"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

      end

    end

 

    #------------------------------------------------------------------

    # Defense Based Damage

    # ** CSE004

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_DEF}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Actor"

          damage +=  (user.def * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Target"

          damage +=  (self.def * (memo[i+1].to_f / 100)).to_int

        end

#~         if memo[i] == "Weapon"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

#~         if memo[i] == "Armor"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

      end

    end

    #------------------------------------------------------------------

    # Spirit Based Damage

    # ** CSE005

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_SPI}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Actor"

          damage +=  (user.spi * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Target"

          damage +=  (self.spi * (memo[i+1].to_f / 100)).to_int

        end

#~         if memo[i] == "Weapon"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

#~         if memo[i] == "Armor"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

      end

    end

 

    #------------------------------------------------------------------

    # Agility Based Damage

    # ** CSE006

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_AGI}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Actor"

          damage +=  (user.agi * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Target"

          damage +=  (self.agi * (memo[i+1].to_f / 100)).to_int

        end

#~         if memo[i] == "Weapon"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

#~         if memo[i] == "Armor"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

      end

    end

 

    #------------------------------------------------------------------

    # Hit Rate Based Damage

    # ** CSE007

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_HIT}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Actor"

          damage +=  (user.hit * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Target"

          damage +=  (self.hit * (memo[i+1].to_f / 100)).to_int

        end

#~         if memo[i] == "Weapon"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

#~         if memo[i] == "Armor"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

      end

    end

 

    #------------------------------------------------------------------

    # Evasion Based Damage

    # ** CSE008

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_EVA}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Actor"

          damage +=  (user.eva * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Target"

          damage +=  (self.eva * (memo[i+1].to_f / 100)).to_int

        end

#~         if memo[i] == "Weapon"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

#~         if memo[i] == "Armor"

#~           damage +=  (self.atk * (memo[i+1].to_f / 100)).to_int

#~         end

      end

    end

    

    #------------------------------------------------------------------

    # Heal Skill Effect

    # ** CSE009

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_HEAL}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        #=======================================================

        # Variable Based Healing

        #=======================================================

        if memo[i] == "VAR"

          damage -=  $game_variables[memo[i+1].to_i]

        end

        #=======================================================

        # User Based Healing

        #=======================================================

        if memo[i] == "ATK"

          damage -=  (user.atk * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "DEF"

          damage -=  (user.def * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "SPI"

          damage -=  (user.spi * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "AGI"

          damage -=  (user.agi * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "HIT"

          damage -=  (user.hit * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "EVA"

          damage -=  (user.eva * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "HP"

          damage -=  (user.hp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "MP"

          damage -=  (user.mp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "MAXHP"

          damage -=  (user.maxhp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "MAXMP"

          damage -=  (user.maxmp * (memo[i+1].to_f / 100)).to_int

        end

        #=======================================================

        # Target Based Healing

        #=======================================================

        if memo[i] == "T-ATK"

          damage -=  (self.atk * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-DEF"

          damage -=  (self.def * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-SPI"

          damage -=  (self.spi * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-AGI"

          damage -=  (self.agi * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-HIT"

          damage -=  (self.hit * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-EVA"

          damage -=  (self.eva * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-HP"

          damage -=  (self.hp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-MP"

          damage -=  (self.mp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-MAXHP"

          damage -=  (self.maxhp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "T-MAXMP"

          damage -=  (self.maxmp * (memo[i+1].to_f / 100)).to_int

        end

      end

    end

 

    #------------------------------------------------------------------

    # State Based Damage

    # ** CSE010

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_STATE}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if self.state_id[memo[i]]

          damage += (memo[i+1].to_f / 100).to_int

        end

      end

    end

    

    #------------------------------------------------------------------

    # Gold Based Damage

    # ** CSE011

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_GOLD}:(\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

    

    #------------------------------------------------------------------

    # Mercy Effect

    # ** CSE012

    #------------------------------------------------------------------

    memo = obj.note.scan(/<#{CSE_MERCY}:(\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

    

    #------------------------------------------------------------------

    # Plus Effect

    # ** CSE013

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_PLUS}:(\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

    

    #------------------------------------------------------------------

    # Minus Effect

    # ** CSE014

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_MINUS}:(\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

 

    #------------------------------------------------------------------

    # Gravity Effect

    # ** CSE015

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_GRAVITY}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty?

      for i in 0..memo.size-1

        if memo[i] == "Current-HP"

          damage += (self.hp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "Current-MP"

          damage += (self.mp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "MAX-HP"

          damage += (self.maxhp * (memo[i+1].to_f / 100)).to_int

        end

        if memo[i] == "MAX-MP"

          damage += (self.maxmp * (memo[i+1].to_f / 100)).to_int

        end

      end

    end

 

    #------------------------------------------------------------------

    # Reduce Effect

    # ** CSE016

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_REDUCE}:(\S+):(\S+)>/)

    memo = memo.flatten

    if memo != nil and not memo.empty? 

      for i in 0..memo.size-1

        if memo[i] == "HP"

          damage += self.maxhp - memo[i+1].to_i

        end

        if memo[i] == "MP"

          damage += self.maxmp - memo[i+1].to_i

        end

      end

    end

 

    #------------------------------------------------------------------

    # Variable Effect

    # ** CSE017

    #------------------------------------------------------------------

 

    memo = obj.note.scan(/<#{CSE_VARIABLE}:(\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

    #------------------------------------------------------------------

    # Damage Algorithm Mod - Set to Default Algorithms

    #------------------------------------------------------------------

     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

 


Instructions

This script aliases make_obj_damage_value.
Unless you changed the overall damage algorithms, the last part of the script still follows the default VX Damage algorithms.
The setup for each effect is in the script itself so read the notes in it's entirety before asking questions, PS Each effect is setup in the notes field.
FAQ

None as of yet

Compatibility

There should be any compatibility issues with anything, It even works with Tankentai :eek:
Credits and Thanks

The original base of this script and the core usage of the notes field was borrowed from Space Not Far
Trickster and Diedrupo also had a hand in this script's development so give them some thanks as well.

Author's Notes

Since I will be a bit more active in the forums I figured I would go ahead and upload this script
Even though variable based damage does damage based on a variable, the variable will probably have to run as a parallel process in common events
for it to take effect at all times.
A quick note, despite it's custom algorithm you still need to have a base damage of 1 or more or the skill will not work.

Terms and Conditions

Not terms or conditions, just give credit for it. It's fairly simple.
 

Daphoa

Member

Great concept, but first of all, most people need examples (but I did get the part about you soon uploading one)

Secondly, the game doesn't run properly on this script alone. (Error below) Do you have a working project with this script? Are you depending on any custom scripts?

Error: line 162: NameError occurred
undefined method 'make_obj_damage_value' for class 'Game_Battlers'

lol, i just basically said everything wizeman said. Well, I hope mine was more helpful.
 
The script works fine without additional scripts. The only thing I can think of thats causing an issue is another script that alters the battle system.
EDIT: Small update that expands on the Healing Effects.
 
Well, I like these pack of effects, first of all, thanks for your work.

I have some requests: [Some aren't algorithms, but complex scripts...]

Draining Effects, to HP and MP
LV Math spells, like lv death, lv 4 flare, lv 3 confuse, etc
Annoying, if player x its infected with this effect, the damage is shared with the teamates.
Doom [Countdown to doom], in n turns the character receives an a automatic death
Petrify, same as doom, but stones the target
Control monsters
Burn, if player move, receives an automatic death
Zombie, if player cure or be cured, causes damage instead healing
*Meltdown, the defense base value goes to 0
*Cursed, the spirit base value, goes to 0
Charge attack, holds player attack to n turns and multiplies in the base value

I have much more, but thanks for now ;)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top