Increase Level up price using switches help

I wanted my project to have a feature where instead of leveling up immediately after battles, they'd just use the currency to do so anytime they want (similar to Code Vein). So, I want to know how can I change the price amount the more the player level up?
How do you set the price? And how does your system work? Do you do everything through eventing? You could set a formula that would put the price into a game variable:
Code:
var price = 500 * $gameParty.members()[0].level;
$gameVariables.setValue(10, price);
If you use this as a script call, you can easily change the price formula. Change the 0 in the [ ] to the index of the party member (the order in the party). Change the 10 on line 2 to the variable you want to use.
You can use the EXP curve to define the cost. Since you'll be using money instead of EXP, why not pretend EXP = money?

To find out how much EXP you need to level up (and therefore how much money to spend to level up):
Code:
Control Variables : #0001 = $gameParty.members[0].nextRequiredExp()
This is for the first member in you party. For the second member, use members[1] instead of members[0]. And so on.

Finally, you can simply use the Event Commands:
Actor -> Change EXP...
or
Actor -> Change Level...
to increase your characters' level or experience.

Which one you choose depends on how you want your player to spend their money.
If they should spend the full amount to level up, use "Change Level..."
If they can invest little by little to level up, use "Change EXP..." instead.
I'm sorry that it took me centuries to respond!
@Nolonar
I'll just use the Code in the Common Event list and set the trigger to parallel?
EDIT: Stupid question, and it worked beautifully! Thank you so much!
EDIT2: Should I set the variable's operation to set, or add?
I'm sorry that it took me centuries to respond!
@Nolonar
I'll just use the Code in the Common Event list and set the trigger to parallel?
EDIT: Stupid question, and it worked beautifully! Thank you so much!
EDIT2: Should I set the variable's operation to set, or add?
You should use "set", not "add", otherwise the cost would increase every time the player wants to know how much a level up will cost.

"How much to level up?"
"500 Gold."
"Ok, wait a minute."
* 1 minute later *
"I want to level up, here's 500 Gold."
"1000 Gold."
"You said 500 Gold back then."
"1500 Gold."

👋
You should use "set", not "add", otherwise the cost would increase every time the player wants to know how much a level up will cost.

"How much to level up?"
"500 Gold."
"Ok, wait a minute."
* 1 minute later *
"I want to level up, here's 500 Gold."
"1000 Gold."
"You said 500 Gold back then."
"1500 Gold."

👋

The 2004 demo of my game actually had something like this when the main character is accosted by a couple of inept bandits demanding money from him. The amount keeps going up every time you refuse unless you do so like 20 times, at which point he gets fed up of arguing and just takes 5 gold off you.
@Nolonar
Actually, I want the EXP price increase the more they level up so, I think add is the right answer in my case ^^"

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/increase-level-up-price-using-switches-help.123659/