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,178
Reaction score
1,878
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 Posts

Latest Profile Posts

Awright ya marshmallows! :kaopride: Here's a peek of what Alice's 8-bit Gothic gonna be like! EXPECT IT! (...in 2025?) :kaoswt:

alice_gothictiles.png
SF_People3_4 added!
index.php

Finds notes for an old side project... Oh, that's right, the two tracks that sounded really cool and gave inspiration for the big bad in that game... Spends day working on cutscene from old notes, looks okay, now lets slot in the first track... um... I did have those tracks??? It was a year or so ago but I did buy them didn't I?
CA9mtHJ.gif

Everything is really confusing for me

Forum statistics

Threads
118,584
Messages
1,117,141
Members
155,652
Latest member
zookelow
Top