Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,003
First Language
English
Primarily Uses
RMVXA
I am using Tsukihime's Effect Manager, which can be found here: http://dl.dropboxusercontent.com/u/23043573/RPG%20Maker/RMVXA%20Scripts/Effect_Manager.txt

One of the effects I have is for healing the whole party.  Unfortunately, it doesn't have a way of checking to see if the actors are alive or dead, and therefore gives dead character their share of the HP, in effect resurrecting them.  This is a nice effect, which I will use (with higher MP), but I would also like a vanilla healing effect.  Can someone tell me what to amend/insert in order for the effect to check if the actors are alive, and only apply healing to them?

This is the effect in question.  The def item section is written as it is because I am using Yanfly's Battle Engine Script which stores the HP in a different variable from the default script.  I don't think that tweak will affect my basic question.

Effect_Manager.register_effect:)drain_share, 2.0)class Game_Battler < Game_BattlerBasedef item_effect_drain_share(user, item, effect) drained = @result.instance_variable_get:)@stored_hp_drain) (user.friends_unit.members - [user]).each {|mem| mem.hp += drained mem.result.hp_drain = drained mem.make_damage_popups(mem) } endendThanks
 

Gambit

Villager
Member
Joined
Aug 26, 2012
Messages
12
Reaction score
3
Primarily Uses
You should be able to use the alive? method to check. So, something like this should work:

Code:
Effect_Manager.register_effect(:drain_share, 2.0)class Game_Battler < Game_BattlerBasedef item_effect_drain_share(user, item, effect)    drained = @result.instance_variable_get(:@stored_hp_drain)    (user.friends_unit.members - [user]).each {|mem|      next unless mem.alive?      mem.hp += drained      mem.result.hp_drain = drained      mem.make_damage_popups(mem)    }  endend
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,003
First Language
English
Primarily Uses
RMVXA
Thanks for this

If I have this as well as the original revive version, I get the following error message when I start the game

warning: idstring drain_share has already been reserved

the game then goes on to open in what seems to be the ordinary way.

Is this a problem?  If it is, do I do something simple like change :)drain_share, 2.0) to, say, :)heal_share, 2.0)?  But then does that mean that :)@stored_hp_drain) in line 5 also needs to be changed?
 

Gambit

Villager
Member
Joined
Aug 26, 2012
Messages
12
Reaction score
3
Primarily Uses
You don't need to change @stored_hp_drain but you do need to make two changes to both references of drain_share, the one you mentioned as well as another.

Find this line:

def item_effect_drain_share(user, item, effect)Change it to:

Code:
def item_effect_heal_share(user, item, effect)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,003
First Language
English
Primarily Uses
RMVXA
thank you.  That sorts out what to put as the tag in the skill note box as well.

This may take a bit of time to fully test, as I shall have to wait until one of my characters dies, but here's hoping!
 

Latest Threads

Latest Posts

Latest Profile Posts

Honestly, I cannot stop thinking about the whole elves vs anthros argument I had a while ago, because apparently I'm supposed to prefer what are usually elitist superhumans who "care about nature" but never actually do anything for it and live where nature is effectively stealing from nature over colorful, diverse and aesthetically entertaining animal designs because most people don't write well or care about looks.
7DcJlIG.png


Made a lot of progress on the tileset for the more sumptuous interior areas for the priory
I keep thinking up of new changes or improvements... Edit: Forgot to add the image Gimpwork.JPG

Forum statistics

Threads
117,301
Messages
1,106,331
Members
153,493
Latest member
1234ddfg
Top