Is there a way to make skills call other skills?

So here's what I want to do: I want to have a skill that we'll call Skill A. Skill A is to be used on a targeted enemy, and after playing it's skill animation, it will then call a random skill from a list of eligible skills, which will then target the same enemy that was previously chosen - except in certain conditions where it will target the user of the skill. Basically, it's a skill that performs random actions, similar to Hocus Pocus from Dragon Quest or Metronome from Pokemon.

So... um... how do I do that?
Well, you could try this plugin and see if it works in MZ, either on its own or through FOSSIL, otherwise I'm gonna refer to a post of Andar's from several months back:

the default method would be to attach a common event and then have a control variable followed by a list of conditional branches to select which skill to use with force action.

scripts or plugins can only partially help at that moment. They can make shortcuts for the conditional branches for example, but basically have to go the same way as the events.
This is when you're going to make use of the Common Event under that Skill.



What you will do is this:

Go into your Skill A in the database.

In your Parameters box for Skill A, there should be "Other" at the very end of the tabs. Choose that, then choose Common Event. This will link your Skill A to some Common Event you pick.

So whenever this skill is used in battle, the Common Event will be ran. This is when you can implement other Skills to be activated via "Force Action" command under Page 3 of Event Commands, all within this Common Event.

You can of course use Control Variable, and have it determine a random value range you pick (such as 0-2), then under each value of 0, 1, 2, use an If-Then conditional branch to tell which Skill is Force-Actioned.


When it comes to things like this, the key trick here is to really give the character access to many different skills at once, so you'll definitely need to make more skills if they don't already exist, to Force Action those extra benefits you want in your Skill A. But that's how it goes!
Well, you could try this plugin and see if it works in MZ, either on its own or through FOSSIL, otherwise I'm gonna refer to a post of Andar's from several months back:

Lemme try that plugin first and report back. If it doesn't work, then I'll try the common events route.

Edit: Hmm... Well, it does work, but it chooses random targets rather than the same target. That's fine I suppose, since it *is* a skill revolving around randomness, after all. I just kind of would have preferred it to focus on the same target if I could. It's fine though. Thanks! 😀
Lemme try that plugin first and report back. If it doesn't work, then I'll try the common events route.

Edit: Hmm... Well, it does work, but it chooses random targets rather than the same target. That's fine I suppose, since it *is* a skill revolving around randomness, after all. I just kind of would have preferred it to focus on the same target if I could. It's fine though. Thanks! 😀

Couldn't help but notice your edit.

I know you say the plugin works for now, but if you do a Common Event approach like we described earlier, you should be able to perform the randomness on the specific target by making your Forced Action Skill's Scope 1 Enemy. (To my knowledge, this would make the Forced Action be used on that specific enemy).

If it works for you anyway, great! But know there are still options if you want to go with your preference.
To my knowledge, this would make the Forced Action be used on that specific enemy
not directly, because the common event by default loses the target designation upon being called.

however there are several ways to provide the original targeting data to the common event, it will just make the event longer and a bit more complex to handle that.
MZ offers Control Variables -> Game Data -> Last for getting recent subject/target info.

That said, I think the shortest option would be to use a Force Action script call, because the command doesn't allow variable designations. Use a target index of -2 for the subject's most recent target. E.g. in a Script command in a common event attached to skill A (untested):
JavaScript:
// List of skill IDs for eligible follow-ups
const ids = [15,16,17,18,19,20];
// Get subject and random skill ID
const subject = BattleManager._subject;
const skillId = ids[Math.randomInt(ids.length)];
// Force Action
subject.forceAction(skillId, -2);
BattleManager.forceAction(subject);
this.setWaitMode("action");
The target index will only be considered for skills with a scope that allow manual target selection in the first place.

Note that if you try to use a follow-up skill that targets the other unit (e.g. A aims at One Enemy, but B aims at One Ally) then the target index will be used, but on that unit. That shouldn't cause an error due to the engine's built-in target smoothing (for if the target is brought out of scope before the skill invokes, e.g. by dying). If you want to work with different unit scopes, you could use the usual Control Variables -> Random, then Conditional Branch to split into 2 cases, each with their own force action stuff. In the script call you can replace the -2 with -1 for a random target.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-make-skills-call-other-skills.153539/