Subtracting JP From Party Leader in Event.

Hello,

I am using yanfly's job points plugin: http://yanfly.moe/2015/11/13/yep-27-job-points/

I am trying to use JP as a form of pseudo currency for recruiting party members. I've managed to create a conditional branch that checks that the party leader has 10,000 JP, and if they do, the new character can join the party, however, I'm having difficulty in now subtracting the JP from the party leader.

I have gotten this to work by using the plugin commands on yanfly's page: loseJp (actor ID) (value) however, since the partyleader can rotate at any time, this won't work for me.

Thanks for the help.
I think this will help you out! You can call a common event on level up and have it deposit your own made up currency into a variable. Then you can just use conditionals to check for the appropriate amount of the currency in the variable.

http://himeworks.com/2015/10/level-up-events/

Unless, did you have preference to use the JP system or was it the only workaround you could find at the time?
@MenaKatep thanks for the feedback. This seems a bit convoluted to accomplish what I'm trying to do.

Is there not just a simple way to use a plugin command like these, but have it only affect the party leader?
upload_2017-2-26_15-16-52.png
It'd be pretty easy to add plugin commands for party members if it doesn't have them already.
Looks like you can use the lose jp function based on reading this

loseJp actorId jp
loseJp actorId jp classId
Replace ‘actorId’ with the ID of the actor you wish to change the JP of. Replace ‘jp’ with the amount of JP you wish to alter. If you are using ‘classId’, replace it with the ID of the actor’s class you wish to alter. This command will cause the actor to lose JP.

Do loseJp class1 10000

I believe that's the syntax. If you set the actor in question as having its own class, then you can easily ensure the action only affects them.

Edit: I thought you only wanted to affect one actor in particular and NOT the current party leader? Sorry I misread >_<
The only issue is that the party leader is constantly changing, so the classID will constantly be changing.
The only issue is that the party leader is constantly changing, so the classID will constantly be changing.
Yeah, that was my fault. I misread the post. You should still be able to the plugin command but use a variable for partyleaderid. I'm looking for it now but I don't know it off hand. >_<

EDIT: Here it is I think, $gameParty.leader()
You should be able to utilize that within the function if it's a script command.
Yeah, that was my fault. I misread the post. You should still be able to the plugin command but use a variable for partyleaderid. I'm looking for it now but I don't know it off hand. >_<

If you find it, please let me know. Your help is much appreciated. 🙂
What you can do if you don't want to edit the plugin code is to do this in a script call rather than using the plugin commands:

Code:
$gameParty.members()[party member ID 0-3].gainJp(jp amount, class id)
What you can do if you don't want to edit the plugin code is to do this in a script call rather than using the plugin commands:

Code:
$gameParty.members()[party member ID 0-3].gainJp(jp amount, class id)

Excuse me if I'm not understanding, but how does this specifically target the party leader?

Edit: by changing it to a script call and writing this: $gameParty.leader().loseJp(10000) it worked.

Thanks for everyone in the thread who helped. 🙂
Sorry, I missed the part about specifically the leader. Glad you figured it out without me having to correct myself. 🙂
What you can do if you don't want to edit the plugin code is to do this in a script call rather than using the plugin commands:

Code:
$gameParty.members()[party member ID 0-3].gainJp(jp amount, class id)

Is there no way to reference a variable within a plugin command or are you restricted to using a script call to utilize functions within a script?
There is a way to reference a variable within a plugin command, but this is prevented by the way Yanfly coded the gainjp command:

Code:
var actorId = parseInt(args[0]);

The arguments in a plugin command are initially passed in as strings, and obviously parseInt converts that string to an integer. However, what happens when you use variables is that your variable is passed in as a string and then it can't be parsed as an integer.

For this particular plugin, if you wanted to be able to use variables for the actor ID you would have to change the parseInt to an eval.
There is a way to reference a variable within a plugin command, but this is prevented by the way Yanfly coded the gainjp command:

Code:
var actorId = parseInt(args[0]);

The arguments in a plugin command are initially passed in as strings, and obviously parseInt converts that string to an integer. However, what happens when you use variables is that your variable is passed in as a string and then it can't be parsed as an integer.

For this particular plugin, if you wanted to be able to use variables for the actor ID you would have to change the parseInt to an eval.

Oh. derp! I didn't even look at the Interpreter_pluginCommand. Well, that's good to know for future reference! Thanks, Trihan 🙂

Original thread: https://forums.rpgmakerweb.com/threads/subtracting-jp-from-party-leader-in-event.75343/