Change scope and effect of skill

I'm making a game where the goal is to have what is effectively spells. Following my design philosophy I would really like for this relatively simple functionality, and I'll use a really simple example:


Say that I have a cleric. He has a spell called "Holy light". What I want is for him to be able to cast holy light either on a friend in need to heal him, or on an enemy undead in order to kill it. However, perhaps there's a perfectly human necromancer amongst the undead and he mistakenly heals him instead.




https://yamiworld.wordpress.com/rgss3/battle-scripts/invert-targets
 


These are two scripts I've attempted to download in order to at least get part of my goal down. As honestly just changing targets between an enemy and friend would go a long way, the other bit being mostly an added bonus. Unfortunately both of these scripts are currently unavailable. ;_;


Any and all help will be greatly appreciated!

Original thread: https://forums.rpgmakerweb.com/threads/change-scope-and-effect-of-skill.59677/