Locking and unlocking skills *URGENT*

So in my game you battle with two character. They each have a skill type called "COMBO" which are strong attacks but to use them BOTH teammates must be alive and not have a status condition of SLEEP, BIND, RAGE etc because they need to be available to participate.
When one character has for example RAGE, The COMBO skill type is silenced (As it should be because they are occupied)

Here's the issue.
When the character afflicted with the status is cured, The COMBO skill type is still unusable. I made it so that COMBO skill get's disabled but I don't know how to write it so when the status is cured, COMBO skill type is unlocked again. I assumed it would automatically revert once the state is gone but it doesn't.
Here's a few pictures of how I have things written up. If you could tell me how to write it, I would appreciate it.
The skill "Pep talk" removes the status that locked the COMBO skill type but just removing the status doesn't unlock the COMBO skill type again.
activate the else-branch of the conditional branch, meaning the section executed when not affected by the state checked, and use that for change state remove lock state.
From just glancing at the pictures, it looks like you're not removing the combo lock status itself, and THAT's what is sealing the combo type.
This doesn't meet my qualifications of urgent, but I think a can help anyway. A couple things here:

First, the conditional in your combo locker is nested: it's only going to check if Chaco is inflicted with rage if it already finds Kamae is.

Second, you will need to remove the combo lock somehow. You can common event that; it shouldn't be any harder than the lock itself (you could even build all of those into the same event to condense a little). You'll just want to call the removal checker from anything that cures rage/sleep/bind/KO.
activate the else-branch of the conditional branch, meaning the section executed when not affected by the state checked, and use that for change state remove lock state.
Like this so far?
This doesn't meet my qualifications of urgent, but I think a can help anyway. A couple things here:

First, the conditional in your combo locker is nested: it's only going to check if Chaco is inflicted with rage if it already finds Kamae is.

Second, you will need to remove the combo lock somehow. You can common event that; it shouldn't be any harder than the lock itself (you could even build all of those into the same event to condense a little). You'll just want to call the removal checker from anything that cures rage/sleep/bind/KO.
Sorry, I meant urgent as in it's the main mechanic of my game so no progress can be made if it's not solved. I think I get the first part. Is this the right correction?
As for the second part, It was easy enough to set the Combo Lock but I'm having trouble writing it up on how to restore it when the status is lifted.
Like this so far?
not correct - you need to take care where in which branch you are.
your first example gives the lock if only one has the rage, completely ignoring what the other actor has.
with two possibilities and two conditions, you'll have four different combination of rage and not rage.
in three cases you need to apply the lock, in one case you need to remove it.
that means you need four change state commands, one for each combination branch, and three of them to add the lockstate while the last removes it.
not correct - you need to take care where in which branch you are.
your first example gives the lock if only one has the rage, completely ignoring what the other actor has.
with two possibilities and two conditions, you'll have four different combination of rage and not rage.
in three cases you need to apply the lock, in one case you need to remove it.
that means you need four change state commands, one for each combination branch, and three of them to add the lockstate while the last removes it.
Sorry, I noticed I sent it without fully adding that.
I have it so If one character is affected by a status them AND the partner both get COMBO locked which is correct.
I semi solved my problem. I had to set The skill that cures Rage to ALL ALLIES and that fixes them both, so thanks for reading.

My last issue is that The statuses can also self cure after x amount of turns so I need to know how to make it so COMBO lock state is removed after the turns run out.
As it is now, the status itself can be cured by x amount of turns but the COMBO lock state is still active.
Yanfly's Buffs and States Core allows you to set up a script to run when a state leaves due to running out of turns. Use the <Custom Remove Effect> notetag for that.

In your case, when the Rage state is cured, you would want to get both Chacocalo and Kamae (or perhaps loop through the whole allied party?) and remove the Combo Lock state from them.

Something like this (untested):
Code:
<Custom Remove Effect>
var members = user.friendsUnit().aliveMembers();
for (var i = 0; i < members.length; ++i) {
  var member = members[i];
  if (member && member.isStateAffected(11)) {
    member.removeState(11);
  }
}
</Custom Remove Effect>

This code assumes state 11 is Combo Lock.

After adding Buffs and States Core you could put this into the Notes box of your Rage state so that all allies affected by Combo Lock in the allied party of the Raging person would be cured when Rage is removed.

This will work whether the state is cured by some curative means or it times out with the turn counter.

If you wanted to be able to cure Rage on a per-person basis but only unlock Combos once all allies are cured, then you can do that by editing this script to loop through all allies an additional time and add a conditional check to ensure that no allies have state 7 (Rage) before doing anything to clear their states.

@Bowtirage , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.


You can quote multiple people in the same post by selecting the quote button on each before adding them or you can get someone's attention by tagging them using the @ symbol and their username as I've done here.
Hello @Bowtirage. 👋
Below is an alternative approach if you don't mind using Yanfly's Skill Core plugin:
Spoiler: YEP Skill Core
Copy and paste the following code into your combo skills' Note box:
JavaScript:
<Custom Requirement>
var idSleep = 10;   // sleep state ID#;
var idBlind = 5;    // "bind" state ID#;
var idRage = 7;     // rage state ID#;
var arrStates = [idSleep, idBlind, idRage];
value = !$gameParty.members().some(function(mem) {
  return mem.isDead() || arrStates.some(function(idState) {return mem._states.contains(idState);});
});
</Custom Requirement>
Shorter version:
JavaScript:
<Custom Requirement>
var arrStates = [10, 5, 7];
value = !$gameParty.members().some(function(mem) {
  return mem.isDead() || arrStates.some(function(idState) {return mem._states.contains(idState);});
});
</Custom Requirement>
Spoiler: Notes
  • The combo skill will be disabled if any one in the party is either dead or affected by at least one of the states.
  • The combo skill will be enabled once more if none in the party is dead (or previously dead had been revived) or affected by any of the states.
  • With your Pep Talk skill, in its Effects box, just have it remove the Rage state.
  • Tested in a new project with no external plugins except for YEP Skill Core.
  • No common events used.
Spoiler: Edit
Another alternative would be to alias Game_BattlerBase.prototype.isSkillTypeSealed, its derivatives or similar functions.

Original thread: https://forums.rpgmakerweb.com/threads/locking-and-unlocking-skills-urgent.148131/