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

woootbm

Super Sand Legend
Veteran
Joined
Apr 26, 2014
Messages
399
Reaction score
385
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
7,614
Reaction score
5,370
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
399
Reaction score
385
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 Posts

Latest Profile Posts


New sprites in my project!
Updating my stream thumbnail collection here Streaming more game dev in 30 minutes or so. :LZSexcite:

Programming languages are amazing.

Someone needed help with a problem in C#. I've got 0 experience in C#. I read 0 lines of their code. I only knew what they wanted to do. I wrote a completely generic code in Javascript containing the generic answer. But they understood what I was doing and translated that to their code. 20 seconds later, problem solved.
been using ChatGPT to write a new story. I told it to :
generate a word like gundam for a false prophet super AI

it answered :
"NOVUS" as an acronym for "New Omnipotent Virtual Unit for Synthetics"? sounds similar to "gnosis," which is a term associated with knowledge and spiritual enlightenment, fitting the theme of a false prophet.


Five traps done, more on the way!
Stay tuned!

Forum statistics

Threads
129,806
Messages
1,205,360
Members
170,922
Latest member
mrsho
Top