YEP's Buffs & States Core state custom effect help

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
264
Reaction score
65
First Language
English
Hi all,

I'm looking to create a state, presumably using Lunatic Mode in YEP's Buffs & States Core that inflicts elemental damage during the HP regeneration window of each turn. Disclaimer: I don't know / understand javascript, but I try to and figure it out as much as possible.

The formula I want the damage to use is - in layman's terms:

5% of affected actor's Total HP = Value of elemental damage to inflict. However, once that initial value is determined, I want that to be treated as if it were an incoming attack of that element, so that the actor's resistance, or lack thereof, will change the amount of damage they receive.

The second part of this state, is that I want this same effect to occur to the actors in the slots adjacent to this actor. So if the actor was in slot 2, I would want this effect to occur on the actors in slots 1 and 3, even though they actually aren't afflicted by the state themselves.

Thanks for any help you can give me.

EDIT: I think it's worth mentioning I'd like an animation to play at the point where the damage occurs too, just to call attention to itself.

EDIT AGAIN: It's also worth mentioning that I'll need variants of this type that deal damage to all party members, as opposed to just those next to the afflicted actor.
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,547
Reaction score
1,024
First Language
EN
Primarily Uses
RMMV
For damage to neighbouring members, you could try:
Code:
<Custom Regenerate Effect>
var animId = 59;    // animation ID
var elemId = 6;     // damage element ID
var ix = user.index();
var allies = user.friendsUnit().members();
[ix-1, ix, ix+1].forEach(function(n) {
  var ally = allies[n];
  if (ally && ally.isAlive()) {
    var dmg = ally.mhp * 0.05; // 5% max HP
    dmg *= ally.elementRate(elemId);
    ally.startAnimation(animId);
    ally.gainHp(-Math.round(dmg));
    ally.startDamagePopup();
    ally.clearResult();
  }
});
</Custom Regenerate Effect>
For damage to all (living) allies, maybe something like this instead:
Code:
<Custom Regenerate Effect>
var animId = 59;    // animation ID
var elemId = 6;     // damage element ID
var allies = user.friendsUnit().aliveMembers();
allies.forEach(function(ally) {
  var dmg = ally.mhp * 0.05; // 5% max HP
  dmg *= ally.elementRate(elemId);
  ally.startAnimation(animId);
  ally.gainHp(-Math.round(dmg));
  ally.startDamagePopup();
  ally.clearResult();
});
</Custom Regenerate Effect>
Just edit the values on the "// commented" lines as appropriate~ :kaothx:

After a brief test, I'd suggest using Yanfly's Battle Engine Core plugin to make the damage numbers show up. :kaoslp:

(Also, if by "total" HP you meant "current" HP, just replace mhp with hp. :kaoswt:)
 

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
264
Reaction score
65
First Language
English
Thanks so much for this @caethyril !

I'm having some trouble getting it to work, but I think that may be due to other plugins I am using. Once I figure that out, I'll test it right away!
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,547
Reaction score
1,024
First Language
EN
Primarily Uses
RMMV
Since you mention Yanfly's plugins, maybe double-check you have them up-to-date and in the recommended order in the Plugin Manager. Recommended order can be found here: http://yanfly.moe/yep/

Hope it works out! :kaothx:
 

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

Latest Threads

Latest Posts

Latest Profile Posts

The video of a psycho chasing people on the streets with a sword before getting subdued is wild. Apparent screenshots of his Twitter feed before it went private reveal a dangerous delusional mindset. I heard there was a bow person too. The crazies are really coming out of the woodworks.
Stream will be live shortly with some Witcher 3, followed by a session of the Interactive Text Adventure! Feel free to drop by!
Managed to find a way to hang a bed cover over my window. So no more being toasted alive in the afternoon!:kaoswt2:
So, uh, has anyone tried buying any resources from KokoroReflections? Because I've been looking for a 'buy' button on the site for like 10 minutes now and can't find one.
Any also thought it's too cringy to put the word "and you" in your credit as a special thanks?
Cause that's what I thought...

Forum statistics

Threads
97,993
Messages
948,397
Members
129,254
Latest member
Swiftz
Top