Effect: Reflect Damage

This script allows you to reflect a percentage of all damage received back to the attacker. The damage you actually take is the difference between the received damage and the reflected damage.

effect_reflectDamage1

Download

Script: download here
Required: Effects Manager

Installation

Place this script below Effects Manager and above Main

Usage

Tag effect objects with

<eff: reflect_damage x>
-----------------------
<eff: reflect_damage 0.3>

Where x is some percentage, as a float. The example notetag will reflect
30% of all damage taken.

You may also like...

11 Responses

  1. FreezeKirby says:

    Hello, Hime!

    This script is a natural wonder, but there is something I’d like to ask, related to what this script is about. I’ll try to summarize it in a few lines rather than just being obnoxiously long.

    I have a spell which applies a state on the caster, which does nothing by itself, but when physically attacked, the state is meant to reflect a part of the damage sustained back to the attacker. Is there any way to make the reflect apply only to physical attacks?

    • Hime says:

      If you would like to specify conditions for the effect, you can use this script: Conditional Effects.

      That script allows you to specify when the effect should occur. In your case, you would check
      whether the item/skill that’s being used on you is a “physical” attack.

      However, the exact formula you use would depend on what you define a “physical attack” to be.

      • FreezeKirby says:

        Hello again, Hime!

        I am sorry for the late reply-but after a bit of examination, I have come across a debate.

        If I am to use the Reflect Damage script in conjunction with the Conditional Effects script-How is it meant to work, in the following case?

        Case

        I have a Magic Spell that adds a state of the same name as the spell’s to the Caster, which is the one meant to Reflect a small amount of physical damage received back to the attacker. Now, currently, I have seventeen Physical Attack-based Skills, And here is a screenshot of one of them, to give you an idea of how they were constructed. (On a quick note, Yes, I am using Yanfly’s JP Manager and his Learn Skills Engine.)

        https://gyazo.com/3cdb5419e8c3c44c8bf63a77740ce872.png

        And then there is the State which is meant to Reflect Physical Damage.

        https://gyazo.com/3c8fbbd6bfde30d208ad1fece51840a8.png

        How exactly should I work with the two scripts?

        Also, thank you, and thank you so much for both of the scripts and the help! The amount of appreciation isn’t quantifiable, sadly. :C

  2. dii says:

    I have made a mistake i copy message from first error to the 2nd 😉
    In defoult setting Erroro should say

    Error:
    Script ‘Skill Links’ line 129:NoMethodError occured.
    undefined method `item’ for nil:NilClass
    ( original line=> item = @subject.current_action.item)

    • Hime says:

      When a battler dies, their actions are wiped out. The script didn't take into consideration what happens if the user dies. I've added some checks for this, but there may also be the case where one of the linked skills causes recoil that kills the user, but other linked skills are still executed.

  3. dii says:

    I am getting errors every time an enemy kill itself from reflected damage. The error seems to be from Skill links script but it only happens if the enemy dies from reflect dmg. Maybe you know this error and knew what should be changed to make the scripts ( reflect and skill links) work together. I was trying to fix it like you have suggested in recoil dmg skill:
    http://www.himeworks.com/2013/05/14/effect-recoil-damage/
    (I'm not and expert in scripting I just figure out, I need to do sth 🙂 )
    <i>
    Error:
    Script ‘Skill Links’ line 129:NoMethodError occured.
    undefined method `skill_links’ for nil:NilClass
    (original line=> item.skill_links.each do |link_item| )
    </i>
    (this occured when I changed in line~127 like in dmg recoil situation
    item = @subject.current_action.item
    to
    item = @subject.current_action && @subject.current_action.item)

    In defoult skill links setting
    <i>
    Error:
    Script ‘Skill Links’ line 129:NoMethodError occured.
    undefined method `skill_links’ for nil:NilClass
    ( original line=> item = @subject.current_action.item)
    </i>
    If you need additional information I will provide it 🙂 Otherwise great skill 🙂

  4. swebf says:

    Nevermind, I changed the position of the script to the bottom and it started working! nice script, btw

    • Tsukihime says:

      Make sure the script is below Effects Manager. There should not be any script overwriting issues I think since the stuff is unique, but I guess it’s possible someone had the same method name or something.

  5. swebf says:

    It is not working for me, I dont know exactly what the problem is, maybe the code is being overwritten by other scripts, it has no error message it simply does not reflect damage, I tried it on an equipment and enemy.

Leave a Reply

Your email address will not be published. Required fields are marked *