MV Swapping Skill types between Actors?

Hi! This is my first post on the forum. My problem I need help fixing is that I have a gimmick skill in my game that can do a wide variety of things: Flavor text, status effects, change music, that sorta thing. One of it's features I've been trying to implement is swapping the magic skills between my two party members: Xaxis, & Happyman. Essentially, all of Happyman's magical abilities will be given Xaxis and vice versa until the end of combat, where a common event will be ran that switches them back.

Xaxis has Skill Type 1, and Happyman has Skill Type 2, and the code below is meant to switch them respectively.

My relevant plugins:
YEP BattleEngineCore
YEP SkillCore & SkillLearnSystem
SRD_BattleEndEvents

I tried using the base features in the event manager of changing actor classes & learning/forgetting skills, but that really wasn't effecient for what I was wanting. I searched the web, but couldn't really find anything about swapping skill types. So, not being very experienced with JS, I turned to GPT (as a last resort, mind you) to see if it could help out with swapping them. This is the common event scripting that is supposed to swap their skill types, and the second one is the common event that plays afterward.
1748901103586.png

1748901112580.png


However. Nothing really works. Everytime I run the relevant skill, "Smile", their magic skills are still the same. Each actor ID, and Skill type ID lines up with what the scripting is intending to do, and I know the common event is running since I always see the "swapped" text box appear during battle. I have thoroughly checked all of those variables to make sure they're in order, but nothing seems to ever happen when I use the skill to swap them.

Please let me know what I am missing. If something is wrong with the scripting, I am happy to change it (I had a feeling GPT wouldn't work). Additionally, If I need to provide more context, like screenshots or even footage, I am happy to provide those as well. Thank you!
try combining it into one script event command. you lose your declared variables once the command ends.
Although, im surprised there was no crash once the 3rd command ran for skillsA not being defined
as mentioned above, the script command is boxed and looses most of its data when it finishes.


that said, there is another option:
have your actors both learn all skills, but give them only one skill type each - the skills for whose there is no skill type will vanish.

then make two states that each seal the one skill type and add the other. Have your change skill give each actor the state that switches their skill types.

Original thread: https://forums.rpgmakerweb.com/threads/swapping-skill-types-between-actors.178100/