Cuprite

Previously Golden
Veteran
Joined
Feb 6, 2017
Messages
121
Reaction score
44
First Language
English
Primarily Uses
RMXP
Is there a way to make an actor's learnable skills cost more JP the more skills they learn?
I got the idea from Octopath Traveller and it's something I'm thinking about adding to my game, as it adds a bit of freedom to the game.
Is there a way to do this without editing the plugin itself?
OTSkillLearn.PNG
EDIT: I may have an idea of what to do for this, but the solution I came up with doesn't actually seem to work.
It's in my next reply (No need to post it twice).
 
Last edited:

shockra

Bored Code Guy
Veteran
Joined
Feb 16, 2016
Messages
472
Reaction score
219
First Language
English
Primarily Uses
RMMZ

Watch this video and it should give an idea of how to accomplish this.
 

Cuprite

Previously Golden
Veteran
Joined
Feb 6, 2017
Messages
121
Reaction score
44
First Language
English
Primarily Uses
RMXP
So, I've looked into it and I think I've found a solution to this, though I'm not entirely sure.
Can anyone tell me if this code being in a skill's notebox would work?
<Learn Cost Eval>
if ($gameVariables.value(4) = 50) { $gameVariables.setValue(4, 100); } else { if ($gameVariables.value(4) = 100) { $gameVariables.setValue(4, 300); } else { if ($gameVariables.value(4) = 300) { $gameVariables.setValue(4, 600); } else { if ($gameVariables.value(4) = 600) { $gameVariables.setValue(4, 1200); } else { if ($gameVariables.value(4) = 1200) { $gameVariables.setValue(4, 2000); } else { } } } } }
</Learn Cost Eval>

<Custom Learn JP Cost>
cost = $gameVariables.value(4)
</Custom Learn JP Cost>
Basically, I have it so if a certain variable (Each actor would have one) is at a certain number (50), it would increase it to a number equal to the next JP cost (100) and I set the cost to equal that variable, so it always updates the rest of the actors learnable skills.
At least, that's what I was going for.
 

shockra

Bored Code Guy
Veteran
Joined
Feb 16, 2016
Messages
472
Reaction score
219
First Language
English
Primarily Uses
RMMZ
If you're going to use variables for this, the current approach can be refined. I would try this:

<Learn Cost Eval>
if ($gameVariables.value(4) = 50) {
$gameVariables.setValue(4, 100);
} else if ($gameVariables.value(4) = 100) {
$gameVariables.setValue(4, 300);
} else if... {

}
</Learn Cost Eval>

<Custom Learn JP Cost>
cost = $gameVariables.value(4);
</Custom Learn JP Cost>

Repeat the else if part in the Learn Cost Eval as needed. Then at the end, it's just the final bracket with no else.
 

Cuprite

Previously Golden
Veteran
Joined
Feb 6, 2017
Messages
121
Reaction score
44
First Language
English
Primarily Uses
RMXP
If you're going to use variables for this, the current approach can be refined. I would try this:

<Learn Cost Eval>
if ($gameVariables.value(4) = 50) {
$gameVariables.setValue(4, 100);
} else if ($gameVariables.value(4) = 100) {
$gameVariables.setValue(4, 300);
} else if... {

}
</Learn Cost Eval>

<Custom Learn JP Cost>
cost = $gameVariables.value(4);
</Custom Learn JP Cost>

Repeat the else if part in the Learn Cost Eval as needed. Then at the end, it's just the final bracket with no else.
I tried this, but it ended up giving me this error (Also, for testing purposes, I used variable 10 instead of 4).
Error.PNG
Also, here's how I wrote out the rest of the code.
Code.PNG
One other thing, the costs start as 75 for some reason.
 
Last edited:

shockra

Bored Code Guy
Veteran
Joined
Feb 16, 2016
Messages
472
Reaction score
219
First Language
English
Primarily Uses
RMMZ
My mistake. Each equal sign should be this:

if ($gameVariables.value(4) === 50)

If statements need 3 equal signs to make the check.
 

Cuprite

Previously Golden
Veteran
Joined
Feb 6, 2017
Messages
121
Reaction score
44
First Language
English
Primarily Uses
RMXP
My mistake. Each equal sign should be this:

if ($gameVariables.value(4) === 50)

If statements need 3 equal signs to make the check.
It works perfectly now! Thanks, Shockra!
:D
JPCostIncrease.png
Also, it was defaulting to 75 because I had the default JP set to 25.
 
Last edited:

chobokid

Veteran
Veteran
Joined
Nov 22, 2015
Messages
31
Reaction score
6
First Language
english
Primarily Uses
RMMV
How would one code it so that skill learn costs doubled each time an actor learned a skill?
 

Latest Threads

Latest Posts

Latest Profile Posts

1638170340913.png
Crossover Inn is getting very crowded, and I love it
Climbing to the top #mapping
1638160732198.png
I've started the first steps of the final few maps that I need to make for B:ms. I haven't been able to say that in a really, really long time. It'd probably be a good idea to blog about this or something.
Question for the Mods: What am I supposed to do when I can't make a synopsis 350 words long? (for project recruitment thread) @Shaz @mlogan
The game is meant to be more on the simple side in order to be achievable so I'm a bit stuck...

Forum statistics

Threads
117,043
Messages
1,104,082
Members
152,987
Latest member
mrsmatmoney
Top