RPG Maker VX Ace

RPG Maker VX Ace

View Stats:
Cougarmint Sep 18, 2017 @ 8:04pm
Help With Scripting a Party-Wide Drain Skill?
I'm trying to create a script so that, when a certain skill is used, HP and/or MP is drained to not just the user, but the entire party as a result of that skill (I'm building a corrupted necromancer/healer character.)

I located this script in the Game_Battler:

def execute_damage(user)
on_damage(@result.hp_damage) if @result.hp_damage > 0
self.hp -= @result.hp_damage
self.mp -= @result.mp_damage
user.hp += @result.hp_drain
user.mp += @result.mp_drain
end

But all my attempts to change the "user.hp += @result.hp_drain" and add the conditional script check for the skill in question (77, in my case) have all caused script errors. How do I...

a) Check to see if the skill was actually used using ruby script
b) set it so that the entire party, not just the user, is healed?

Any help is appreciated.
Last edited by Cougarmint; Sep 18, 2017 @ 8:04pm
< >
Showing 1-4 of 4 comments
Kio Kurashi Sep 19, 2017 @ 12:16am 
iirc no such thing as "user" in the code. I suggest using
$game_party.battle_members.each do { Code blah blah for each party member. }
Note I may have fudged up the syntax so do your own research.
Cougarmint Sep 19, 2017 @ 12:30am 
Oh, the code I showed was the original code as per the game_battler class. I'm trying to modify that particular code.

How do I check if a skill was used? Is it the one you showed me?

And I've already tried researching it... I've spent about 2 days now googling my query and all that comes up is the "how to make a skill in the data base" crud I already know. -.-

UPDATE: After some messing around with the script I finally was able to get a working version of the HP drain to work for all party members when Actor 3 (my necromancer) has the skill learned:


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

All I need now is to change it so that instead of just knowing the skill, the necromancer actually uses it. I have looked all over the internet and I can't find a script call for the conditional branch if an actor uses a skill. Any ideas?
Last edited by Cougarmint; Sep 19, 2017 @ 2:32am
Kio Kurashi Sep 19, 2017 @ 11:29am 
Or what you could do is not change the default methods and script, but instead add your own that can be called from the formula which would solve that problem.
Cougarmint Sep 19, 2017 @ 1:37pm 
That's what I'm actually working on; I'm creating a plugin script.
< >
Showing 1-4 of 4 comments
Per page: 1530 50