# RMMVNeed Help Designing a Skill

#### Zanto1050

##### Regular
I'm using the Yanfly Engine in MV. The skill I'm wanting to design is for a Dark Knight type of class.

What I want the skill to do is damage the enemy by 1/4 their current health and restore the user by half the damage done. But the catch is, if the enemy is under 1/8 their max health it will kill the enemy and restore the user by all damage done.

I grasp how to damage the enemy by a percentage of its current HP and how to restore health to the user, but I don't know how to change the skill's effects based on how much HP the enemy has remaining. I'm still in the planning phase so I don't have any formula written yet. I'm using many of Yanfly's plugins concerning battle, I'm not sure which I'll actually need to pull this off tho. A plugin I know I'll need is Life Steal.

Does anyone know any formulae or notetags that'll help me achieve this?

#### Shaz

##### Keeper of the Nuts

I've moved this thread to Plugin Support. Thank you.

#### AphoticAmaranth

##### An Ordinary Human
You could use the following for the damage formula:

`b.hpRate() < 0.125 ? b.hp : Math.floor(b.hp * 0.25)`

What this basically means is "if target's hp rate is less that 12.5% (1/8), damage is equal to target's remaining hp (effectively killing them), else, damage is equal to 25% (1/4) of their remaining HP, rounded down". You can also use `Math.round` to round it to the nearest integer, or `Math.ceil` to round up the value.

As for the lifesteal, you don't exactly need the lifesteal plugin if you have the skill core, you could write it in the Pre-Damage Eval notetag.

JavaScript:
``````<Pre-Damage Eval>
target.hpRate() < 0.125 ? user.gainHp(value) : user.gainHp(Math.floor(value * 0.5))
</Pre-Damage Eval>``````

It's pretty much the same concept; before damage from the skill is applied, if target's hp rate was less than 1/8, user gains hp equal to the value of the damage that would be dealt, otherwise, user gains hp equal to half the value.

#### Zanto1050

##### Regular
Thanks @Shaz . I don't come here very often anymore and it's a bit confusing for me to find the right threads to post in.

@AphoticAmaranth , I'll give those formulae a try when I get the mechanics a little more developed. Hard to do it now cause I don't have all the skills listed in the database, much less set up to actually do anything. First chance I get to try it out I'll let you know if it works correctly. Looks like it would tho.

Another question. I want a class to either dual wield a weapon without a shield or equip one weapon and a shield. How would I go about that? Maybe I'm just missing something or don't understand the mechanics enough to set it up. There are other classes that can use the same shields but the weapon of choice is exclusive to this class.

#### ATT_Turan

##### Forewarner of the Black Wind
I want a class to either dual wield a weapon without a shield or equip one weapon and a shield. How would I go about that?
It should work automatically. When you hover over the Dual Wield equip slot, it says that it is at the sake of a shield.

#### Zanto1050

##### Regular
Ah, so make the class dual wield and add a slot for a shield? I just looked at the tooltip for Dual Wield and it gave me impression that it would remove the shield slot. I'm wanting to give the player the option to either equip two weapons or use a single weapon and a shield. Would it still work this way? I'm gonna set up some equipment and test this out.

#### AphoticAmaranth

##### An Ordinary Human
By default dual wield does remove your shield slot (or whatever slot is after 'weapon'). If you want to offer the player a choice the easiest way would probably be to use a plugin for that, such as Victor Engine's Dual Wield.

#### Zanto1050

##### Regular
By default dual wield does remove your shield slot (or whatever slot is after 'weapon'). If you want to offer the player a choice the easiest way would probably be to use a plugin for that, such as Victor Engine's Dual Wield.

That looks rather useful but I mainly use Yanfly and I'm afraid of conflicts. Is there a way to accomplish this using Yanfly plugins? I saw where the Equip Core can add more than one weapon slot to a class which bypasses dual wield and still allow a shield. But then I don't know how to restrict a shield if two weapons are equipped.

I may just forego giving this class a shield since its designated weapon also increases defense. I just thought it would add more options since the weapon increases attack while the shield offers protection from states and elements.

#### AphoticAmaranth

##### An Ordinary Human
As far as I'm aware Yanfly doesn't have any dual wield plugins. I guess if you want to only use yanfly's stuff, you could use class change and make a copy of the class, one with dual wield and one without. Or have the dual wield trait be on a state that can be applied or removed at will (With yanfly's state categories, you could have the state bypass death/recover all removal, and with skill core, you could have a skill run a check to see if the state is applied or not, and then apply/remove it accordingly)

