Changing Scope of Skills... Is it Possible?

So, I'm trying to make a skill that deals damage to one target until a specific state is applied to the user. After the state is applied the skill should target all enemies. The problem is that I have no idea how to pull this off, even after doing a bunch of research. ( Maybe my google skills just suck? XD) Has anybody here done something similar or know of a way that might make this work?
Let me see, can a skill call a common event?
Yes.
Effects > Other > Common Event.

So you first have to make the common event in the database.
It will contain a conditional branch that will check the player if is on the state you wanna check.
There is a problem though. How do we target the originally targeted enemy troop?
Code:
◆If:Harold is affected by Rage
  ◆Change Enemy HP:Entire Troop, - 100
  ◆
:Else
  ◆Comment:PROBLEM:
  :Comment:How do we target the originally targeted enemy troop?
  ◆
:End

Can someone come with a "script" command for this?
You can do this with plugins. I would imagine that Yanfly's TargetCore lets you do it. However you'd probably need to use the Lunatic Mode – Custom Target Eval, which does require some JS knowledge.
Yanfly's target core is a good way to do this, you can also do it with a common event and a script call, as @Dreadshadow said.
I was pretty sure I already answered a similar question, and a quick search confirmed it. See this topic: https://forums.rpgmakerweb.com/inde...e-target-in-a-common-event.64068/#post-617238

For target core, the condition would simply look like:
Code:
if (user.isStateAffected(stateId)) {//Scope change here}

I don't use target core so I don't know the syntax of the scope change itself, but it's likely to be explained in the plugin's help file.
Or make 2 versions of the skill in the database (1 single-target, 1 multi-target). Check each turn if actor has state on him, and change his skill accordingly.
I was pretty sure I already answered a similar question, and a quick search confirmed it. See this topic: https://forums.rpgmakerweb.com/inde...e-target-in-a-common-event.64068/#post-617238

Ah, I'm sorry! I should've looked harder. Thanks for your patience in answering the same thing twice.

Looks like Yanfly's target core is the way to go. It's funny 'cause one of the first things I did was go through Yanfly's plugins and I still somehow missed it.😅 Guess if there's a big take away it's that I need to be way more thorough. XD Thank you all for your help, I'm excited to get things rolling again!
$gameVariables.setValue(1,BattleManager._action._targetIndex) // variable 1 now contains the index of target enemy/actor

That is what you should run, using a script event command. You can set another variable to contain the id of the target, by changing 1 to the ID of the variable you want to store the data.
The problem on the ELSE branch is solved that way.

Now having a variable with the id, you just make conditional branches for each case (1 to 8) to target the right target.
Nice link @Astfgl66 kudos!

I bookmark this one for future reference to other members.


Or make 2 versions of the skill in the database (1 single-target, 1 multi-target). Check each turn if actor has state on him, and change his skill accordingly.

Incredibly simple. It can cause trouble on some cases, but I find this solution 100% Event based and I really can't believe I didn't think of that!!!

Original thread: https://forums.rpgmakerweb.com/threads/changing-scope-of-skills-is-it-possible.107026/