how do i script add state if actor is class

i have all yanfly plugins (almost only yanfly plugins)
this would probably only apply to Buff/State core + auto passive states + skill equip

example: actorX is class: (14)White Mage learn skill: Auto-Regen
need either skill or state note tag (state would be <Passive State: 96>WhmCheck) to add state (97)Regen

so he has regen while on white mage and learned skill auto-regen
but if hes on class other then white mage he only gets auto-regen with the <Equip State: 97> note tag

i found $game_actors[X].class.id if that helps. but i know nothing about how to make $game data things
?guessing it would go in
State Note Tag
<Custom Battle Effect>
code
code
</Custom Battle Effect>

also where could i find a "learning lunatic script" thing and not that jumble of ????
i find in the learn how to make plugins section lol
i found this list of all script calls which looks like it has everything i need.
i just have no clue how to put it together


am i at least on the right track?
been trying to figure this out for 9 and half hours now. im going to bed
its the next day. to reword the current issue its
yanflys class change core + auto passive states + Learned skills
i have all yanfly plugins in order displayed on his site

i need something that can teach/show me how to use that above link so i can make
<Passive State: 97>(Auto-Regen WHM) script call check Class 14(White Mage) addState: 98(Passive Regen)

without a script call the state is staying on after they change class
i need it so the (98)Passive Regen only get added if they are currently on class (14)White Mage

(until they Learn how to <Equip State:> passive tier skills from other classes)
+ Equip Skills/Allow Skill Types/skill tiers
the equip skills is merely a side mechanic outside of the normal class system
So you're either gonna have to learn JavaScript or explain -- slowly -- exactly what you need. Unfortunately, programming lives and dies in specifics.

https://developer.mozilla.org/en-US/docs/Learn/JavaScript

It sounds like you're dealing with several variables here.
  • the character - we'll call this "a"
  • the character class -- we'll call this "b".
  • the character skill - we'll call this "c".
  • the passive state - we'll call this 'd'.
Some psuedo-code so you can tell me if I'm getting the logic correct.

Code:
if a.isClass(b) or a.hasSkill(c):
   a.addState(d)

if not a.isClass(b) and not a.hasSkill(c):
   a.removeState(d)

That'll get you to the point where your character "a" has state "d". Now, we have to think of when this state might need to be removed or re-added.

Well, it'll need to happen when the character's skills change:
Code:
if a.hasSkill(c):
  a.addState(d)

if not a.hasSkill(c):
  if not a.isClass(b):
    a.removeState(d)

And it'll also need to happen when the character's class changes:
Code:
if a.isClass(b):
  a.addState(d)

if not a.isClass(b):
  if not a.hasSkill(c):
    a.removeState(d)

Now in both of those snippets, we're assuming that adding a state to a character that already has it won't do anything, and that removing a state from a character that doesn't have it won't do anything either. These are two unsafe assumptions, so you'd need to wrap each one of the add/removes with a check that the character already has or doesn't have the skill.

I don't know enough about the plugins you're using to determine whether or not you can do it only with notetags. My guess is not, so that brings us back to the link.

Let me know if any of my guesses are incorrect and I'd be happy to be corrected.
state.png

how do i make that state note tag
if actor is class (b) add state (d)
d = 98

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-script-add-state-if-actor-is-class.88317/