Skill that effects both user and target?

Okay, so for my project I want to include a "protect" skill, where one party member can increase another party member's defenses at the expense of their own.  I've made two states, "protected" and "protecting" which do those things, respectively.  However, I don't know how to make a skill give states to two people at once.  Is there a script call I can use, or should I just find a different solution?
Set the skill's target to One Ally, then put this at the start of your damage formula:


a.add_state(id);


and if it does any damage/healing, add that formula at the end.


Replace id with the id of the state you want to add to the person using the skill.  Don't put any leading zeros.
Just in case your skill damage is set to "None" you can add the effect to the user using a common event. But if you ask me I would avoid that solution...it is better to use a formula as Shaz said (which means change your skill to have a formula). Anyway, if you only have a single character who can cast that skill the event might be a good idea since there is no mistake when applying your state.

Original thread: https://forums.rpgmakerweb.com/threads/skill-that-effects-both-user-and-target.70531/