Yanfly Stat Allocation: Cannot add additional AP.

Diretooth

Lv. 25 Werewolf
Veteran
Joined
Mar 10, 2013
Messages
1,231
Reaction score
444
First Language
English
Primarily Uses
RMMV
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.
 

CrowStorm

Storm crow descending, Winter unending.
Veteran
Joined
Sep 7, 2018
Messages
314
Reaction score
285
First Language
English
Primarily Uses
RMMV
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.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
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. :)
 

Diretooth

Lv. 25 Werewolf
Veteran
Joined
Mar 10, 2013
Messages
1,231
Reaction score
444
First Language
English
Primarily Uses
RMMV
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^
 

CrowStorm

Storm crow descending, Winter unending.
Veteran
Joined
Sep 7, 2018
Messages
314
Reaction score
285
First Language
English
Primarily Uses
RMMV
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 ?
 
Last edited:

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
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. :kaoswt:

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.
 

CrowStorm

Storm crow descending, Winter unending.
Veteran
Joined
Sep 7, 2018
Messages
314
Reaction score
285
First Language
English
Primarily Uses
RMMV
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
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,087
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
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~ :kaojoy:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top