Regen Health on a Kill?

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Hey! Hopefully this should be a simple thing but I'm having trouble finding exactly what I'm looking for.

My game is kind of lighthearted with lots of characters from multiple franchises so you can create your dream team and all kinds of crazy combinations. My latest addition is Nightmare from the Soulcalibur games and I want him to have his iconic sword, Soul Edge, which consumes the souls of those he kills. What I want is for Nightmare to regen a small amount of HP whenever he KILLS an enemy, but ONLY when he kills one. I can't seem to replicate or find a way to accomplish this and I'm hoping I won't require a whole script for one small character trait but I'll use one if there's no other way.

Originally I thought of just having his basic attacks deal Absorb element or something but I don't really want him to restore HP every time he hits something. I'd rather it's just when he gets a kill and I'm thinking the amount of HP he restores should be a small percentage rather than being based off of how much damage he deals.

Is there a simple way to accomplish this?
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,520
Reaction score
1,655
First Language
English
Primarily Uses
RMMV
Have his attack inflict a state that resists knock-out. Then through common event, check if that enemy is at 0 HP + have the state inflicted. If yes, trigger the regen and afterwards remove the condition from all foes (so it won't persist).
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
I'm not 100% sure how to set that up. In Common Events, all I can really do is set a Conditional Branch but the only options for enemies are if they have appeared or not, or if they are inflicted with a certain status. There's seemingly no way to check HP from there.

Troop/Battle events can check HP and I can then do the state conditional from there to do something like what you mentioned, but I'd probably have to create an identical event page for every single enemy in the troop which would require a lot of copy pasting and it would make my troop events too cluttered since there could be 6 pages all for the same effect just on different enemies :/ Might end up being more trouble than it's worth. I'll give it a try though just to see if it works.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,520
Reaction score
1,655
First Language
English
Primarily Uses
RMMV
You'll have to set a variable to read the enemy's HP first, then set up a conditional branch to check if that variable's value is at 0.
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
That's a little over my head unfortunately :/ Variables aren't really my strong suit. My idea for in-battle events randomly worked one time but didn't any of the others either. I might just have to forget the idea for now and come back to it at a later date. Thanks for the help anyway :)

EDIT: Pinpointed my battle event issue. If Nightmare hits the enemy but doesn't kill it straight away, the state gets applied. If he then hits them again, it will die and he will gain health. If he kills it in one hit, however, the game doesn't bother applying the state at all so the enemy just dies and he gets no health.

EDIT #2: Might help if I told you how many battle event is setup.
If Goblin A Health equal or less than 0%
- If Goblin A inflicted with Soul Claim
- Nightmare +5 HP
- Remove State 'Soul Claim' from all enemies.
 
Last edited:

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,520
Reaction score
1,655
First Language
English
Primarily Uses
RMMV
That's a little over my head unfortunately :/ Variables aren't really my strong suit. My idea for in-battle events randomly worked one time but didn't any of the others either. I might just have to forget the idea for now and come back to it at a later date. Thanks for the help anyway :)
Alright, so what you want to do is, since knowing how variables is pretty important as a basic skill of RPG Making:
-Control variable: create a variable for each number of enemy (would be 8 variables total, since 8 is the max. of enemies you can put in an encounter). For each variable, set them to operand under game data > enemy > HP, for enemy 1 to 8.
-Make branches: for each enemy, make a branch that checks whether their HP variable is at 0, and if yes, if they're inflicted with the attack regen. state.
-Set regen.: If both conditions are met for a monster, make the heal effect trigger. Repeat this and the branches for all 8 enemies. At the bottom of the common event, set it to remove the state from all enemies, so they actually die if their HP is at 0.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
Could I suggest that you spend a short time going through this playable tutorial on switches and variables. Being interactive you will learn much quicker than watching or reading a tutorial. Switches and variables are essential elements of creating a game and spending a brief time on this now will save you a huge amount of time and frustration in the future.
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Thanks for the details, I think I've set up the Common Event right now. When called, it'll set all 8 enemies HP to the appropriate variables and then check all enemies HP and states and apply the heal if necessary and then at the bottom of the event I did the 'remove state' thing.

I'm just not sure how to actually CALL the Common Event now. I assumed it'd just be a Parallel Process but according to the tooltip those only work out of battle... lol.

Should I just make all regular attacks call the event? It shouldn't really mess with anything if other other characters trigger it right?

Thanks Kes :) I might check that out. I'm not totally new to variables but when it comes to more detailed stuff like this, I'm not usually able to see/plan all the steps I'll need to take to accomplish what I want, even though I don't doubt it's possible, so I get mad at myself and quit, lol :/

