MV YEP_SkillLearnSystem Cost Eval using Parameters?

I know I ask a lot of questions, but I've tried different things and I can't seem to get it to work.

Using:
JavaScript:
<Learn Cost Eval>
 code
 code
</Learn Cost Eval>

Is there a way to make the skill cost a portion of the actors Max MP? or Atk? or HP?

I've tried:

JavaScript:
<Learn Cost Eval>
 cost = user.mmp * 0.1
</Learn Cost Eval>
but it didn't do anything.

Any ideas?
Is there a way to make the skill cost a portion of the actors Max MP? or Atk? or HP?
That's not what that notetag does. From the instructions:
1718313734716.png


So you're making a global variable named cost, setting it to a value, then it's going away.

The only way you can make a cost with a formula is if you're making the actor spend JP, and that's the Custom Learn JP Cost notetag.
That's not what that notetag does. From the instructions:
View attachment 308371

So you're making a global variable named cost, setting it to a value, then it's going away.

The only way you can make a cost with a formula is if you're making the actor spend JP, and that's the Custom Learn JP Cost notetag.
How I interpreted that explanation was that the "cost" in the note tag is taken after the skill "bought"... so I should be able to have the skill remove some MP from the player when they "buy" the skill... right?

Doesn't that explain how to do it.... so basically if I want the skill to take some of the player's MP as payment after it's "bought" I need to place the eval code in that note tag. It won't show up as part of the cost but that's what this note tag is for:

JavaScript:
<Learn Custom Text>
 text
 text
</Learn Custom Text>

So do I just get rid of the "cost =" portion and it should work, I tried that as well and it didn't.
The only way you can make a cost with a formula... JP,
Huh. I would have assumed there would be custom eval tags for more than just jp


Is there a way to make the skill cost a portion of the actors Max MP? or Atk? or HP?
I dont use the plugin and i dont know your project. Its a little unclear to me what exactly you mean given what id think would be standard. Cost what exactly?

A gold/variable/jp cost based on the actor's max mp? A direct max mp cost that gets permanently deducted from the actor?
The second thing would be a little trickier to do all things considered if that's what you wanted

EDIT:

so I should be able to have the skill remove some MP from the player when they "buy" the skill... right?
That answers that for me. Ill get back to this when im not on a train
Huh. I would have assumed there would be custom eval tags for more than just jp



I dont use the plugin and i dont know your project. Its a little unclear to me what exactly you mean given what id think would be standard. Cost what exactly?

A gold/variable/jp cost based on the actor's max mp? A direct max mp cost that gets permanently deducted from the actor?
The second thing would be a little trickier to do all things considered if that's what you wanted
Something like.... You need use 10% of you MAX MP in order to purchase this skill. So you have 100 MP max, you use 10 MP to purchase the skill and the amount is taken from the player.... but it's not permanent.

It could be a flat number as well instead of a percentage. So something like it costs 300 MP but you only have 100 MP max at the moment... so you can't buy it.

Something along those lines...
How I interpreted that explanation was that the "cost" in the note tag is taken after the skill "bought"... so I should be able to have the skill remove some MP from the player when they "buy" the skill... right?
I don't understand what you're talking about, there is no "cost" in the note tag.
1718315042942.png


If you want to permanently decrease the user's max MP when they learn the skill, that is not the correct JavaScript syntax to do that.

From the pinned MV script call list:
1718315166667.png


So you'd do:
Code:
<Learn Cost Eval>
user.addParam(2, Math.round(user.mmp * -.1));
</Learn Cost Eval>

And then you'd want to display something appropriate for the cost text.
I don't understand what you're talking about, there is no "cost" in the note tag.
View attachment 308372

If you want to permanently decrease the user's max MP when they learn the skill, that is not the correct JavaScript syntax to do that.

From the pinned MV script call list:
View attachment 308374

So you'd do:
Code:
<Learn Cost Eval>
user.addParam(2, Math.round(user.mmp * -.1));
</Learn Cost Eval>

And then you'd want to display something appropriate for the cost text.
But I don't want to permanently reduce the Max Mp... I just want to have the Skill reduce the amount of MP on hand by a set amount.... Like I explained above. So, something like a casting cost in order to buy the skill.

I'm not sure how else to explain it. the spell costs 100 MP so when you buy the spell it takes the MP like you just cast the spell, but you can get it back with an item or sleep....

The permanent skill lowering is an interesting mechanic, but not what I'm looking for... at the moment.
But I don't want to permanently reduce the Max Mp
instead of using addParam then, youd use gainMp then (also in the script call list)
Code:
<Learn Cost Eval>
user.gainMp(Math.round(user.mmp * -.1));
</Learn Cost Eval>

If you want to permanently decrease the user's max MP...
i had said it would be trickier cause that was my first thought as to how to do it. i had an idea as to what might happen if a player knew that it was reducing their max mp based on their max mp at the time.

If i knew thats what a game was doing, id be reducing my max mp as much as i can before entering the menu and avoiding leveling up to make that cost as low as possible in the long run since the reduction is based on the time of purchase and not an active % of the actor's max mp.

but that was also a guess as to what OP wanted, which ended up unneeded 😛
But I don't want to permanently reduce the Max Mp...
Well, it was confusing because your first post referenced mmp and said "make the skill cost a portion of Max MP" - without any indication that the cost wasn't being paid out of that parameter.

But what @Robro33 gave you should be what you want.
Well, it was confusing because your first post referenced mmp and said "make the skill cost a portion of Max MP" - without any indication that the cost wasn't being paid out of that parameter.

But what @Robro33 gave you should be what you want.
I only mentioned that as an example and I thought I explained it in the subsequent posts. But I can see the initial confusion and apologize for not explaining myself better at first. Thank you for helping me... I might actually use that permanent reduction thing for the more powerful spells I have in the game as a cost to buy them. Thank you for that.

@Robro33 Thank you for the code. It's exactly what I was looking for.

Original thread: https://forums.rpgmakerweb.com/threads/yep_skilllearnsystem-cost-eval-using-parameters.169493/