Diretooth

Lv. 25 Werewolf
Veteran
Joined
Mar 10, 2013
Messages
1,231
Reaction score
445
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
286
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,359
Reaction score
1,769
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
445
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
286
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,359
Reaction score
1,769
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
286
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,359
Reaction score
1,769
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:
 

Latest Threads

Latest Profile Posts

Nearing completion of the first major city of Albert, a vacation getaway city built a long time ago by a king who really didn't want to be invaded.
It’s definitely a great day to fit in some time for me to play no mans sky on PS4
Julyon.png

First concept art of one of our main characters love interest who might turn evil depending on her decisions. Or become king of the world. Or marry her. Maybe even everything at once.
Me: *saved the game*
Also me: *exit the game afterward*
The game: "Any unsaved progress will be lost"
Me: "uh,.. alright?"
[I feel a bit sad I did this]
"WhY?...WhY dId YoU KiLl ThEm AlL?...yOu BlOoDy HeLl MoNsTeR...I'LL MAKE YOU PAY!!! FOR THE BLOOD OF THE LOST!!!" ~Scars final words before his final battle [not final boss]

Battle Theme: Blood of the Lost
Face Sprite
Forgotten Eclipse_Scar Dead+Final Battle with him.png

Forum statistics

Threads
110,269
Messages
1,051,841
Members
143,292
Latest member
FinalPerigee
Top