# Yanfly's Skill Core Lunatic tags

#### gotnovicks

##### Veteran
Hi!

(sorry for my bad english btw)

I'm confused with how do I use the "Lunatic Mode" note tags in Skill Core plugin.

Basically, my skills absorbs damage but not the entire damage (so I don't want to use the innate function in formula box), only a % that increases according of users LUK. So here what I tried (the formula I used the way I'd use in the formula box):

<Post-Damage Eval>x = 25 + (a.luk / 5);y = (a.mat * 4) - (b.mdf * 2) j = y * (y/100)a.gainHP(j)</Post-Damage Eval>Post-damage implies the  skill succefully hit the target.

​X calculates the % of dmg absorved

Y is the dmg formula

J is the final calculation (transforms X in a %)

I saw a gainMP() in another topic, so I assumed that a gainHP() would work...

but this code didn't work. Any help? pls >:

Last edited by a moderator:

up...

#### kiriseo

##### Veteran
I haven't looked at Yanfly's Skill Core yet.

The first is:

Did you mistyped here?

Because you said:

J is the final calculation (transforms X in a %)

But there is no x in the calculation on the right side.

The second question:

Does the character, that uses this skill, have full health?

You won't get more health as his max hp.

#### Yanfly

##### ❤
<Post-Damage Eval>var x = 25 + (a.luk / 5);var y = (a.mat * 4) - (b.mdf * 2) var j = y * (y/100)a.gainHP(j)</Post-Damage Eval> Not sure what the "x" is doing there though. It's not being used in any of the equations.

Since you're making new variables, what you'd want to do is include a "var" in front of each one of them as such:

#### Kest

##### The Ecstasy of Gold
(Is this the general thread for discussing/sharing Lunatic setups in Yanfly Skill Core?)

I was trying to add a skill where the cost is based on the target's MP, but this doesnt seem possible in RMMV without a plugin:

What tags would I use to achieve this effect with YEP Skill Core?

#### kiriseo

##### Veteran
I was trying to add a skill where the cost is based on the target's MP, but this doesnt seem possible in RMMV without a plugin:

What tags would I use to achieve this effect with YEP Skill Core?
How exactly should the targets MP effect the skill cost?

Should it cost more when the target has low MP, or the other way round?

#### Kest

##### The Ecstasy of Gold
Lets suppose a skill costs 100 MP from the target - there is no cost for the caster.

If the target has less than 100 MP, the caster cannot use that skill on them.

Last edited by a moderator:

#### kiriseo

##### Veteran
Hmm... the closest to this I could do is this:

<Pre-Damage Eval>if(b.mp < 100) {b.result().missed = true;}</Pre-Damage Eval><After Eval>if(b.result().i****()) {b.setMp(b.mp - 100);}</After Eval>It will heal the target only if it has 100 or more MP and the target pays the cost.

Otherwise the heal will miss and nobody pays anything.

But I can't stop the skill to be cast regardless of it.

#### Kest

##### The Ecstasy of Gold
Works for now... I gave the skill a 2-turn cooldown. Thanks for the help!

I tried using the same trick for a skill that only hits enemies who are less than half health, but for some reason missing damages them anyways:

Lol?

Code:
``<Pre-Damage Eval>var x = b.mhp * .5;if(b.hp > x) {b.result().missed = true;}</Pre-Damage Eval>``

Last edited by a moderator:

#### kiriseo

##### Veteran
I have to look into this again.

What I gave you before isn't working as intended either.

It heals the target netherless

/EDIT:

I can't see how you could achieve this with the current state of the plugin.

Last edited by a moderator:

#### Kest

##### The Ecstasy of Gold
Maybe I didn't look closely enough - I could have sworn the one for healing was working... will have to check again later.

#### kiriseo

##### Veteran
Maybe I didn't look closely enough - I could have sworn the one for healing was working... will have to check again later.
It'll display "miss" and costs no MP but it heals the target.

