Yanfly Stat Allocation: Cannot add additional AP.

I'm having a problem with Yanfly's 'Stat Allocation' plugin, specifically in figuring out how to give a specific actor extra AP. (as in, in addition to what he has presently.
I have an event with two script calls in a choice:
var actor = $gameActors.actor(1);
actor.gainBonusAp(10, 0);
and
var actor = $gameActors.actor(1);
actor.setBonusAp(10, 0);
I had presumed that gainBonusAP would have been the one to add additional AP to a character, but both script calls are functionally identical. (hence having both in a choice box, for testing purposes and troubleshooting.)
I look forward to and appreciate any and all help with this, and I thank you for your time.
I don't have a solution for you but I am having the opposite problem with this same plugin (which is very likely actually the same exact problem in every way that matters) which is that I cannot either take away AP or set AP to a number (0 is the number I tried to set it to but it shouldn't matter; in any case what I was trying to do was make sure that when new characters joined the party for the first time, they wouldn't have AP to spend for their existing levels). I am guessing that the amazing YF, who is only MOSTLY perfect, goofed somewhere setting up those script calls and that's why they're not working.

In the end I wound up being fine with new characters joining the party with AP to spend, but I would be interested if anyone can come up with a solution to this.
I think @CrowStorm is correct, try this:
JavaScript:
Game_Actor.prototype.gainBonusAp = function(value, classId) {
  this.initAllocationPointsCheck();
  classId = classId || this._classId;
  var ap = this._bonusAllocationPoints[classId] || 0;
  ap += value;
  this.setBonusAp(ap, classId);  // <- substituted "value" for "ap"
};
You could either edit the plugin manually (the commented line is 1161) or save the above code as a .js file and import as a new plugin, loading immediately after Stat Allocation. 🙂
I think @CrowStorm is correct, try this:
JavaScript:
Game_Actor.prototype.gainBonusAp = function(value, classId) {
  this.initAllocationPointsCheck();
  classId = classId || this._classId;
  var ap = this._bonusAllocationPoints[classId] || 0;
  ap += value;
  this.setBonusAp(ap, classId);  // <- substituted "value" for "ap"
};
You could either edit the plugin manually (the commented line is 1161) or save the above code as a .js file and import as a new plugin, loading immediately after Stat Allocation. 🙂
Awesome! It works like a dream! Thank you so much for the help! ^n.=.n^
This script call is still not working for me (different project, one where a working StatAllocation Plugin is much more necessary).

I tried both pasting in the JavaScript to the correct place in the plugin (it looks like you literally only changed 'value' to 'ap' on line 1161 to make it work?) as well as saving that scriptlet as a new .js file and importing it directly below YEP_StatAllocation. No dice either way. Since this fix worked for Diretooth I'm massively confused. Any ideas @caethyril ?
This script call is still not working for me (different project, one where a working StatAllocation Plugin is much more necessary).

I tried both pasting in the JavaScript to the correct place in the plugin (it looks like you literally only changed 'value' to 'ap' on line 1161 to make it work?) as well as saving that scriptlet as a new .js file and importing it directly below YEP_StatAllocation. No dice either way. Since this fix worked for Diretooth I'm massively confused. Any ideas @caethyril ?
Yep, I only changed line 1161~ 🙂

I notice you mention not being able to set the AP either? Since gainBonusAp goes through setBonusAp, that sounds like another problem...not sure why it'd be happening though. Can you reproduce that behaviour in a new project with no plugins except Stat Allocation and the gainBonusAp fix? If not, it may be a plugin conflict. 😅

Other stuff to check:
  • Plugin version - Stat Allocation (paid) is currently at v1.02, and
  • Project's core script version - latest is v1.6.2 (I believe it's identical, code-wise, to v1.6.1).
    Update announcements & relevant instructions can be found here: link.
So, I actually found a workaround that using items* that I really like, which is built into YEP_StatAllocation to cost items instead of AP: since I was already using a evented system I created to turn "gold" (which in my game is not at all "gold" but that's neither here nor there) into AP, this is actually tidier as it lets me do the same thing with the basic "shop" function. Turning "gold" to higher stats is the net result I'm going for, and "buying" items in the "shop" is a slightly less kludgy bridge to that than I would have been able to achieve using AP anyway. All I had to do was come up with a cool sounding name for the items what it costs to raise stats (I went with Yggdrasil Seeds, for now).

For what it's worth I have v1.02 of Stat Allocation and v1.6.2 of YEP Core, and while I haven't tested it in a new project, I'm 98% sure that the two or three plugins I have installed at this point that aren't Yanfly could be causing such a specific and acute issue with a Yanfly Plugin.

* Oh, and incidentally, yes the plugin includes the option to use different items for different parameters, I chose to use one universal item
Oh neat! I'm still not sure why the original approach didn't work out for you, but good to hear you found an alternative~ 😂

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-stat-allocation-cannot-add-additional-ap.117694/