YEA JP Manager - Learn skills outside of menu

Hi all,


So I'm trying to find a way to spend JP outside of the menu with a script call, for instance learning a skill from an NPC rather than from a menu, provided the character has enough JP to expend, but I'm not sure how to do that.


Here's the script for reference: https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/jp-manager/


I know there's a way but I just can't figure it out!
You do that with the provided script calls (lose_jp and the others), those will add/subtract JP points.


And teaching a skill for your actors is a default event command.
I should re-explain actually. I'm trying to find a way that also checks to see if they even have enough JP for the skill to learn but I'm not sure how to do that. (Edited first post)
Ohh, right, forgot about that.


Yeah, for some reason Yanfly always miss these script calls in his descriptions. 😀


You can check these in scripted conditional branches:

Spoiler
# Actor based check:
$game_actors[id].jp # For the current class, whichever that is
$game_actors[id].jp(class_id) # For a specific class

# Party position based check:
$game_party.members[index].jp
$game_party.members[index].jp(class_id)

Replace id with the database ID of the actor.


Replace index with the party member's position. The 1st member's index is 0, the 2nd member's index is 1, and so on.


Replace class_id with the database ID of the class.


Examples:

Spoiler
Code:
# Checks if Actor 1 got at least 20 JP for the 
# currently active class:
$game_actors[1].jp >= 20

# Checks if Actor 5 got at least 35 JP for Class 5:
$game_actors[3].jp(5) >= 35

# Checks if the party leader got at least 120 JP
# for Class 12:
$game_party.members[0].jp(12) >= 120
Thanks for the help. I will attempt to implement your code when I get home.


Is there also a way to display the current JP as a variable? 
You can use the same script call for that.


Just set the variable to that with the "Script" option inside the "Control Variables" command or use a fully scripted version like this:


$game_variables[id] = $game_actors[id].jp


For example.


After this, you can display it in message boxes with the regular \V[id] message code for variables.
This is a really quick event that seems to do the trick. I'm not sure how to implement an if/and style argument in the script so hopefully this works!

grabilla.q63232.png

Original thread: https://forums.rpgmakerweb.com/threads/yea-jp-manager-learn-skills-outside-of-menu.70723/