EDIT: told Attack to call the common event and it worked in the sense that it removed the states at the end, but it didn't do anything else (no regen) :(
EDIT 2: Ok regen DOES work, but only if Nightmare doesn't kill them in one hit...

It seems like the State isn't being applied before the Common Event is triggered, so if the enemy would take enough damage to die, they will just die instead of being applied with the state that makes them immune to dying.
 
Last edited:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
Once again, scripting is the best way to handle this. Given that you seem to want to make a lot of cool, specific effects, you should learn some basic Ruby and get a feel for how the flow of turns and actions go in VX Ace (most of this can be found in Scene_Battle, Game_Battler, Game_BattlerBase, and Game_Actor, with a little in Game_Action as well).

In Game_Battler, you'll find the following method:

Code:
def make_damage_value(user, item)
    value = item.damage.eval(user, self, $game_variables)
    value *= item_element_rate(user, item)
    value *= pdr if item.physical?
    value *= mdr if item.magical?
    value *= rec if item.damage.recover?
    value = apply_critical(value) if @result.critical
    value = apply_variance(value, item.damage.variance)
    value = apply_guard(value)
    @result.make_damage(value.to_i, item)
  end
You'll want to add a bit of extra behavior to the end of it. This could best be done using an alias for the method, but since you're new to code, you can just modify the method a bit:

Code:
def make_damage_value(user, item)
    value = item.damage.eval(user, self, $game_variables)
    value *= item_element_rate(user, item)
    value *= pdr if item.physical?
    value *= mdr if item.magical?
    value *= rec if item.damage.recover?
    value = apply_critical(value) if @result.critical
    value = apply_variance(value, item.damage.variance)
    value = apply_guard(value)
    @result.make_damage(value.to_i, item)
    if user.actor_id == N
      if self.hp <= 0
        user.hp += X
      end
    end
  end
Replace X with the amount of HP he should restore upon killing an enemy, and N with his Actor ID. Let me know if this doesn't work.
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Thanks a lot for trying to help ^_^

Sadly it did not work :( No error or anything, just no effect.
 

Lord Vectra

Master Eventer
Veteran
Joined
Dec 6, 2015
Messages
211
Reaction score
336
First Language
English
Primarily Uses
RMVXA
I have many skills like this. I just do the following:

if b.hp < [damage formula]; a.hp+=[heal amount]; else; [ what happens if they don't die]; end; [damage formula]
Note: Brackets are not needed.

If it exceeds the limit of the formula box, create a blank section in ur script editor (below materials and above main) and make the formula equal to something. For example...

SKF = "if b.hp < [damage formula]; a.hp+=[heal amount]; else; [if they don't die]; end; [damage formula]"
Note: Quotations must be there

Then, in the damage formula, just put:
eval(SKF)

You will also need to have variance equal to 0 for this to work. Hope this helps!
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
Thanks a lot for trying to help ^_^

Sadly it did not work :( No error or anything, just no effect.
I'll check both pieces of code I gave you in the next day or two (feel free to PM me this weekend if I forget). I think I know what's wrong with the Protect Girls ability, but I'm surprised this one isn't doing anything. I'll check myself and see what's up.
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Thanks a lot, I really appreciate it. I'll sit tight for a while and maybe take a little break from RPG Maker until then 'cause it's been stressing me out lately, lol. I'll drop you a message on Monday if I haven't heard from you.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,543
Members
137,834
Latest member
EverNoir
Top