Increase item effectiveness for a specific class

Hi everyone.
Don't know if this answer is already out there somewhere, but figured I'd ask anyways. Is there a way with or without a plugin to increase the effectiveness of items for a specific class. In this case I also am using a plugin called Ryuk_AddItemType. Is it possible to increase the effectiveness of a new item type specified in this plugin for a specific class?

The link for the plugin I specified is below:

Thanks for your time and as always any help is appreciated!
~ V
What are you wanting the item to do? Heal HP? Recover MP? Boost a state/stat?

If it's a HP recovery item, you can assign the SP-Parameter to that class and select Pharmacology. If that's not it... can you give more detail as to what the item is supposed to do?

1675123198660.png
What are you wanting the item to do? Heal HP? Recover MP? Boost a state/stat?

If it's a HP recovery item, you can assign the SP-Parameter to that class and select Pharmacology. If that's not it... can you give more detail as to what the item is supposed to do?

View attachment 252014
There are multiple items all categorized as Hidden Item A as well as <slot1> for the other plugin. They all do a range of different things from healing to dealing elemental damage ect. I needed to find out if there was a way to increase the effectiveness of all items of this specific type for a particular class most likely through the use of a skill or state.
This shows you how to incorporate conditionals into your damage formulae, as well as the functions to check for which class, having a state, etc.

This shows you how to incorporate conditionals into your damage formulae, as well as the functions to check for which class, having a state, etc.

Ok tyvm. ^_^
This shows you how to incorporate conditionals into your damage formulae, as well as the functions to check for which class, having a state, etc.

Ty for the link, but I am still very confused. I can't tell where to input the damage formula to increase the output of the items ability specific to the class. It said something about the actors but I couldn't find the part on items or class. Sorry still trying to learn everything. Still a noob.
Just to mention it, we're not supposed to double post. If you need to add something and no one else has replied, you can click the Edit button.

I can't tell where to input the damage formula to increase the output of the items ability specific to the class. It said something about the actors but I couldn't find the part on items or class.
I'm not sure if I'm correctly understanding your question. If you press Ctrl+F and search the page for the word "class" you get:
Screenshot 2023-01-30 205632.jpg

Then you insert that into the instructions above to create a ternary expression with two possibilities for an outcome.

So if your potion should heal 50 points for most people, but 100 points if used by an alchemist (class 13), you would type into the damage formula:
Code:
a.isClass($dataClasses[13]) ? 100 : 50

I'm not sure what "the part on items" means...if that doesn't answer your question, please specify what you're confused about and maybe provide a screenshot of what you've made so far that doesn't work the way you want.
Just to mention it, we're not supposed to double post. If you need to add something and no one else has replied, you can click the Edit button.


I'm not sure if I'm correctly understanding your question. If you press Ctrl+F and search the page for the word "class" you get:
View attachment 252022

Then you insert that into the instructions above to create a ternary expression with two possibilities for an outcome.

So if your potion should heal 50 points for most people, but 100 points if used by an alchemist (class 13), you would type into the damage formula:
Code:
a.isClass($dataClasses[13]) ? 100 : 50

I'm not sure what "the part on items" means...if that doesn't answer your question, please specify what you're confused about and maybe provide a screenshot of what you've made so far that doesn't work the way you want.
Ah ok thank you didn't realize about the double posting. So working on a formula for a damage dealing item that is suppose to deal more damage when used by Class 1 but it needs to also be able to check if the enemy is fighting solo or not and if so deal more damage to the solo enemy than if it were dealing to a group. Current damage formula below, yes I know it is incomplete:

a.isClass($dataClasses[1]) ? 100 + a.mat * 5 - b.mdf : 100 + a.mat * 2 - b.mdf
So it has a target scope of all enemies, but you want it to do more if "all enemies" is just one?

You can get the number of enemies with $gameTroop.aliveMembers().length

Thus, checking whether there's only one enemy would be:
Code:
$gameTroop.aliveMembers().length==1

You're getting pretty complicated here. I would use a variable to store the original damage calculation, then modify it based on the troop size. So if you wanted it to do 20% more damage to a single enemy:
Code:
let dam = a.isClass($dataClasses[1]) ? 100 + a.mat * 5 - b.mdf : 100 + a.mat * 2 - b.mdf; dam *= $gameTroop.aliveMembers().length==1 ? 1.2 : 1; dam

Because you're starting to get so complex with this, another way to do this is to take some of the junk out of the damage formula and use Yanfly's Auto Passive States along with Buffs & States Core.

Make a passive state and slap it on class 1.

In the notes for that state, put the tag:
Code:
<Custom Confirm Effect>
if (this.isItem() && this.item().meta["slot1"])
    value+=50+a.mat*3;
</Custom Confirm Effect>

