RMMZ Lag spikes with passive state conditions (Visustella Skills States Core)

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
I tried asking this in the notetag help thread but didn't have any luck:

So I set up an equipment piece with a Passive state with a passive condition:


<JS Passive Condition> if (user.hp / user.mhp >= 0.9) { condition = true; } else { condition = false; } </JS Passive Condition>

So this code works, the problem is that hovering over the equipment that has this passive state in the Item or Equip menus causes a massive lagspike (the game freezes for 2-4 seconds).

Did I do something wrong with how I structured the code or is this lagspike just supposed to happen due to the calculations?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,167
Reaction score
7,371
First Language
Indonesian
Primarily Uses
RMVXA
The code within the tag seems alright. The lag spike must be because of something else.
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
Yeah, that's what I was afraid of. meh

I guess I'll try reporting it to the team as a bug...
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
474
Reaction score
687
First Language
German
Primarily Uses
RMMV
Well are you sure that it is THAT specific plugin from VisuStella that causes the lagspike?
Because if you are the only one experiencing this problem, then the problem may come from elsewhere.
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
Well are you sure that it is THAT specific plugin from VisuStella that causes the lagspike?
Because if you are the only one experiencing this problem, then the problem may come from elsewhere.

Accounting for all other plugins, disabling Visustella's ItemsEquipsCore prevents the lag spike in the item menu since equipment stats aren't shown in the base item menu.

The equip menu still has a *small* lagspike, it's noticeable but nowhere near as bad as the original 2-4 second lagspike with ItemsEquipsCore enabled.
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
So I made a blank project with nothing but Visu's core, item/equip, and skill/states core, tried replacing the code with something Trihan suggested in the Notetag help thread.

I once again made a piece of equipment that grants a passive state with this condition:


<JS Passive Condition> condition = user.hpRate() >= 0.90; </JS Passive Condition>

I still get the same result: massive lag spikes. Checking the console reveals this:

1613247103067.png

Anyone have *any* idea why this is happening or what I'm doing wrong?
 
Last edited:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,167
Reaction score
7,371
First Language
Indonesian
Primarily Uses
RMVXA
It is possible that the calculation of the hpRate() could go through a complicated computation, but I don't believe that was the case. Try to make the condition simpler, such as checking the variable value if it is bigger/smaller. See if it still lags.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,935
Reaction score
1,395
First Language
Portuguese - Br
Primarily Uses
RMMZ
Your code seems fine to me. Even the first one(on the first post). There is no way that a if statement can cause lags.

This error is related to this:

I have a lot of ideas on what can be a cause of the error, but just ideas on the wind xD

Unfortunally, I believe only the Visu team can help you there.
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
I've tried a few different variations with the same result, but I've noticed something interesting: making any equation that involves "user.mhp" causes the flurry of RangeErrors above. Working with just "user.hp" works normally.

Unfortunately, I'm wanting the passive state to check what the user's current hp is to their current max hp - and anything involving max HP causes the overflow error. Even just setting a variable to the user's max HP causes the stack overflow.

I guess I'll try to submit a bug report to VisuStella...
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,935
Reaction score
1,395
First Language
Portuguese - Br
Primarily Uses
RMMZ
Well, guess I have one more in my "to do" list xD
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
@Eliaquim it turns out the "passive states stopped working thing" was a legit problem and got hotfixed after I reported it.

The maxHP thing I referred to is still a problem, so I went ahead and reported that too. We'll see what happens!
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,167
Reaction score
7,371
First Language
Indonesian
Primarily Uses
RMVXA
Hey now that the more I think about it, the more that the lag actually makes sense.
Here is why...

First of all, max hp is calculated based on various traits. Including actor, class, weapon, armor, and yes, states. This is probably not what your passive state does, but what if you make a state that increases max hp by 120%while adding user.hpRate() > 0.9 as the condition. Yes, that would create a paradox and infinite loop!

But even if the state is not actually increasing the max hp, it still causes a loop (I only mention that to demonstrate that states affect max hp). First of all, when you query the user's max hp, it queries the available states. By default, it would be alright, but when you add passive states with JS syntax condition that querying user max hp, there you have the problem.

To put this simply
Query: maxHP --> calculate the max hp --> querying states (passive included) --> Passive states requires the amount of max HP resolved first --> calculating the max hp --> infinite loop.

I hope that makes sense.
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
@TheoAllen That makes sense. Still, I assume there must be some way around the problem. I was able to replicate the issue in a blank project (with no other states besides that one passive) and Yanflys passive states plugin for MV always worked without issue for me when doing similar max HP calculations.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,167
Reaction score
7,371
First Language
Indonesian
Primarily Uses
RMVXA
It is not impossible. The passive state application must be designed in a certain way to avoid this problem (I might make my own version of passive state). Unfortunately, I can not help you with Visustella's problem for obvious reasons.
 

jkweath

Goes Fast
Veteran
Joined
Sep 21, 2016
Messages
400
Reaction score
599
First Language
English
Primarily Uses
RMMV
Of course. I reported it to VisuStella, and thankfully...

1613774502975.png

They fixed it! Problem solved :kaoluv:
 

Latest Threads

Latest Profile Posts

Can February March? No, but April May.
Alisa: Prophecy of the Falling Stars. Join Alisa, a quiet girl with a heart filled with love and hope, on her journey to prevent a calamity. My next RPG Maker music pack is my largest and most focused pack yet. It's a musical story that focuses on a young heroine named Alisa who has been assigned the ultimate task to prevent a calamity.

SnJj_O.png
Alien Worlds, Minecraft Blocks, Extend Options, Fine Speed Control, Art by Muggu | RPG Maker News #33

Rest in Peace vlog gun...
vloggunsmallface.png

Forum statistics

Threads
111,164
Messages
1,058,885
Members
144,408
Latest member
Bretzel68440
Top