Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,660
Reaction score
2,252
First Language
English
Primarily Uses
RMMV
So I've been using common events as a part of my stat allocation system for some time now. They were simple before, merely using RM's stock event commands like so:
1642993987573.png

However, that was before I decided to switch to a %-based bonus for my stat allocation instead of flat integer values. Thus, I had to change my common events into something like this:
1642994886174.png

Unfortunately, that threw the following error:
1642994156556.png

I then attempted to simplify the script in an effort to find the root problem. But I get the same error even when I try something simple like $gameParty.menuActor().isStateAffected(301) or even just $gameParty.menuActor()! So I double-checked in the console to make sure I didn't make a typo or anything and sure enough, the code works fine there! So what am I doing wrong?...
1642994404609.png

EDIT: Ok, I just tried the most utterly basic statement I could think of: 1 > 0
That should obviously return true, but alas, I'm met with the same error as before...
1642995896290.png
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,047
Reaction score
2,467
First Language
English
Primarily Uses
RMMV
If you're asking if (1>0) and getting a TypeError cannot set properties of null, that's clearly not coming from the contents of that script call.

How are you calling that common event?

If you Google that error, it usually indicates trying to reference a variable/function before it's declared. In RPG Maker, that would translate to having plugins in the wrong order - is any part of this boosting a stat process using code you put into a plugin that you can try adjusting?
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,660
Reaction score
2,252
First Language
English
Primarily Uses
RMMV
I guess it must be because of @SomeFire's skill tree plugin, which is what I'm using as the basis of the stat allocation system. Well, at least that narrows it down, thx lol.

Edit: Strange...it seems even the mere presence of a conditional branch throws that error.
1643004694024.png
 
Last edited:

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
469
Reaction score
387
First Language
English
Primarily Uses
RMMV
Found this inside the SkillTreesConfig plugin:
/**
* Will call common event with specified ID.
*
* WARNING! Some event actions have no immediate effect, so, game can freezes until effect's end.
* Or effect freezes while you are in the menu.
* For example, text messages will appear only when you close menu and return to the map.
*/

Is the error throwing only when you try to press 'ok' to learn a skill in the skill tree scene?
If so, have you tested if you can call the common events in question from the map without the error?
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,660
Reaction score
2,252
First Language
English
Primarily Uses
RMMV
I actually just tried a bunch of event actions in @SomeFire's demo project and got the same error as before with a lot of them. So I guess it's just an innate issue with the plugin...
1643010259911.png

This brings me to my current situation. Basically, I have 120 states, or 20 states for each primary stat. There are 20 because each one is +1% of that stat. So the 1st state would give an ATK x1.01 trait. The 2nd state would be ATK x1.02 and so on... Anyway, I really don't want to create 120 common events if I can avoid it. So since I can't use most of the flow control in common events with this plugin, how else can I go about this?
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
469
Reaction score
387
First Language
English
Primarily Uses
RMMV
I'd have to look at the plugin help file more closely and see what options are available.

I am slightly familiar with the plugin already, but I want to ask couple questions about it first.

1. When you learn the skill in the menu, it calls a common event which handles raising the stats?

2. Is calling the common event the only way to inact those changes or does the plugin have a lunatic code mode for evaluating Js?

3. Have you tried moving the skill tree plugin above/below your other plugins?

I've gotten many plugins to work by moving them below or above the plugin that was conflicting with it, which seems like the most likely situation as mentioned above.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,660
Reaction score
2,252
First Language
English
Primarily Uses
RMMV
Oof...just had a blackout last night. Good thing I save frequently lol.

1. When you learn the skill in the menu, it calls a common event which handles raising the stats?
Yes, that's the plan anyway. And it worked well when just applying flat stat increases.

2. Is calling the common event the only way to inact those changes or does the plugin have a lunatic code mode for evaluating Js?
No lunatic mode, but there are other approaches as well. For example, I could attempt to bundle the stat boost effects in the form of a skill/state package instead. But that's not as elegant a solution.

3. Have you tried moving the skill tree plugin above/below your other plugins?
Seeing as how the error remains when I have literally no plugins other than the skill tree plugin, I'm guessing plugin order isn't the issue.
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
469
Reaction score
387
First Language
English
Primarily Uses
RMMV
Do you use yanfly buffs and state core?

There might be a way to make a state that can use a game variable in its calculation.

So your first skill in each category can add the state and then each skill after that can just increase the variable.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,047
Reaction score
2,467
First Language
English
Primarily Uses
RMMV
That whole thing with the states seems like a very cumbersome approach. Why not just use a variable on the actor to track how many times you've upgraded a given stat?

