MV YEP Item Synthesis variable based cost change?

I have looked for about 40 minutes and haven't found a thread about this so I will ask here!

In my game you can Mine ores, and smelt them so I use item synthesis to do that!

For Bronze Ingot, the recipe is:

<Synthesis Ingredients> Bronze Ore: 3 </Synthesis Ingredients>

But I made a Cloak that when worn one of the effects that I want it to decrease the price of Ingots by 1 Ore!


(Excuse my poor code, i'm still learning so I probably made some mistakes here lol but you should be able to understand what I'm asking 🙂 )

Is there a way to do this based on a variable like:

<Synthesis Ingredients> if ($gameVariables.value(456) >= 1 { Bronze Ore: 2 } else { Bronze Ore: 3 } </Synthesis Ingredients>

So when my cape is equipped the variable 456 goes up to 1 meaning the passive is active, so I want the game to check that and reduce the cost of the ore by 1! Is there a way to achieve this?
You can't do that on two levels.

First, I can't think of a way for you to change a variable from a passive state (although it's unnecessary, since you could simply check for the user to have that state. I dunno what the reason for the variable is).

Second, there is no JavaScript option for determining synthesis ingredients.

You could use the Custom Synthesis Effect notetag to refund an ore after crafting. It's up to you whether that's good enough, as the player will still have to have the original amount to do it in the first place.
You can't do that on two levels.

First, I can't think of a way for you to change a variable from a passive state (although it's unnecessary, since you could simply check for the user to have that state. I dunno what the reason for the variable is).

Second, there is no JavaScript option for determining synthesis ingredients.

You could use the Custom Synthesis Effect notetag to refund an ore after crafting. It's up to you whether that's good enough, as the player will still have to have the original amount to do it in the first place.
I didn't even think of it refunding the ore that is a really good idea, thank you!
I imagine that this passive state that reduces the cost of synthesis in a mineral is for various types of synthesis, right? Perhaps it would be a good idea to make several npc the same with the difference that one npc asks for fewer minerals, and change them with the yanfly plugin (YEP_EventMorpher) that allows you to change one event to another under certain circumstances.

You use a conditional to check if the actor has the cape equipped or check if he has the passive state (I think this won't work because the passive state is activated in battles) and when it is true make the event change with the yanfly plugin .

Experiment with it, I think it will help you.
You use a conditional to check if the actor has the cape equipped or check if he has the passive state (I think this won't work because the passive state is activated in battles)
Passive states are active whenever you say they are. For that matter, regular states are active whenever you say they are. That's why the "Remove at Battle End" check box is an option.

Perhaps it would be a good idea to make several npc the same with the difference that one npc asks for fewer minerals
I don't really understand this suggestion. The cost of synthesizing an item has nothing to do with NPCs/events. It's defined in the recipe on the item you're crafting.

The only way I can think of to do something like your suggestion would be:
- Create two different but identical versions of item X, with different recipes
- Use wayne's On Equip Eval plugin to create notetags on the cloak.
- When the cloak is equipped, remove the standard recipe from the player and replace it with the second one for the cheaper item. Vice versa when the cloak is removed.
You can't do that on two levels.

First, I can't think of a way for you to change a variable from a passive state (although it's unnecessary, since you could simply check for the user to have that state. I dunno what the reason for the variable is).

Second, there is no JavaScript option for determining synthesis ingredients.

You could use the Custom Synthesis Effect notetag to refund an ore after crafting. It's up to you whether that's good enough, as the player will still have to have the original amount to do it in the first place.
How would I go about checking the state inside the Custom Synthesis Effect?
I tried a few threads to see the script call for checking states and I got this but it doesn't work

<Custom Synthesis Effect> if (actor.isStateAffected(434) === true) { var ore = $dataItems[168]; $gameParty.gainItem(ore, 1); } </Custom Synthesis Effect>
You are right ATT_Turán, I had forgotten that the synthesis conditions are established in the note box of the item or equipment in the database and not in an npc.
How would I go about checking the state inside the Custom Synthesis Effect?
I haven't checked the code or anything, but pretty much all of Yanfly's notetags provide you with a user variable. I don't think I've seen one that used actor

Original thread: https://forums.rpgmakerweb.com/threads/yep-item-synthesis-variable-based-cost-change.160784/