Hi all!
I'm trying to use a custom formula that checks an actors %hp and then triggers a state based on the result of the check. I'm using Yanfly's Auto-Passive Traits, here is what I have
<Custom Passive Condition>
if (actor(1).hp / actor(1).mhp <= 0.10) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>
It returns a "Range Error Maximum Call Stack Size Exceeded" error.
T___T I don't know what to do please help if you can. Any other advice/links you could offer on general battle script command and such would be amazing too. Thanks for your time forum! I really do appreciate it
~Moo
1 - Your code is totally wrong (there is no "actor(X)" function, to retrieve the actor you need to use '$gameActors.actor(X)')
2 - There is a function that returns the the hp rate. it's .hpRate(), so the conditon could be $gameActors.actor(X).hpRate() <= 0.1
3 - Do you want the state to check the actor under the state or another actor? If the state checks the actor under the state you don't need to use the <Custom Passive Condition>, use the <Passive Condition: HP Below x%> instead,
Hi Victor! Thank you for replying so quickly!! Sorry, my original code was indeed
<Custom Passive Condition>
if ($gameActors.actor(1).hp / $gameActors.actor(1).mhp <= 0.10) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>
but that it was gave me the RangeError.
I do want to check another actor, not the actor under the state.
I just tried this solution,
<Custom Passive Condition>
if ($gameActors.actor(1).hpRate() <= 0.1) {
condition = true;
} else {
condition = false;
}
</Custom Passive Condition>
but I still get the RangeError: Maximum Call Stack Size Exceeded
When you get the error again, press F8 and copy and paste the contents of it into a spoiler tag in your reply.
What's the state? What are the remove conditions for the state? One thing I learned is if the state has remove by restriction in the state, ACE (and probably MV, as the code is very similar) will go into an infinite loop of removing/adding the state if you use that state in a passive, and crash the game.
Just to point out that the issue is either a compatibility or order issue like StarWarrior mentioned.
I tested it and the condition works when only using the passive states, even with states that are removed by restriction.
Hey Yall!
Sorry I've been gone all day, I'm back home now! Here is the error log, I turned all plugins off, checked the Yanfly Website for plugin order recommendation (she said anywhere for this plugin) and I still have error, here it is:
RangeError: Maximum call stack size exceeded
at Game_Actors.actor (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/rpg_objects.js:4556:35)
at Game_Actor.eval (eval at <anonymous> (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/plugins/YEP_AutoPassiveStates.js:351:15), <anonymous>:1:17)
at Game_Actor.Game_BattlerBase.passiveStateConditionEval (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/plugins/YEP_AutoPassiveStates.js:351:5)
at Game_Actor.Game_BattlerBase.meetPassiveStateCondition (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/plugins/YEP_AutoPassiveStates.js:327:17)
at Game_Actor.Game_BattlerBase.getPassiveStateData (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/plugins/YEP_AutoPassiveStates.js:313:17)
at Game_Actor.passiveStatesRaw (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/plugins/YEP_AutoPassiveStates.js:393:31)
at Game_Actor.Game_BattlerBase.passiveStates (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/plugins/YEP_AutoPassiveStates.js:294:30)
at Game_Actor.Game_BattlerBase.states (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/plugins/YEP_AutoPassiveStates.js:280:31)
at Game_Actor.Game_BattlerBase.traitObjects (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/rpg_objects.js:2359:17)
at Game_Actor.traitObjects (file:///C:/Users/imaekgaymz/Documents/Games/Base%20Project/js/rpg_objects.js:3794:55)
Thank you for all your help!!!
Try updating the plugin, if this still don't work, simply use another plugin. There are at last 3 others passive state plugins with the option to use script code conditions.
Since there are options available, it's more produtive to check if any of the other options works as intended rather than lose time trying to find a fix for this.
I know this post is old and I might be late on it, I came across it trying to find a fix for my SRD_GameUpgarde plugin and we had the same error, while I was messing around with it, I found that the plugin only works if you move it to the very top of your plugin list. Maybe try moving your plugin to the top, or find a spot that it can work in.
What causes this issue in the first place???