Tsukihime

effect
Vampiric Weapon

19 posts in this topic

Effect: Vampiric Weapon

-Tsukihime

 

This script adds a "vampiric weapon" effect to a state.

When a battler has this effect, a percentage of damage inflicted to the target will be absorbed as HP.

 

Download

 

Script: Download here

Required: Effect Manager

 

Usage

 

Tag your state with

 

<eff: vampiric_weapon x>
Where x is the fraction of damage that should be converted.

For example, 0.5 would mean 50% of damage will be absorbed.

Edited by Tsukihime
KayDgirl91 and Wren like this

Share this post


Link to post
Share on other sites

well after modifying this to work as a weapon tag this is a nice code thank you for the share

 

Would you mind posting that fix? Or show it to Tsu so he/she can apply this fix in the code?

Share this post


Link to post
Share on other sites

here you go

 

 

=begin
#==============================================================================
** Effect: Vampiric Weapon
Author: Tsukihime
Date: Oct 8, 2012
------------------------------------------------------------------------------
** Change log
Oct 8, 2012
  - initial release
------------------------------------------------------------------------------  
** Terms of Use
* Free to use in commercial/non-commercial projects
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Preserve this header
------------------------------------------------------------------------------
Adds a "vampiric weapon" effect to your state.
When a battler has this effect, all attacks will drain HP equal to the damage,
offset by some amount.

Tag your state with
   <eff: vampiric_weapon x>

Where x is a percentage of the damage inflicted, as a float
eg: 0.5 means you will absorb 50% of damage dealt as HP.
#==============================================================================
=end
$imported = {} if $imported.nil?
$imported["Effect_VampiricWeapon"] = true
#==============================================================================
# ** Rest of the script
#==============================================================================
module Effect
 module Vampiric_Weapon
   Effect_Manager.register_effect(:vampiric_weapon)
 end
end
class Game_Battler < Game_BattlerBase

 def weapon_effect_vampiric_weapon(user, weapon, effect)
   return if user == self
   amount = [@result.hp_damage, @result.old_hp].min
   amount *= (eval(effect.value1[0]) rescue 1)
   user.hp = [user.hp + amount, user.mhp].min
   self.hp = [self.hp - amount, 0].max

   @result.effect_results.push("%s drained %d HP from %s" %[user.name, amount, self.name])
   @result.success = true
 end
end

 

 

Share this post


Link to post
Share on other sites

"Normal Attack" attribute that can be applied to skills to make them use the properties set on attack states and whatnot.

I was wondering on the same thing with your Iron/Thorn Armor script.

This is so that physical spells aren't counted as direct hits.

But because this is a personal preference, then I was thinking maybe you'd want to have a tag for skills to set them to work with Thorn Armor and Vampire Weapon.

'Cause maybe someone would like to have--

Body Slam: Tagged with Thorn Armor so that if you Body Slam an enemy you will get hurt by their Thorn Armor, but not tagged with Vampire Weapon because it's not a direct weapon skill (this might be someone's preference).

Powerful Slash: Tagged with Thorn Armor and Vampire Weapon because it's a direct weapon skill

Jagged Rock: Tagged with neither because it's a physical spell, not a direct attack nor a weapon skill.

 

although the "Normal Attack" attribute works for me. It's just a way of saying they're direct attacks. Heheh. So just wondering.

Edited by Audrey

Share this post


Link to post
Share on other sites

Hi, uhm, I'm fairly new to RPG Maker VX, and I'm not entirely sure on how to get this to work, I know that to tag something means to  put it in the notes box in the database, but do I put the tag in the notes on the weapons tab, or the state tab? Any and all help will be appreciated.

Share this post


Link to post
Share on other sites

Can't get this to work with Yanfly Battle engine + symphony + atb... I'm using Passive States script from Yanfly to add a state to one actor who is vampire. That state has exactly this in its notetag: <eff: vampiric_weapon 0.5> so everytime that actor attacks, it should heal 50% of the dmg done. But it does nothing. I can see the state icon so the state applies normally. I've also added <eff: vampiric_weapon 0.5> to the weapon the actor uses and it still does nothing.

 

I have tried having this script and the effect manager script above and below the battle engine scripts with no luck. Vampiric script is of course below Effect Manager.

Also tried with empty project with only Effect Manager and this script in it and nothing. Added skill that adds state to actor that has <eff: vampiric_weapon 0.5> in its notetag and attacked enemy after that state was applied. Again, the state icon showed up normally so the state was "On".

 

And yes, I've remembered to save before trying battle test.

 

EDIT: Think I'll go with this route of doing things http://forums.rpgmakerweb.com/index.php?/topic/15369-lifesteal/ but would still like to know why I can't get the script working even with blank project..

Edited by RaZzi

Share this post


Link to post
Share on other sites

I am not sure why it doesn't work for you in a blank project.

I created a state with that note-tag

<eff: vampiric_weapon 0.5>
added it to my actor on turn 2, and it restored HP whenever it hit the enemy after the state was applied.

I am not using any custom scripts besides effect manager and vampiric weapon.

 

You can upload the blank project if you want.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

 

I am not sure why it doesn't work for you in a blank project.

I created a state with that note-tag

<eff: vampiric_weapon 0.5>
added it to my actor on turn 2, and it restored HP whenever it hit the enemy after the state was applied.

I am not using any custom scripts besides effect manager and vampiric weapon.

 

You can upload the blank project if you want.

Got it to work. Did everything like last time and it worked. Can't really tell how but nvrmind. Good script.

Share this post


Link to post
Share on other sites

Hey, just wondering if this could easily be adapted to being applied to an actor. Like, their passive ability is that they restore damage dealt as HP all the time. Could I just take the notetag and put it onto the actor?

Share this post


Link to post
Share on other sites

This script was written as an "effect", and effects are only applied to skills or items.

You would need a different approach to achieve this kind of thing for an actor.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.