RMMV Using Yanfly Buff/States Core for "events" on death?

woootbm

Super Sand Legend
Veteran
Joined
Apr 26, 2014
Messages
233
Reaction score
161
First Language
English
Primarily Uses
RMMV
I might be going about this in a very roundabout way, so feel free to suggest alternative methods (ideally ways that don't require non-compatible plugins or great amounts of coding).

Basically my plan is to create a state using Buff/States Core (that is applied to all enemies automatically using another Yanfly plugin) that has a Custom Respond Effect. I think I know how to use this to respond when an enemy is hit with a specific element, but I need it to play specifically when that element kills an enemy (or maybe there's another way to categorize attacks since I will have much more elements than relevant methods of defeating an enemy).

The respond effect is that it adds XP to a specific party member. What I'm trying to do is make a system that keeps track of the player's combat methods. Using a "lethal" skill will give XP to a dummy PC that can level up. When it levels up, the player can access new things via events that check the level of that PC. There would also be "non-lethal" and "diplomacy" types of skills.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,214
Reaction score
1,902
First Language
English
Primarily Uses
RMMV
Sure. There's even a Yanfly Tips & Tricks for Auto-Life, so you can look at how to check for an attack that will defeat the battler.
 

woootbm

Super Sand Legend
Veteran
Joined
Apr 26, 2014
Messages
233
Reaction score
161
First Language
English
Primarily Uses
RMMV
Ah, that was a good starting point. Thanks! Piecing a few things together, I have this:

Code:
<Custom Deselect Effect>
var lethal = 1;
var nonlethal = 2;
var diplomacy = 3;
var violence = $gameActors.actor(4);
if (this.isHpEffect() && (target.hp <= 0 || target.isDead()) && this.item().damage.elementId === lethal) {
  target.startAnimation(49);
  var xp = target.mat;
  violence.gainExp(xp);
}
</Custom Deselect Effect>

I'm using the enemy's MAT since I think I'll not have to use every stat for my enemies. If I need extra variables, I'll figure that out later. The animation is just there so I can visually confirm this thing is triggering. I think I can manage the limiting of elements by using yanfly's multi-element mod (but the main element needs to be what's called in the code here).

The problem now is that this only seems to work if this actor is active in the party. Is there a way to affect actors who are not active in the fight here?

EDIT:
So I changed it a bit and went with variables.
Code:
<Custom Deselect Effect>
var lethal = 1;
var nonlethal = 2;
var diplomacy = 3;
var xp = target.mat;
var basexpa = $gameVariables.value(1);
var basexpb = $gameVariables.value(2);
var basexpc = $gameVariables.value(3);
if (this.isHpEffect() && (target.hp <= 0 || target.isDead()) && this.item().damage.elementId === lethal) {
  target.startAnimation(56);
  $gameVariables.setValue(1, basexpa +xp);
}
if (this.isHpEffect() && (target.hp <= 0 || target.isDead()) && this.item().damage.elementId === nonlethal) {
  target.startAnimation(54);
  $gameVariables.setValue(2, basexpb +xp);
}
if (this.isHpEffect() && (target.hp <= 0 || target.isDead()) && this.item().damage.elementId === diplomacy) {
  target.startAnimation(63);
  $gameVariables.setValue(3, basexpc +xp);
}
</Custom Deselect Effect>

And then I have my battles via events that look like this:
1639012365385.png
The variable change at the beginning wipes the slate clean, and after the battle is over I grant XP using the stored variable increases from the battle (since events can apply XP this way for some reason). This works for me because I don't use random encounters, but someone interested in those will need some kind of control over variables. Maybe a common event or something. Troop events?
 
Last edited:

Latest Threads

Latest Profile Posts

I don't want to brag or anything but I was entertaining a woman the other night. I told her jokes while she bandaged my foot.
Okay so, I'm using this script, right? And it works. If you press :Y a menu should come up allowing you to choose an item to use. Nothing happens. You press :A to open the event options menu and choose "Use an Item"? The item selection menu appears. I have no idea how I set this up or why it works the way it does. Absolutely bizarre.
A woman gave me her number without me even asking for it. Then she left because she had other patients to see.
oh, hey, I forgot about all this!

my old project got abandoned after I started working too much on stuff I'd already worked on - plus, starting to hate the story I wrote for it. Then, well, a lot of serious life **** went down. I ended up moving across the country, cutting off some people, etc. - **** was rough.

So, uh, I guess I'm back for now? Funny how things work.
I'm glad I'm sticking to my guns on having fighting game mechanics in my game, from what I've read, it's not for everyone. but for the most part, I've made it so you don't have to use them motion inputs for attacks if you don't want to.

Forum statistics

Threads
118,733
Messages
1,118,317
Members
155,884
Latest member
Xalenda
Top