RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Damage Cap and Damage Multiplier

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 73
Sad Egg
Damage Cap / Damage Multiplier
Version: 1.0b
Author: Ahnez67
Date: 07.7.2011

Version History


  • <Version 1.0> 07.07.2011 - Original Release
  • <Version 1.0> 11.09.2011 - V 1.0b

Planned Future Versions

  • None at all.

Description


(Damage Cap)

 This script allows you to set the max damage that one attack can cause.
 This works much like Final Fantasy, where attacks can't deal more than 9,999 damage.
 
 V1.0b

 Now, enemies and actors have separated Damage Caps.
Ex: You can make your party deal 99,999 damage, while enemies can't cause more than 9,999 damage.


(Skill Damage Formula)

 You can change the damage formula for Skills.
 Basically, it changes the "Attack F" and "Skill F" Formula.
 By default, Attack/Skill F works as multipliers based on character's Strength and Spirit.
 You can change the formula multiplier with the NEWATKF and NEWSKLF
 The formula works like this:
 -> Attack F divided by NEWATKF = Attack multiplier.
 -> Skill F divided by NEWSKLF = Attack multiplier.
 (And Sadly, Attack F and Skill F can't surpass 200...)

 Example:
 
 An skill has 100 Attack F and 200 Skill F
 The NEWATKF is 100 and NEWSKLF is 100
 
 Then, it will cause this damage:

 Attack F divided by NEWATKF => 100 / 100 = 1
 Skill F divided by NEWSKLF => 200 / 100 = 2

 Then, the skill attack power will be 1 Time the actor's Strength plus 2 times the actor's Spirit

Features

  • Damage Limit per Attack
  • Custom Damage Calculation

Screenshots

Not really applicable

Instructions

Place the Script above Main, but below the default Scripts
 Change the Damage Cap and the Enemy Damage Cap
 
 You can change the Damage Caps with this Script Call:

 DAMAGECAP::ABSCAP::DAMAGE_CAP = new damage cap
 DAMAGECAP::ABSCAP::ENEMYCAP = new enemies' Damage Cap

 And you can change the NEWATKF and NEWSKLF with this Script Calls:

 DAMAGECAP::ABSCAP::NEWATKF = new NEWATKF
 DAMAGECAP::ABSCAP::NEWSKLF = new NEWSKLF

Script


Code: [Select]
#------------------------------------------------------------------
#-----------------------AHNEZ67 DAMAGE CAP-------------------------
#-----------------------AHNEZ67 SKILL DMG FORMULA------------------
#------------------------------------------------------------------
#------------------------------------------------------------------
#-----Description (Damage Cap)-------------------------------------
#
# This script allows you to set the max damage that one attack can cause.
# This works much like Final Fantasy, where attacks can't deal more than 9,999
#damage.
#
# NEW: V1,0b
# You can set a Damage Cap for actors and a diferent Damage Cap for Enemies
#
#
#
#-----Description (Skill Damage Formula)
#
# You can change the damage formula for Skills.
# Basically, it changes the "Attack F" and "Skill F" Formula.
# By default, Attack/Skill F works as multipliers based on character's Strength
#and Spirit.
# You can change the formula multiplier with the NEWATKF and NEWSKLF
# The formula works like this:
# -> Attack F divided by NEWATKF = Attack multiplier.
# -> Skill F divided by NEWSKLF = Attack multiplier.
#
# Example:
#
# An skill has 100 Attack F and 200 Skill F
# The NEWATKF is 100 and NEWSKLF is 100
#
# Then, it will cause this damage:
#
# Attack F divided by NEWATKF => 100 / 100 = 1
# Skill F divided by NEWSKLF => 200 / 100 = 2
#
# Then, the skill attack power will be 1 Time the actor's Strength plus 2 times
#the actor's Spirit
#
# Sadly, Attack F and Skill F can't surpass 200...
#
#-----Instructions-------------------------------------------------
#
# Place the Script above Main, but below the default Scripts
# Change the Damage Cap
#
# You can change the Damage Cap with this Script Call:
#
# DAMAGECAP::ABSCAP::DAMAGE_CAP = new damage cap
# DAMAGECAP::ABSCAP::ENEMYCAP = new enemies' Damage Cap
#
# And you can change the NEWATKF and NEWSKLF with this Script Calls:
#
# DAMAGECAP::ABSCAP::NEWATKF = new NEWATKF
# DAMAGECAP::ABSCAP::NEWSKLF = new NEWSKLF
#
#


#CONFIGURATION \/ \/

module DAMAGECAP
  module ABSCAP
    DAMAGE_CAP = 9999 #Damage cap
    ENEMYCAP = 9999 #Damage cap for Enemies
    NEWATKF = 100 # Attack F multiplier
    NEWSKLF = 100 # Skill F multiplier
  end
end
#END OF THE CONFIGURATION /\ /\

class Game_battler
  def make_attack_damage_value(attacker)
    damage = attacker.atk * 4 - self.def * 2     
    damage = 0 if damage < 0                     
    damage *= elements_max_rate(attacker.element_set)
    damage /= 100
    if damage == 0                             
      damage = rand(2)                   
    elsif damage > 0                       
      @critical = (rand(100) < attacker.cri)     
      @critical = false if prevent_critical         
      damage *= 3 if @critical                   
    end
    damage = apply_variance(damage, 20)         
    damage = apply_guard(damage)                   
    damage = DAMAGECAP::ABSCAP::DAMAGE_CAP if damage > DAMAGECAP::ABSCAP::DAMAGE_CAP
    @hp_damage = damage                           
  end

  def make_obj_damage_value(user, obj)
    damage = obj.base_damage                     
    if damage > 0                               
      damage += user.atk * 4 * obj.atk_f / DAMAGECAP::ABSCAP::NEWATKF   
      damage += user.spi * 2 * obj.spi_f / DAMAGECAP::ABSCAP::NEWSKLF     
      unless obj.ignore_defense                   
        damage -= self.def * 2 * obj.atk_f / DAMAGECAP::ABSCAP::NEWATKF   
        damage -= self.spi * 1 * obj.spi_f / DAMAGECAP::ABSCAP::NEWSKLF   
      end
      damage = 0 if damage < 0                   
    elsif damage < 0                             
      damage -= user.atk * 4 * obj.atk_f / DAMAGECAP::ABSCAP::NEWATKF     
      damage -= user.spi * 2 * obj.spi_f / DAMAGECAP::ABSCAP::NEWSKLF     
    end
    damage *= elements_max_rate(obj.element_set)   
    damage /= 100
    damage = apply_variance(damage, obj.variance)   
    damage = apply_guard(damage)                   
    if obj.damage_to_mp 
      damage = DAMAGECAP::ABSCAP::DAMAGE_CAP if damage > DAMAGECAP::ABSCAP::DAMAGE_CAP
      @mp_damage = damage                           
    else
       damage = Damagecap::ABSCAP::MAXDMGCP if damage > Damagecap::ABSCAP::MAXDMGCP and user.is_a?(Game_Actor)
      damage = Damagecap::ABSCAP::ENEMYCAP if damage > Damagecap::ABSCAP::ENEMYCAP and user.is_a?(Game_Enemy)
      @hp_damage = damage                     
    end
  end
end

Credit


  • Ahnez67


Support


Post here if you encounter any problem with this script

Known Compatibility Issues

None know. Can be uncompatible with other custom damage formulas

Demo


There's no Demo version of this Script. It's not really necessary for such simple Script.

---------------------------------------------------------------------------------------
No credits needed. But it was made by me.
Commercial and non-Commercial games are all the same for me. You are free to use and edit it as you wish
« Last Edit: November 09, 2011, 04:15:14 PM by Ahnez67 »
Hello, i'm Japanese and my English is broken-

**
Rep: +0/-0Level 67
RPGVX Advanced (I Do Not Script Tough)
Sounds interesting, il give it a try
 ;8

**
Rep: +0/-0Level 73
Sad Egg
Version 1.0b

*You can set two different Damage Caps. One for Actors, and one for Enemies.
Hello, i'm Japanese and my English is broken-