MV YEP_X_AttachAugments Javascript Support

Relevant to this post, I'm using "YEP_ItemCore," YEP_X_AttachAugments," and "YEP_JobPoints" plugins. Links below:


Bottom line up front, I'm trying to create an augment that provides the user with a MaxHP stat boost based on their number of Job Points (+10% up to +50% MHP boost), which removes the effect if the augment is detached.

My failed script is below:

JavaScript:
<Augment Attach Eval: Essence>
if (user.jp()>=50000) {
  item.params[0] += 0.5*user.mhp;
} else if (user.jp()>=40000) {
  item.params[0] += 0.4*user.mhp;
} else if (user.jp()>=30000) {
  item.params[0] += 0.3*user.mhp;
} else if (user.jp()>=20000) {
  item.params[0] += 0.2*user.mhp;
} else if (user.jp()>=0) {
  item.params[0] += 0.1*user.mhp;
}
</Augment Attach Eval: Essence>

<Augment Detach Eval: Essence>
if (user.jp()>=50000) {
  item.params[0] -= 0.5*user.mhp;
} else if (user.jp()>=40000) {
  item.params[0] -= 0.4*user.mhp;
} else if (user.jp()>=30000) {
  item.params[0] -= 0.3*user.mhp;
} else if (user.jp()>=20000) {
  item.params[0] -= 0.2*user.mhp;
} else if (user.jp()>=0) {
  item.params[0] -= 0.1*user.mhp;
}
</Augment Detach Eval: Essence>

Community assistance is greatly appreciated.
There's no such thing as "user" in Augment Evals. You're not referencing any specific actors when installing an augment, you're just manipulating the items through the menu.

If your game has only one character (or that's the only character whose JP you care about), you could reference them directly via $gameActors.actor(1)

Otherwise, you'd have to go about this a different way. You could use Quasi's Params Plus, but that would make the item dynamically change the HP as the actor gains and loses JP.

Also, there are some logical errors in the detach portion. Once you've boosted max HP by 50%, subtracting 50% of that back down will not result in the same number. Additionally, what would happen if the player had a different amount of JP when they installed and removed the augment? Even if the math were correct, they could end up not where they started.
There's no such thing as "user" in Augment Evals. You're not referencing any specific actors when installing an augment, you're just manipulating the items through the menu.

If your game has only one character (or that's the only character whose JP you care about), you could reference them directly via $gameActors.actor(1)

Otherwise, you'd have to go about this a different way. You could use Quasi's Params Plus, but that would make the item dynamically change the HP as the actor gains and loses JP.

Also, there are some logical errors in the detach portion. Once you've boosted max HP by 50%, subtracting 50% of that back down will not result in the same number. Additionally, what would happen if the player had a different amount of JP when they installed and removed the augment? Even if the math were correct, they could end up not where they started.
So for the sake of learning, the script was correct minus the word "user," obviously, my math was wrong—just an oversight on my part.

Yeah, Quasi's plugin would not achieve the desired result.

If I understood correctly, I cannot make the augment for "non-specific actors" with my current plugins?

If that is the case, I will close this post and pursue another route.
If I understood correctly, I cannot make the augment for "non-specific actors" with my current plugins?
I don't see how. At what point would the bonus actually be determined?

If it depends on the actor equipping the augmented item, that's in the realm of the Quasi plugin with dynamic bonuses.

If it depends on an actor of your choice during the moment of augmentation, then you'd have to create an additional scene in Yanfly's plugin to add a new step of "select base item, select augment, select actor who's installing it".
Looking at this, I'd say a couple of well used plugins should help here.
Firstly, using a passive state plugin, have the augment add a passive state. That state would then confer (via a different plugin) some kind of variable trait that you can make equal a percentage of the equipment holder's JPs.

Don't know how feasible that is, but I think it might work.
Looking at this, I'd say a couple of well used plugins should help here.
The problem is the point of reference.

The passive state route would probably use Quasi's Params Plus that I mentioned above to have the dynamic bonus (or perhaps you have another plugin in mind to do it through traits, that's cool). But it would still dynamically reference the actor when they equip it.

It sounds like the OP wanted it to be a static value determined at the time of augmentation, but there's no way to specify which actor it should be based on at that time (without writing a new selection scene).

Unless I'm not thinking of something.
No. I think you are correct as far as the PoR. I know the OP seemed a little ready to move on, but if they could flesh out a way they'd like to see this happen (moving away from non-actor specific equipment), it might be fun to try and script.
No. I think you are correct as far as the PoR. I know the OP seemed a little ready to move on, but if they could flesh out a way they'd like to see this happen (moving away from non-actor specific equipment), it might be fun to try and script.
Correct. I'm very close to wrapping up my project rough draft, so I don't want to waste a lot of time on anything that is not essential.

I figured trying to make this work couldn't hurt, but I had already found a simpler alternative. Hey, but if someone figures it out, I wouldn't turn it down.

Closed at OP's request.

Original thread: https://forums.rpgmakerweb.com/threads/yep_x_attachaugments-javascript-support.155133/