Yeah, I don't get it either.
The battle test works normally if I remove your script, but messes up with it in, so it's probably a compatibility error between your script and another.
So I moved your script as far to the top of the script list as I could manage and it fixed the problem.
I really don't see how your script would affect anything in battle at all though. Maybe it was some kind of interaction with Yanfly's party or battle system, if I had to guess.
Anyway, this is pretty nice to have for games with a lot of recruit-able characters, but I bet it can have a few other applications with some modifications. Like it could be used as a character select screen, for example.
Personally, I'd like to try to tweak this so it's a "contacts list" in the main characters phone (game has modern setting) so when you select a character off the list, it displays a message and flips a switch (probably just have the script call a common event. and I could set the message/switch though that) so that you can call a character you've recruited through the phone and you can arrange to meet them at a nearby meeting place. Then I'd set up an event to have the character waiting at said place based on which switch was flipped.
So, how hard would it be to modify this script to call a common event based on what actor you've selected?
Or alternately, maybe just have the actor ID return to a single variable, and then that variable can be used in one complex common event instead of many simple ones.