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

woootbm

Super Sand Legend
Veteran
Joined
Apr 26, 2014
Messages
257
Reaction score
182
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
4,122
Reaction score
2,519
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
257
Reaction score
182
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 Posts

Latest Profile Posts

Current status screens for Shadows of the Earth: The Vrila'an Legend. Need to do something about the color scheme lol
Captura de pantalla (259).pngCaptura de pantalla (260).png
My first serious victim in game hacking - Pawnbarian.
Diana Path 2.png
I love these two design wise lol... The high school principal and the captain of the women's wrestling team. they team up as bosses to save the school's accreditation.
Kanori24 wrote on TheRamenGirl's profile.
I love your profile pic. Definitely one of my favorite scenes from OPM :D

Forum statistics

Threads
122,074
Messages
1,146,309
Members
160,360
Latest member
bleach
Top