MV A way to make Yep_JobPoints use a formula or script

I'm looking for a way to make the Job Points use a formula or script to calculate how many Job Points to give the player after battle.

At the moment the only command I've found in the script for the enemy is <JP: x> where 'x' is a straight integer. Now that's all fine and stuff, but I would like for the JP: x to grow as the game progresses. so something like this:

<JP: 5>

changes to this:

<JP: 5 + $gameVariables.value(1)>

Now I'm able to change the amount of JP an enemy give by changing the variable given... though that's a rather simplistic example for what I really want to do, but it gets the point across.

IS this possible? Maybe a small addon script or something?
I'm looking for a way to make the Job Points use a formula or script to calculate how many Job Points to give the player after battle.

At the moment the only command I've found in the script for the enemy is <JP: x> where 'x' is a straight integer. Now that's all fine and stuff, but I would like for the JP: x to grow as the game progresses. so something like this:

<JP: 5>

changes to this:

<JP: 5 + $gameVariables.value(1)>

Now I'm able to change the amount of JP an enemy give by changing the variable given... though that's a rather simplistic example for what I really want to do, but it gets the point across.

IS this possible? Maybe a small addon script or something?
If it grows as the game progresses, wouldn't the player just go back to the beginning area to slaughter all the low level enemies in 1 hit for scaled JP?
If it grows as the game progresses, wouldn't the player just go back to the beginning area to slaughter all the low level enemies in 1 hit for scaled JP?
If you use a script for the progression you can do something like this:

<JP: Math.min(Math.max(5 + $gameVariables.value(1), 5), 20)>
this will make it so that you have a minimum balance of JP and a Maximum limit of JP... The example above has a minimum JP balance of 5 and a maximum balance of 20 - with every number in between for progression.
That isn't possible with the plugin as is because all it does is look for an integer on the enemy. It's just a stored value on the enemy in the database, which it puts through some calculation when it is awarding the points at the end of a fight, namely multiplying the flat value by any modifiers the party members have on states or equipment note tags, and then multiplying the result by the number of enemies killed.

To make this work you'd need to edit the plugin, first to store the raw text of the note tag as a string, and then later to eval that string into a value at runtime when it's doing the JP calculation after a battle.
That isn't possible with the plugin as is because all it does is look for an integer on the enemy. It's just a stored value on the enemy in the database, which it puts through some calculation when it is awarding the points at the end of a fight, namely multiplying the flat value by any modifiers the party members have on states or equipment note tags, and then multiplying the result by the number of enemies killed.

To make this work you'd need to edit the plugin, first to store the raw text of the note tag as a string, and then later to eval that string into a value at runtime when it's doing the JP calculation after a battle.
Well that sucks...
You could give all your enemies a passive state, and in that state put the Buffs & States notetag:
Code:
<Custom Respond Effect>
if (target.hp <= 0)
    user.gainJp(put your formula here);
</Custom Respond Effect>
You could give all your enemies a passive state, and in that state put the Buffs & States notetag:
Code:
<Custom Respond Effect>
if (target.hp <= 0)
    user.gainJp(put your formula here);
</Custom Respond Effect>
Would that work? I'll have to try it... BRB

So, tried it... and it works, kind of. The actor gets the JP but ONLY the actor that kills the mob gets it. So I would have to have the players time their actions to get a good distribution of JP to all the characters in battle throughout the game.

Not a bad idea though... Maybe I'll use that for something else in the future.
If you want it given to the whole party, just change the user.gainJp line to
Code:
$gameParty.members().forEach(actor => actor.gainJp(whatever amount));
If you want it given to the whole party, just change the user.gainJp line to
Code:
$gameParty.members().forEach(actor => actor.gainJp(whatever amount));
I don't think I did that right, the code didn't work - just kept giving my actors 0 JP...
I think you would have to show what you actually have typed out in order for us to tell you if you did it right.
I think you would have to show what you actually have typed out in order for us to tell you if you did it right.

In the Passive State:

<Custom Respond Effect>

if (target.hp <= 0)

$gameParty.members().forEach(actor => actor.gainJp(Math.min(Math.max(5 + $gameVariables.value(109), 5), 75));

</Custom Respond Effect>
Well, you have mismatched parentheses. I count 5 opening and only 4 closed. That will cause the whole thing to fail with a syntax error.

Aside from that, your math seems curious.

What's the point is saying "whichever is more, 5 or 5 + this variable?" Unless your variable can potentially be a negative value, it would have to be at least 5, which makes the Math.max() pointless.

And are you sure you're setting (and you need to use) a global variable in there?

Regardless, it should work if you close the last parenthesis.
Well, you have mismatched parentheses. I count 5 opening and only 4 closed. That will cause the whole thing to fail with a syntax error.

Aside from that, your math seems curious.

What's the point is saying "whichever is more, 5 or 5 + this variable?" Unless your variable can potentially be a negative value, it would have to be at least 5, which makes the Math.max() pointless.

And are you sure you're setting (and you need to use) a global variable in there?

Regardless, it should work if you close the last parenthesis.
I see the parenthesis thing and I'll fix that and see how it looks...

The Math stuff was something I worked out on my own with no knowledge of JS. basically -
Math.min(Math.max(5 + $gameVariables.value(109), 5), 75))
will make so that the enemy will automatically start with 5JP until the 5 + $gameVariables.value(109) is greater than 5 and then the enemy will now have that number instead - essentially it's a way to have a minimum number without setting the variable to a number first.

The rest of it will allow the number to grow, as long as the variable continues to grow, until the number reaches 75 and then it will stop at that number no matter how much the variable changes at that point.

It works pretty good during all my tests and I have it for all my enemies stats to keep them from growing unlimitedly.

Is there a better way to do this?
Math.min(Math.max(5 + $gameVariables.value(109), 5), 75)) will make so...
Yes, I see what it does 😛

Is there a better way to do this?
I mean...as I already typed in my previous post, the Math.max() portion is pointless unless your variable can be a negative value. So it's not better, you're not harming anything, but it's more efficient to leave it out.
Yes, I see what it does 😛


I mean...as I already typed in my previous post, the Math.max() portion is pointless unless your variable can be a negative value. So it's not better, you're not harming anything, but it's more efficient to leave it out.
Really, but doesn't that mean the number continues to grow without a cap? I mean... Maybe if I adjust the formula a little in the min... I think I see what your saying there.
Really, but doesn't that mean the number continues to grow without a cap?
...no? Math.max() doesn't create a cap, it creates a minimum value. The Math.min() that you've wrapped around it creates your cap of 75.

You would need to modify zero other things.
...no? Math.max() doesn't create a cap, it creates a minimum value. The Math.min() that you've wrapped around it creates your cap of 75.

You would need to modify zero other things.
OH... I see. Well, it was a formula I came up with after reading about MATH in Java on the internet.... So a formula like this:
Math.min(5 + $gameVariables.value(109), 75)
is the minimum and max I'm looking for?

Original thread: https://forums.rpgmakerweb.com/threads/a-way-to-make-yep_jobpoints-use-a-formula-or-script.168971/