#### ATT_Turan

##### Forewarner of the Black Wind
That looks rather useful but I mainly use Yanfly and I'm afraid of conflicts.
That's not a super necessary fear. Especially when you're talking about plugins that cost you nothing to download, install, and test.

The vast majority of plugins work just fine with each other - it's only when they're trying to modify the actual same thing that there's a conflict. And even then, adjusting their load order usually fixes it...and worst case scenario, you get a little code tweak to make it work.

It's not like finding two plugins have a conflict will blow up your computer

I use Yanfly, Victor, HimeWorks, Galv, and SRD stuff in my project (plus sundry others) and there's no problem.

#### AquaEcho

##### Script Kitty
In addition, most plugin devs will design around or accomodate Yanfly plugins since almost everyone uses at least some of them.

#### DrBuni

##### Regular
In addition, most plugin devs will design around or accomodate Yanfly plugins since almost everyone uses at least some of them.
But Victor Saint himself said his plugins don't play well with Yanfly's, so there is reason to fear conflict when it comes to his plugins.

#### ATT_Turan

##### Forewarner of the Black Wind
But Victor Saint himself said his plugins don't play well with Yanfly's, so there is reason to fear conflict when it comes to his plugins.
I still don't understand this "fear" thing.

The plugins are free. It takes a person, what, 30 seconds to download it, a minute or two to install and test it?

I don't see how it's worth multiple forum posts and looking for alternatives instead of just taking three minutes to try.

#### Zanto1050

##### Regular
As far as I'm aware Yanfly doesn't have any dual wield plugins.
While not exactly a dual wield plugin, there's this from his equip core:

Class Notetags:

<Equip Slot: x> Example: <Equip Slot: 1, 2, 3, 4, 5, 5, 5, 5>

<Equip Slot: x, x, x>

Changes this class's equipment slots to x. Using repeating numbers makes
it so that equipment type is duplicated and that the class can equip
multiple equipment of that type. To find the Equipment Type ID, go to your
database's Types tab and look for the ID type.

I can use this to give the class two weapon slots and a shield slot, but I'm at a loss on how to disable the shield slot when two weapons are equipped. Maybe add a passive state that checks if more than one weapons are equipped which will remove the shield and lock the slot?

I use Yanfly, Victor, HimeWorks, Galv, and SRD stuff in my project (plus sundry others) and there's no problem.
I actually do use a few other plugin creators as well, although I try to avoid any that require "core" plugins. My thought process is if it's a core then it alters important functions in the way the game works, therefor they would likely conflict with one another. However, I looked a little deeper into Victor and saw the required Basic Module doesn't change many functions. Instead it adds functions required for many of his plugins. Victor himself said he uses Yanfly with his plugins so I'll give that a try as well.

#### ATT_Turan

##### Forewarner of the Black Wind
I actually do use a few other plugin creators as well, although I try to avoid any that require "core" plugins. My thought process is if it's a core then it alters important functions in the way the game works, therefor they would likely conflict with one another.
That's generally an incorrect assumption. Yanfly's Core is the only one I know of off the top of my head that does that.

Every other author I can think of uses their core to store code they reuse and refer to across their plugins - so it would be a waste of space to put it into each individual plugin, they just say refer back to my core.

If you look at the description for most anyone's core, they tend to explicitly say "this changes nothing but is required for..."

#### Zanto1050

##### Regular
So most of the time core plugins are more of a database rather than altering the foundation, so to speak? Makes a lot of sense. I'll try not to be skittish when I find a plugin requires a core from now on and to do more research on them for incompatibilities before I shy away.

### Latest Profile Posts

I'm just gonna remove the Dark Spells from my game. They wouldn't be fighting Gods or Angels. So why have it?
Every day I'm getting rough-outs of another sprite sheet or two. Getting real close to just needing to make new original stuff and editing my tables and chairs to look correct for the taller sprites is among the top of the revisions list.

Some eyew guys! One is absent for... reasons of taste
Eeee! X3 Ever since I started doing 3d Art ,my Pixel Art got sooo much better! I cant wait till im done with the tileset!
Crystal Shock Devlog #5 yay!

This week was super fun as I got to work on my favorite thing: Combat! A new boss has been added and some new mechanics on top of that. I also made some improvements to the first town.