Taking Two Consecutive Actions in Battle (With Restrictions)

I'm trying to create a system in battle which allows characters to take a second consecutive action after using skills of a certain type. I want players to be able to use two skills of this type consecutively if they desire (including the same skill twice in a row), but I only want to allow a single bonus turn per actor per round of battle. Furthermore, I'd also like to prevent the actor from using any non-skill actions if they take that second turn (i.e. Attack, Guard, Item, Run). However, I'm not sure how much of this can be done within the engine, how much requires scripts, and how much simply isn't feasible.

Yanfly's Instant Cast plugin does a lot of what I'm looking for, but Instant Cast doesn't normally impose any restrictions on how many times you can use IC skills during each actor's turn. You can chain skills indefinitely until you win or run out of resources, which would ruin the balance of many IC skills I'd like to design. It also still allows the actor to follow up IC skills with non-skill actions like Guard or Item, which doesn't suit the combat system I have in mind.

So I guess there are two parts to my question:

1) Is Yanfly's Instant Cast plugin the best way to implement a mechanic like I've described, or is there something else better suited to this?

2) If Instant Cast is the way to go, what do I need to configure/script in order to impose a restriction that only allows one extra turn per actor, but without preventing an actor from using the same skill again or using other IC skills on that second turn? Furthermore, can I include something to limit the types of actions the player can select during the second turn, so that they can't do things like use an IC skill and then Guard?

I've tried my best to be specific about what I'm trying to do here, but please let me know if I can provide any additional information which would help. Thanks!
One way:
Have the instant cast skill apply a state to the user that seals all skills that they would normally have and add copies of those skills you want them to cast but without the instant cast feature.
You can also try Yanfly's Skill Cooldowns plugin to go along with it. It has a feature that allows you to restrict the use of skills and skill types so that your Instant Casts aren't abused. It should go great with what you're going for!
One way:
Have the instant cast skill apply a state to the user that seals all skills that they would normally have and add copies of those skills you want them to cast but without the instant cast feature.

Thanks for the response! I thought about sealing skills, but one problem I have is that you can switch character classes/subclasses in my game, so I'm not sure how to determine all of the skills each actor would "normally" have. If there's a way to do it, I'd be interested in hearing about it, though.

You can also try Yanfly's Skill Cooldowns plugin to go along with it. It has a feature that allows you to restrict the use of skills and skill types so that your Instant Casts aren't abused. It should go great with what you're going for!

Thanks for the suggestion! Would you mind explaining in a little more detail, though? If I give cooldowns to my Instant Cast skills, they won't be selectable during the second turn, right? Is there a way to only have the cooldown kick in after the skill has been used twice consecutively?


To give a little more context for why I want players to be able to use these skills twice in a row, I mentioned above that I want to make a game with a main class/subclass system. This will afford players a lot of freedom, and consequently, they'll have lots of ways to outsmart me if I try to micromanage what strategies they're allowed to use in such a flexible system.

If, for example, I decided that I didn't want players using a Priest's Instant Cast heal skill to double heal each turn, I could restrict the consecutive use of the same skill twice in a row, or even lock out all of the Priest's other healing abilities. But then maybe the player just gives the Priest a Chemist subclass with healing item abilities and uses those to double up on healing anyways. Or maybe they use a subclass which can apply damage absorption barriers, providing indirect healing with their second action instead.

Consequently, my planned approach is to rely on hard limits in the combat system to achieve balance instead, and that's why I want a system which caps the maximum number of actions per actor to 2 per turn. Players should be able to do as they please within those maximum limits.
I wanted to bump this thread with an update! I've made significant progress on how to implement the system I described above, and there are just two details left unsolved (though I've just begun testing, so we'll see if issues eventually arise).

Using Yanfly's Battle Engine Core and Instant Cast plugins, I successfully found a way to enable a single use of Instant Cast for any skill while switching off Instant Cast as soon as the user takes their second turn. This doesn't require skill cooldowns or sealing skills, so you can use the same Instant skill consecutively, follow up with a different Instant skill, or use any non-Instant skill as well. No matter what, you'll only receive a single extra turn.

Here's a step-by-step explanation of how to do this:

Spoiler
1) Set the battle system to Yanfly's STB.

2) Create a blank state which has a 1-turn duration (auto-removal timing: Turn End) and which is removed at the end of the battle. Let's call the state's ID number "X."

3) Script all Instant Skills to apply State X to the user. For self-targeting Instant skills, you can simply set "Add State X" from the menu in the skill's Effects box. For skills which target enemies, put the script "a.addState(X);" into the damage formula field of each Instant skill (before the actual damage formula). Do the same thing for non-damaging skills which target one or more allies, but set the damage type to MP to get rid of the damage popup.

4) Finally, include the following Conditional Instant tag in the Notes for each Instant skill:

<Instant Eval>
if (!user.isStateAffected(X)) instant = true;
</Instant Eval>

And that does the trick! Enjoy complete freedom using your Instant skills while allowing only a single extra turn per actor.

The two details I haven't worked out are unique to my own desired system. I want players to only be able to select a skill (not other action commands) or to Wait when a character gets the extra turn. Here's what I could use a little help with now:

1) I can prevent a player from selecting the Attack, Guard, or Escape commands just during their extra turn by modifying State X to seal these skills. However, Item isn't a skill, so I can't seal that command. Is there a way to gray out the Item command the same way that sealing skills grays out the others? I want it to stay on the menu, but I don't want it to be selectable.

2) My system requires that all characters have a "Wait" command available so that a player isn't forced to use a skill during their extra turns if they don't want to. There's a "Wait" skill in the game by default, and I want to display it as a standard action command. For something which is standard in many RPGs, this is proving surprisingly tricky.

Setting "Add Skill: Wait" to actors or classes doesn't seem to do anything. Furthermore, I tried installing Bobstah's Battle Command List plugin, but as soon as I turn it on (with all the default settings) and enter battle, I get a "RangeError: Maximum call stack size exceeded" message which immediately stops the game. This happens even in a new project with no other plugins, so it seems like the script itself is broken.

I feel like I've got to be missing something here, because I can't be the first person who's wanted to do this. What's the best way to implement a "Wait" command alongside commands like Attack and Guard?

Thanks again!

Original thread: https://forums.rpgmakerweb.com/threads/taking-two-consecutive-actions-in-battle-with-restrictions.95277/