MV Items that give states based on caster (not target)

I want an item to apply a state to a target based on who used the item. (not who it's used on.)
Thank you in advance ^w^
I think you can do this in the damage formula box, something like:

JavaScript:
a.addState(42); your_formula_here
depending on how many different effects you need for your different actors, I'd look at a plugin such as Hime's Effect Conditions or Yanfly's Skill Core to handle them.
I think you can do this in the damage formula box, something like:

JavaScript:
item.subject().addState(42); your_formula_here
I'm not good with Java. I don't know how to use this.
It's JavaScript, not Java.

I'm saying to put your formula in the formula box as usual, then put a.addState(42); before it in the formula box. Also, replace 42 with the number of the state you want to add.
It's JavaScript, not Java.

I'm saying to put your formula in the formula box as usual, then put this.checkPlayerAdjacent() && this.checkPlayerFacingEvent() before it in the formula box. Also, replace 42 with the number of the state you want to add.
I'm confused.
Just to recap, I want to make it so When an item is used by Character x on character y, it gives character y state x. If character z uses it instead, then character y gets state z.
If you only need that feature once, you could also use "Attack States" for this.
(Give the skill an "Add State: Normal Attack" effect and each actor a different "Attack State" trait).

If this is not feasible in your case, I would generally recommend using a plugin like Yanflys Skill Core over using the damage formula, but ultimately both solutions will work. (I would say the damage formula variant tends to look more messy, forces you to have a damage component and can break the "Auto-Battle" trait and other plugins that use the damage formula for a damage preview).

Using the Skill Core plugin you could try to put this into the skills notebox (this example will apply State 42 if used by actor 1, and state 43 if used by anyone else, with a 100% base chance):
JavaScript:
<After Eval>
  if (b.result().isHit()) {
    let effect = {
      code: Game_Action.EFFECT_ADD_STATE,
      dataId: (user === $gameActors.actor(1) ? 42 : 43),
      value1: 1.0
    };
    this.applyItemEffect(target, effect);
  }
</After Eval>
Just to recap, I want to make it so When an item is used by Character x on character y, it gives character y state x. If character z uses it instead, then character y gets state z.
That wasn't what I got form your initial description. (By the way, apparently I pasted in the wrong code without even noticing earlier – I edited my previous post to fix it.)

I'm sure the above will work if there are only two or three characters involved, but if the skill can be used by many different characters, I think I'd do something like this (in the damage formula field):

JavaScript:
a.addState(a.actor().meta.something); a.atk * 2 etc etc

Then you'd add a note tag <something:12> to each actor that can use the skill, where 12 is the state ID. You can replace "something" with any name you want – it just needs to match exactly with the note tag. As written above, it can only contain letters and numbers before the colon. If you want to put spaces or anything else in it, you can write it like this instead:

JavaScript:
a.addState(a.actor().meta['something']); a.atk * 2 etc etc

Note: this approach will not work if an enemy also uses that skill.

Original thread: https://forums.rpgmakerweb.com/threads/items-that-give-states-based-on-caster-not-target.181863/