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.
[GW] Special Damage

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 71
RMRK Junior
GW Special Damage
Version: 1.0
Author: Mr G W
Date: (DD/MM/YYYY) - 30/8/2011

Version History


  • <Version 1.0> 2011.8.30 - Original Release

Planned Future Versions
  • More features.

Description

Allows weapons to deal special damage to certain enemies.

Features

  • Allows creation of weaknesses and resistances independent to the enemy's elemental weaknesses.

Screenshots

None.

Instructions

Place where it says Materials. Use the note tags to apply the effects you want.

Script


Code: [Select]
=begin
==================================================================================================
==================================================================================================
Special Damage
Version 1.0
By Mr G W - Rmrk.net
Date (DD/MM/YYYY) - 30/8/2011

<Version 1.0> 2011.8.30 - Original Release

Allows weapons to deal more or less damage depending on the enemy, without
interfering with the elements. This is useful for making weaknesses.

Due to how the element system works, weapons/skills that have multiple elements,
the element with the highest damage is chosen, which may has his disadvantages.

Example:

Werewolf
Weakness: Slash, Silver

Knight
Resistant: Slash
Neutral: Silver

Warlord
Resistant: Slash
Immune: Silver

Following this example, a Silver Sword (Slash + Silver) would do extra damage to
the werewolf, but neutral damage to the Knight, despite his Slash resistance.
The warlord, would take the lowered damage due to his resistance to slash and
immunity to silver.

Now lets say you have a Silver Ray dealing only Silver damage.
It would do extra damage to the Werewolf, neutral to knight and no damage to
warlord.

Now lets say you want both the Silver Sword to deal extra damage
to Werewolf and reduced damage to the Knight and Warlord, while the Silver Ray
deals neutral damage to the Knight and the Warlord. You would need to play
around with the elements to achieve that.
With this script, this is much easier.

For items/skills.
<special: id dmg>
ID - The damage type identifier.
Dmg - The damage modifier. 100 = No change.

For enemies
<special: id>
ID - The damage type modifier. If it matches the actor weapon/skill/item, the
enemy's damage will be modified.

Example:
Holy Water - <special: 1 200>
Demon - <special: 1>

The demon takes 200% (double) damage from the Holy Water.

Use the <special> tag on a skill or item to inherit the from weapons.


==================================================================================================
==================================================================================================
Compatibility:
This script aliases make_attack_damage_value.
This script should work with other combat-related scripts unless they override
these methods and are placed below this script. If the overriding script
is placed above this one, then this script should work properly.
=end

$imported = {} if $imported == nil
$imported["GWSpecial"] = true

class Game_Battler
 
  alias gw_special_make_obj_damage_value make_obj_damage_value
  def make_obj_damage_value(user, obj)
    gw_special_make_obj_damage_value(user, obj)
    @hp_damage *= special_damage(user,0) if obj.skill_special == true
    @hp_damage /= 100 if obj.skill_special == true
    @hp_damage *= special_damage(user,1) if obj.skill_special == true
    @hp_damage /= 100 if obj.skill_special == true
    @hp_damage *= skill_special_damage(user,obj) if obj.skill_special == false
    @hp_damage /= 100 if obj.skill_special == false
  end
 
  def skill_special_damage(user, obj)
  multi = 100
  return multi unless user.actor?
  return multi unless obj.special[0] == enemy.special
  multi = obj.special[1]
  return multi
  end #Def
 
  alias gw_make_attack_damage_value make_attack_damage_value
  def make_attack_damage_value(attacker)
    gw_make_attack_damage_value(attacker)
    @hp_damage *= special_damage(attacker,0)
    @hp_damage /= 100
    @hp_damage *= special_damage(attacker,1)
    @hp_damage /= 100   
  end
 
  def special_damage(attacker, weapon)
  multi = 100
  return multi unless attacker.actor?
  return multi if attacker.weapons[weapon] == nil
  return multi unless attacker.weapons[weapon].special[0] == enemy.special
  multi = attacker.weapons[weapon].special[1]
  return multi
  end #Def
 
end #Class

class RPG::BaseItem
 
  def skill_special
    self.note.scan(/<special>/i){
    return true}
    return false
  end
 
  def special
    self.note[/<special: ([-0-9]+) ([-0-9]+)>/]
    return [$1.to_i, $2.to_i]
  end
end

class RPG::Enemy
 
  def special
    self.note[/<special: ([-0-9]+)>/]
    return $1.to_i
  end
end

You can also get it from the attachment.

Credit


  • Mr G W

Thanks

  • People who made scripts - I've been learning on my own, so other scripts help me understand how RGSS works.

Support

Just post here. If i don't answer, it's because I can't be on.
Any errors or glitches, feel free to post.

Known Compatibility Issues

This script aliases make_attack_damage_value.
This script should work with other combat-related scripts unless they override
these methods and are placed below this script. If the overriding script
is placed above this one, then this script should work properly.

Demo


None.

Author's Notes


Nothing to say for now.

Restrictions

For commercial use, contact me first. You can use this script how you want as long as you credit.
« Last Edit: August 30, 2011, 07:26:37 PM by Mr G W »

***
Rep:
Level 74
I'm baaack!
If I'm right, you can set weapons to deal more or less damage then they should to specified enemies?

**
Rep: +0/-0Level 71
RMRK Junior
Yes. Thats right.

Useful for enemy weakness like holy water against demons or silver weapons against werewolves without having to mess up around with elements.

***
Rep:
Level 74
I'm baaack!
That's awesome.