Trying to make an Item to target a choice actor and only if the class is like warrior

Title says most of what am trying to do. I do not know if this is the right spot for it am new. I am trying to make a Item effect target the actor I select and only change the class of said actor if it matches for the upgrade so like if actor 2 is warrior change to berserker.

I managed to get it to change any actor i select by using a damage formula b.changeClass(5, true) but that does not care for what class it is.

Trying to do this outside of battle.
give the item a common event effect and an effect to add an invisible target state.
remove the original effect you had.
in the common event, for every actor check if they have the target state.
if yes, remove said state and check if they are the actor and class that is supposed to use it.
if yes, make the effect with the commands
if not, abort the common event.

depending on whether you want it consumable or not, have the common event remove it from inventory but NOT set it as consumabloe in the database as that would consume it even if wrong target.
would that have to be multiple if statements or like a for loop or while ? am hella new to this
multiple if statements because you can only check for a specific actor with the command
kk ive attempted that and the issue coming up is if I got 2 warriors it change both of them instead of the one am using said item on
then somehow both of them got the target state, or you didn't write the common event like my description.
screenshots of item and common event please.
I read it more closely i forgot to do the check state part and its working now Ty for your help. This is what i ended up with

◆If:Class of Harold is Warrior
◆If:Harold is affected by bers
◆Change Class:Harold, bers, true
◆Change State:Harold, - bers
◆
:Else
◆Change State:Harold, - bers
◆
:End
◆
:Else
◆Change State:Harold, - bers
◆
:End
◆If:Class of Therese is Warrior
◆If:Therese is affected by bers
◆Change Class:Therese, bers, true
◆Change State:Therese, - bers
◆
:Else
◆Change State:Therese, - bers
◆
:End
◆
:Else
◆Change State:Therese, - bers
◆
:End
◆If:Class of Marsha is Warrior
◆If:Harold is affected by bers
◆Change Class:Marsha, bers, true
◆Change State:Marsha, - bers
◆
:Else
◆Change State:Marsha, - bers
◆
:End
◆Change Class:Marsha, bers, true
◆
:Else
◆Change State:Marsha, - bers
◆
:End
◆If:Class of Lucius is Warrior
◆If:Harold is affected by bers
◆Change Class:Lucius, bers, true
◆Change State:Lucius, - bers
◆
:Else
◆Change State:Lucius, - bers
◆
:End
◆
:Else
◆Change State:Lucius, - bers
◆
:End
in the first sequence, you have a line with Lucius instead of Harold
ye I noticed that and changed it right away i was copying lol from when i did lucius

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-an-item-to-target-a-choice-actor-and-only-if-the-class-is-like-warrior.177640/