The problem lies within the apply() function from MV.

I first thought of using <Pre-Damage Eval>.

But if I set missed to true in there, it doesn't work.

Because in the apply() function, the result gets reseted and set again.

And I can't do anything about it without changing the function itself.

And setting missed afterwards doesn't work either, because the damage is then already applied.

I had a almost working version, where the target would gain the lost HP after the damage step.

But the hp check wouldn't work as expected, because it would check the hp after the damage is done.

And this approach wouldn't work for healing.

'Cause if the healing spell restores more HP than the target has lost, he would have less HP afterwards.

/EDIT:

Okay, I have officially made my first plugin

Please try it and tell me if you find errors.

https://www.dropbox.com/s/ek5iqrbcbedb16j/Kiriseo_ZeroDamage.js?dl=0

To use it, place it below the YEP_SkillCore plugin.

I added a new eval notetag.

For your version of the heal spell I used:

And for your damage skill, this:

You just have to make sure to set zeroDamage to true if you don't want the skill effect taking place.

Last edited by a moderator:

#### Kest

##### The Ecstasy of Gold
Tested both of them, works great. Thanks again!

#### kiriseo

##### Veteran
Tested both of them, works great. Thanks again!
That's good to hear. ^^

I knew I had read something similiar before, but I completely forgot about the Damage Core plugin -.-'

#### Kest

##### The Ecstasy of Gold
Here's a code that deals X damage even if you miss with an attack.

Code:
``<After Eval>if(b.result().missed) { b.setHp(b.hp - x); }</After Eval>``

#### Kest

##### The Ecstasy of Gold
If you want to unlock the skill while State X is active:

<Custom Requirement>if (!user.isStateAffected(X)) { value = false; }</Custom Requirement>
And this removes State X from the attacker if he misses the target:

Code:
``<After Eval>if(b.result().missed) { a.removeState(X); }</After Eval>``

Last edited by a moderator:

#### Kest

##### The Ecstasy of Gold
class specific skills, for class change plugin:

Using Yanfly Skill Core, place in skill notetags:

<Custom Show Eval>if (a._classId === X) { visible = true; }else { visible = false; }</Custom Show Eval>Where X is number of class you want to use skill

if (a._classId === X || a._classId === Y) { visible = true; }For multiple classes, do like above

#### killerfer

##### Veteran
I'm trying to make a counter state, where if the actor is hit when he has such state, he counters with a skill. I figured I need to use the lunatic notetag

<Custom Respond Effect> code code</Custom Respond Effect>But I have no idea what I have to type for the actor to use the skill. Maybe someone can help me. If anyone know how to set a rate for it to work too it would be great (like 50% chance for the skill to be cast when the actor is hit)

#### killerfer

##### Veteran
Ok so I managed to do this:

<Custom Respond Effect> target.forceAction(57,1); BattleManager.forceAction(target);</Custom Respond Effect>Now if the battler have the state, every time he is attacked he counters with skill 57. The problem is, he loses his turn doing the action. I combined it with Instant Cast, but if the counter happens before the actor makes his selected action, he ignores it. If using ATB is worse because after the counter he resets his bar. I think this is bad because if I have a skill that needs to be charged, he probably will stop charging the skill after the counter. Any helps? Maybe someone achieved this by using a different method?

### Latest Profile Posts

You know, I sometimes ponder if working on the story and details is more necessary than the game itself. Its... technically work, just not direct.

Like for me specifically I never stop evolving the story based on what avenues I can approach in gameplay and then I get anxious thinking "hey good thing I thought about that now instead of later". Repeat ad nauseam.
World Of Final Fantasy Livestream~!
(Ft. Kaliga)
So my office building has 8 individually rented offices in it; 3 of which are social workers and 2 are marriage therapists... Unsurprisingly it always sound very angry out there. Glad I have my own private entrance.
I wonder if there's ever been an art challenge that involves drawing faces from the generator.
hmmmmm...