I'm a little confused by the poor description and writing in the plugin you reference, but that should boost the damage if you're using an Item with the <slot1> notetag by the same difference you have in your two formulae above.
So it has a target scope of all enemies, but you want it to do more if "all enemies" is just one?

You can get the number of enemies with $gameTroop.aliveMembers().length

Thus, checking whether there's only one enemy would be:
Code:
$gameTroop.aliveMembers().length==1

You're getting pretty complicated here. I would use a variable to store the original damage calculation, then modify it based on the troop size. So if you wanted it to do 20% more damage to a single enemy:
Code:
let dam = a.isClass($dataClasses[1]) ? 100 + a.mat * 5 - b.mdf : 100 + a.mat * 2 - b.mdf; dam *= $gameTroop.aliveMembers().length==1 ? 1.2 : 1; dam

Because you're starting to get so complex with this, another way to do this is to take some of the junk out of the damage formula and use Yanfly's Auto Passive States along with Buffs & States Core.

Make a passive state and slap it on class 1.

In the notes for that state, put the tag:
Code:
<Custom Confirm Effect>
if (this.isItem() && this.item().meta["slot1"])
    value+=50+a.mat*3;
</Custom Confirm Effect>

I'm a little confused by the poor description and writing in the plugin you reference, but that should boost the damage if you're using an Item with the <slot1> notetag by the same difference you have in your two formulae above.
Hello sorry it's been a minute since I replied. Been using the information you gave me to figure out how to do a few things. As it turns out the formula and code you gave me worked for that particular task, but there is another part of the same thing I have been working on using this thread that I still need some help with. I am trying to figure out how to have multiple levels of an ability that increase the effectiveness of specific items. Tried using the damage formula box in the Healing Potion item, but I don't think the formula I came up with is correct. Here it is below:

a.isStateAffected(51) ? 650 : 500; a.isStateAffected(52) ? 700 : 500; a.isStateAffected(53) ? 800 : 500; a.isStateAffected(54) ? 1000 : 500; a.isStateAffected(55) ? 1500 : 500

Personally I would prefer to increase the amount healed by a percentage and not have to set it to a specific amount, but which do you think would be easier in the long run?

To further explain what I was trying to do if it wasn't very clear State 51, 52, 53, 54, and 55 are all different levels of basically the same ability I've been trying to get to work. In the case of the Healing Potion it is supposed to increase the amount of healing that the potion does a bit for each level of the ability that the character has unlocked. Each level has to be unlocked in order so if we are going by percentages then level 1 (State 51) would increase the amount healed by 5%, level 2 (State 52) by 15%, level 3 (State 53) by 30%, level 4 (State 54) by 50%, and level 5 (State 55) by 75%. If percentages are not doable then that is ok, they are simply preferred. Healing Potion is still Item #1 if that info is needed. I've been using a skill tree plugin from Felski to create skill trees for the classes in my game. Through this I can have the characters unlock skills in a specific order. Using passive states from the Yanfly plugin I connected the skills to the states in the order they should be in. So the part that involves the skill tree unlocking skills that give passive states to the character for the ability that would increase the effectiveness of the potion does work. The part that doesn't seem to is the damage formula text. Please if there is an easier way such as a bit of code or notetag text I would be most interested. As you can probably easily tell I know little to nothing about what coding might make this work, though I do hope that I was at least going in the right direction. Sorry if I repeated myself at any point. I did try my best to explain what's going on, but if there are further questions I will try to get back to you promptly.
Thank you for your time.
~ V

Edit:

Tried editing the damage formula more, but I am so lost.

if a.isStateAffected(51) {if a.isStateAffected(52) {if a.isStateAffected(53) {if a.isStateAffected(54) {if a.isStateAffected(55) {1500 + a.hp} else {1000 + a.hp} } else {750 + a.hp} } else {600 + a.hp} } else { 500 + a.hp } }
a.isStateAffected(51) ? 650 : 500; a.isStateAffected(52) ? 700 : 500; a.isStateAffected(53) ? 800 : 500; a.isStateAffected(54) ? 1000 : 500; a.isStateAffected(55) ? 1500 : 500
This isn't valid syntax. Every time you put a semicolon that's the end of a code statement. So what you're effectively telling your damage formula is 500. 500. 500. 500. 500. and it will use the last number as the damage done. So only state 55 can potentially change anything.

If you want to chain conditions, they need to actually be inside the conditions.
Code:
if this ? outcome one : else if this ? outcome two : else if this ? outcome three : etc.

I maintain, as I said above, that this would be better implemented as notetags on the state. At least there any convoluted code can be split up into readable lines.

If percentages are not doable then that is ok, they are simply preferred.
Why would they not be doable? Math is math. To increase a number by 25% you multiply by 1.25, right?

Please if there is an easier way such as a bit of code or notetag text I would be most interested.
What's wrong with the passive state notetag I suggested last time?

