I've been working on a custom script for a couple of days now (I'm new to scripting, but not to RPG Maker) and I got something to work, but I've run into a couple of problems.
I have a character who is a sort of twisted healer/necromancer, who can drain life from his enemies to restore life to his entire party. So far, I've gotten the following to work:
----Begin Custom Script-----
class Game_Battler < Game_BattlerBase
def execute_damage(user)
on_damage(@result.hp_damage) if @result.hp_damage > 0
self.hp -= @result.hp_damage
self.mp -= @result.mp_damage
if $game_actors[3].skills.include?($data_skills[77])
$game_party.alive_members.each { |actor| actor.hp += @result.hp_drain }
else
user.hp += @result.hp_drain
end
user.mp += @result.mp_drain
end
end
-----End Custom Script-----
I know this particular script as it is now poses a major problem: Because Actor 3 (my necromancer) knows the skill, any time the life drain is used, even by an enemy, it restores health to the party regardless. What I'm struggling with, at this point, is what the ruby script call is for if my necromancer actually uses the skill rather than merely knowing it. I've been searching all over the internet for a couple of days and I can't seem to find an answer to that question.
Another tweak I'd like to make is that if a party member is inflicted with a certain state (ie KO), that member does not benefit from the life drain effect either. The reason for this is because I have a "custom death state" I'm using for a game over system I created using a combination of battle and common events, and I really don't want to have to mess with with the default Game Over script to fix what isn't broken, per se.
Any help on this would be much appreciated. Thank you for your time.
I have a character who is a sort of twisted healer/necromancer, who can drain life from his enemies to restore life to his entire party. So far, I've gotten the following to work:
----Begin Custom Script-----
class Game_Battler < Game_BattlerBase
def execute_damage(user)
on_damage(@result.hp_damage) if @result.hp_damage > 0
self.hp -= @result.hp_damage
self.mp -= @result.mp_damage
if $game_actors[3].skills.include?($data_skills[77])
$game_party.alive_members.each { |actor| actor.hp += @result.hp_drain }
else
user.hp += @result.hp_drain
end
user.mp += @result.mp_drain
end
end
-----End Custom Script-----
I know this particular script as it is now poses a major problem: Because Actor 3 (my necromancer) knows the skill, any time the life drain is used, even by an enemy, it restores health to the party regardless. What I'm struggling with, at this point, is what the ruby script call is for if my necromancer actually uses the skill rather than merely knowing it. I've been searching all over the internet for a couple of days and I can't seem to find an answer to that question.
Another tweak I'd like to make is that if a party member is inflicted with a certain state (ie KO), that member does not benefit from the life drain effect either. The reason for this is because I have a "custom death state" I'm using for a game over system I created using a combination of battle and common events, and I really don't want to have to mess with with the default Game Over script to fix what isn't broken, per se.
Any help on this would be much appreciated. Thank you for your time.