MV Writing code for Yanfly's Lvl Up Growth Effects

I am writing some code for yanfly's plugin, but I cannot parse what I'm doing wrong exactly. How it's supposed to work is that when you level up, the plugin checks if Variable X is equal to, or lesser than, 495, and if the player's class is Hero, Brawler, Wizard, Rogue.

If Variable X is below 495 and Hero, or any other class that increases the same stat, is their current class, their parameters are increased.

However, I don't know exactly which script calls to use. Yes, I've checked google, have the master list bookmarked and have tried several variations of this.

Code:
<Custom Level Up Effect>
//Increases Total Party Level Variable
$gameVariables.setValue(X,
$gameVariables.value(X) + 1);
//Increases Indiv Character Level Variable P1
$gameVariables.setValue(X,
$gameVariables.value(X) + 5);
if ($gameActors.actor(1).isClass($dataClasses[1, 2, 3, 4]))
$gameActors.actor(1).addParam(2, Math.randomInt(10));
if ($gameVariables.value(X) <= 495)
$gameActors.actor(1).addParam(0, Math.randomInt(10));
$gameActors.actor(1).addParam(1, Math.randomInt(6));
//Heals Current Actor
var heal = 9999;
actor.gainHp(heal);
</Custom Level Up Effect>

Edited for better reading.
please use the code bbcode tag (or click the </> in the textbox toolbar) when sharing code. it preserves your indentations and makes it easier to read.

are you able to identify up to where it stops working as intended? are your variables set to the correct values? just glancing through...
if ($gameActors.actor(1).isClass($dataClasses[1, 2, 3, 4]))
isClass() takes a single class as an argument, so you cant just try to give it a list of classes. but also since $dataClasses is an array, that [1,2,3,4] is only going to ever result in you running isClass($dataClasses[4])
try
Code:
[1,2,3,4].some(c => $gameActors.actor(1).isClass($dataClasses[c]))
please use the code bbcode tag (or click the </> in the textbox toolbar) when sharing code. it preserves your indentations and makes it easier to read.

are you able to identify up to where it stops working as intended? are your variables set to the correct values? just glancing through...

isClass() takes a single class as an argument, so you cant just try to give it a list of classes. but also since $dataClasses is an array, that [1,2,3,4] is only going to ever result in you running isClass($dataClasses[4])
try
Code:
[1,2,3,4].some(c => $gameActors.actor(1).isClass($dataClasses[c]))
Sorry about not using bbcode; not as familiar with forums as I used to be.
Everything else works except for $dataClasses. Once that part of the code works, this all falls into place. I'll give your suggestion a try, but do I simply copy and paste, or is there something more I need to add/replace?
you should just copy it and paste it to replace the line I quoted. if you need to check more classes, put their ids inside the array at the start. but also what you already have should work with class 4, so check if it does
you should just copy it and paste it to replace the line I quoted. if you need to check more classes, put their ids inside the array at the start. but also what you already have should work with class 4, so check if it does
I tried the line of code you gave, and the game crashed. Technically, that's progress Lol. It's saying there's an unexpected bracket, but I'm not seeing it.

The code looks like this when in use in-editor:

Code:
<Custom Level Up Effect>
//Increases Total Party Level Variable
$gameVariables.setValue(485,
$gameVariables.value(485) + 1);
//Increases Indiv Character Level Variable P1
$gameVariables.setValue(486,
$gameVariables.value(486) + 5);
//Increases Parameter
[1,2,3,4].some(c => $gameActors.actor(129).isClass($dataClasses[c]))
$gameActors.actor(129).addParam(2, Math.randomInt(10));
//Increases HP and MP
if ($gameVariables.value(486) <= 495)
$gameActors.actor(129).addParam(0, Math.randomInt(10));
$gameActors.actor(129).addParam(1, Math.randomInt(6));
</Custom Level Up Effect>
Sorry for the double post, but I figured out why it crashed. Lolll

Thank you very much for the help; I can scratch this hurdle off the list.
I tried the line of code you gave
i did say to replace the line, but what i meant was to replace the condition.

Sorry for the double post, but I figured out why it crashed. Lolll
I was about to ask what version of the plugin you were using since iirc the version in the free pack contains an outdated version of it with a bug that could crash the game, but if you figured it out then its all good 🤣

closing the thread now. report it if you need it reopened

Original thread: https://forums.rpgmakerweb.com/threads/writing-code-for-yanflys-lvl-up-growth-effects.178305/