if a.isStateAffected(51) {if a.isStateAffected(52) {if a.isStateAffected(53) {if a.isStateAffected(54) {if a.isStateAffected(55) {1500 + a.hp} else {1000 + a.hp} } else {750 + a.hp} } else {600 + a.hp} } else { 500 + a.hp } }
This makes even less sense than your ternary statements 🤣 Just looking at and reading this, you're saying "If they have state 51, then if they have state 52, then if..." you're never actually making it do anything. And then they're all in braces and everything is going off of an else for a condition to be false, not true, and...I have no clue, yo. I'm not even going to try to split the lines up and format it and read this.
This isn't valid syntax. Every time you put a semicolon that's the end of a code statement. So what you're effectively telling your damage formula is 500. 500. 500. 500. 500. and it will use the last number as the damage done. So only state 55 can potentially change anything.

If you want to chain conditions, they need to actually be inside the conditions.
Code:
if this ? outcome one : else if this ? outcome two : else if this ? outcome three : etc.

I maintain, as I said above, that this would be better implemented as notetags on the state. At least there any convoluted code can be split up into readable lines.


Why would they not be doable? Math is math. To increase a number by 25% you multiply by 1.25, right?


What's wrong with the passive state notetag I suggested last time?


This makes even less sense than your ternary statements 🤣 Just looking at and reading this, you're saying "If they have state 51, then if they have state 52, then if..." you're never actually making it do anything. And then they're all in braces and everything is going off of an else for a condition to be false, not true, and...I have no clue, yo. I'm not even going to try to split the lines up and format it and read this.
The notetag you gave me last time worked beautifully except on healing items. It seems like healing items might need their own formula to work or their own notetag. I like the notetag option better.
The notetag you gave me last time worked beautifully except on healing items.
Okay...but some more information would help to reduce the number of posts back and forth. What didn't work?

You can see in my notetag that I added to the value of the damage done - a healing item might have a negative value, so we'd need to check for that and subtract, instead. Or use multiplication which doesn't care what the sign is.

But I don't know from your post what didn't work or what you've tried to fix it. Well. I saw the terrible things in your penultimate post...I don't know what sane things you tried to fix it 😉
Okay...but some more information would help to reduce the number of posts back and forth. What didn't work?

You can see in my notetag that I added to the value of the damage done - a healing item might have a negative value, so we'd need to check for that and subtract, instead. Or use multiplication which doesn't care what the sign is.

But I don't know from your post what didn't work or what you've tried to fix it. Well. I saw the terrible things in your penultimate post...I don't know what sane things you tried to fix it 😉
ah ok. well in the case of the healing item with the <slot1> tag it didn't seem to effect it at all. It still seems to do the same thing for the same amount with or without the passive state being active. The item is as below:
Health Rune 1.jpg
That's because it's not using the damage formula at all, which is what "value" refers to.

Everything in the Effects field of a skill takes place after the skill's hitting and damage formula is resolved, so you can't affect it with notetags that take place during that process.

If you deleted the Recover HP effect, changed the damage type to HP Recover, and typed 1000 in the damage formula, you'd see an effect.

As I said previously, it would probably be going in the wrong direction because I gave the notetag on your prior description of damaging items; but you can just add a conditional to account for that, or use multiplication instead of addition.
That's because it's not using the damage formula at all, which is what "value" refers to.

Everything in the Effects field of a skill takes place after the skill's hitting and damage formula is resolved, so you can't affect it with notetags that take place during that process.

If you deleted the Recover HP effect, changed the damage type to HP Recover, and typed 1000 in the damage formula, you'd see an effect.

As I said previously, it would probably be going in the wrong direction because I gave the notetag on your prior description of damaging items; but you can just add a conditional to account for that, or use multiplication instead of addition.
I had a feeling it'd be that. Switch over to multiplication to make it easier. Still working out the kinks, but I'm sure I'll get there. I keep you posted if anything else comes up. Just out of curiosity, if we were to use a conditional what would that look like?

Edit:
Been trying to get the multiplication to work and I got the first 2 levels to work, but any level higher than 2 starts to heal two separate amounts at the same time. Kind of just want it to heal the one amount and not two.
Sounds like what happens when you give RPG Maker decimals for damage. If you're multiplying by a decimal value, put the equation inside of Math.round() so that it gets rounded to an integer first.
Sounds like what happens when you give RPG Maker decimals for damage. If you're multiplying by a decimal value, put the equation inside of Math.round() so that it gets rounded to an integer first.
Thank you. Had to figure out the best place in the formula to put that, but figured it out. Greatly appreciate the help!
Here's what it came out looking like:
<Custom Confirm Effect>
if (this.isItem() && this.item().meta["slot3"])
value=Math.round(value*1.10);
</Custom Confirm Effect>

Original thread: https://forums.rpgmakerweb.com/threads/increase-item-effectiveness-for-a-specific-class.154546/