Yanfly's Stat Upgrade Tip & Trick gives an example of this (for that matter, you might do well to use the Skill Learn and this stuff in place of the plugin that's throwing these errors).
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,660
Reaction score
2,252
First Language
English
Primarily Uses
RMMV
That works for flat integer stat boosts. But I want to apply, for example +1% of a stat, then +2% and so on...

I don't want to stack multiple instances of +1% cuz they would be multiplicative instead of additive (1.01 x 1.01 ≠ 1.02). This stat allocation system would literally be the only thing in the entire game that modifies a stat via multiplication. All other skills, states, gear, & effects in my project modify stats in an additive manner. As in, no percentages, except the stat allocation system as I just mentioned.
 
Last edited:

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
469
Reaction score
387
First Language
English
Primarily Uses
RMMV
I think if you can figure out the math, the method mentioned above would likely be easiest to set up.
Math is not my strongest subject, but wouldn't something along these lines work?
<Learn Cost Eval>
// Set the param ID of the stat you wish to adjust.
var id = 0;
// Adjust the number of times upgraded by 1.
user._upgradeParam[id] += 1;
// Increase the parameter by this amount.
user._paramPlus[id] += user._paramPlus[id] / 100 * user._upgradeParam[id];
// Make the user forget the skill.
user.forgetSkill(skill.id);
// Refresh the user.
user.refresh();
</Learn Cost Eval>

Or am I getting it backwards and this is what you don't want to happen?
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,660
Reaction score
2,252
First Language
English
Primarily Uses
RMMV
Hmm, maybe not exactly, but close enough that I can perhaps adapt it for my needs; thanks! I'll have to use a different note-tag as well since learning it via the skill tree plugin doesn't invoke the learn cost eval. But I just spent all day rearranging my garage, so I'll attempt this tomorrow lol.

Edit: What if I just preload an actor with all the stat allocation states (as in all the ranks) and have conditionals on these states (which are passive states, btw) so that they only take effect when the appropriate variable is at a certain value? Then I'd just make the common events for the stat allocation adjust that variable as needed. As long as I avoid the flow control stuff, I should be okay...I hope, lol.
 

ThreeSixNine

Veteran
Veteran
Joined
Jan 22, 2019
Messages
469
Reaction score
387
First Language
English
Primarily Uses
RMMV
I have a similar setup for a weapon mastery system. Its using quite a few...(1 per weapon type, per mastery level) passive states.

I've recently been thinking about finding a way to calculate the mastery level into the states stat boost so I can be using only 1 state per weapon type per mastery level.

But, I've added in the weapon mastery level property for each actor myself so its easy to track the character utilizing the state and factor their mastery level into the formula.

You might be able to do the same thing using one of the skill tree custom actor properties. Maybe there's one similar to the yanfly upgrade count.

I think the problem with using states and variables will be how to handle each actor separately. If the common event raises the same variable each time any actor learns the skill, every actor is going to have the passive take effect at the same time.

Since the plugin won't allow you to use conditionals, theres no way to control which variable is being changed when a skill is learned.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,660
Reaction score
2,252
First Language
English
Primarily Uses
RMMV
I think the problem with using states and variables will be how to handle each actor separately. If the common event raises the same variable each time any actor learns the skill, every actor is going to have the passive take effect at the same time.
Yes, this is precisely what I've been stuck on for the last 24-hours, lol.

Edit: Actually, now that I think about it...the conditionals would be on the state itself. The common event triggered by the stat boost system would only need to do something like this:
JavaScript:
$gameParty.menuActor()._xSTR = $gameParty.menuActor()._xSTR || 0;
$gameParty.menuActor()._xSTR += 1;
$gameParty.menuActor().refresh();
The states would simply use the <Custom Passive Condition> note-tag:
1643096307321.png

EDIT2: EUREKA! IT WORKS!! :kaopride:
 
Last edited:

Latest Threads

Latest Profile Posts

one of the coolest things I've learned from the forums is the ability to give yourself a hitbox. I have a move you can do on the fields. shoulder tackle. thanks to the forums, that tackle triggers self A switches on some events. NPC's and the environment now react to the tackle. awesome.
I really liked how this one turned out! :kaopride:
WYqMPf6.png

Character (Yes, this is a character): Nibiru the Primal Being from Yugioh.
Dragon Quest style enemy selection plugin work in progress:

Quest_Targeting.png

It's a simple targeting system from the NES era. Select an enemy group; single-target skills will target the first enemy in that group.

Quest-Targeting-Animated.gif
Somehow that granny topic got me... maybe I can come up with some more thematic stuff :3
Going live for tonight's stream! Kytt isn't feeling 100% tonight so the wifestream will be tomorrow and I'll be playing Final Fantasy XIV for this one instead. Twitch

Forum statistics

Threads
121,935
Messages
1,145,269
Members
160,207
Latest member
RiceKun
Top