MV Help with Cooldown across All Party Members (YEP Skill Cooldowns) [Solved]

I have this Skill that any Party Member can use as long as they have equipped a certain piece of Armor. The Skill comes with a long Cooldown due to how powerful it is, problem is that the Cooldown will only effect the Actor who USED it and if you swap who has the Armor Equipped then that Actor is INSTANTLY able to use that same Skill without having to wait for the Cooldown.

I had this previous script that helped with this problem but im finding out now that if any Actor goes down in Battle and then is swapped out to the inactive Actors, an error will occur upon the Battle ending in any form if the Skill had been used in said Battle.

So, is there like a way I could make it so the Skill has a Cooldown that links across all Actors who can use it and regardless of who used it, the Cooldown will be the same for everyone or something?





Here's the scriptcall btw, also I will mention I changed the "battleMembers" to "allMembers" and the result was still the same

JavaScript:
const armorActor = $gameParty.battleMembers().find(member => member.hasArmor($dataArmors[504]));
if (armorActor) {
$gameParty.allMembers().forEach(member => {
if (member._cooldownTurns === undefined) {member.clearCooldowns()};
member._cooldownTurns[406] = armorActor._cooldownTurns[406];
})
}
I think a switch might be the best way to go.

I can't help you on the JS side since i don't know much, but I reckon,

"Switch CD" off? Can use skill, if skill used, turn "Switch CD" on


When CD = 0 turn "Switch CD" off.


The skill shouldn't be usable by any actor if the switch is on.
im finding out now that if any Actor goes down in Battle and then is swapped out to the inactive Actors, an error will occur upon the Battle ending in any form if the Skill had been used in said Battle.
got a trace? if that's the only issue with what you did, then seeing if that can be resolved is an option.
got a trace? if that's the only issue with what you did, then seeing if that can be resolved is an option.
What's a trace...? Sorry im stupid...
the error trace. when your game crashed, depending on your plugins (I think ive seen you use the yanfly one that does) it should have given an error trace to show where and how the error happened. If you dont have a plugin that shows it on the screen on crash, then pressing f12 to open up the devtools window and going to the console should show it.
the error trace. when your game crashed, depending on your plugins (I think ive seen you use the yanfly one that does) it should have given an error trace to show where and how the error happened. If you dont have a plugin that shows it on the screen on crash, then pressing f12 to open up the devtools window and going to the console should show it.
Ohhhhh I see now

Also I think I found what was causing the issue actually, there was a common event I forgot about that had the original script with "battleMembers" constantly running? I tested it after removing that and everything seems to be good now? I hope?
the error trace. when your game crashed, depending on your plugins (I think ive seen you use the yanfly one that does) it should have given an error trace to show where and how the error happened. If you dont have a plugin that shows it on the screen on crash, then pressing f12 to open up the devtools window and going to the console should show it.
Okay nope it still bugs out...
Here's the error trace for it?
1774206204108.png


I think a switch might be the best way to go.

I can't help you on the JS side since i don't know much, but I reckon,

"Switch CD" off? Can use skill, if skill used, turn "Switch CD" on


When CD = 0 turn "Switch CD" off.


The skill shouldn't be usable by any actor if the switch is on.
Also forgot to reply but that might be a good emergency way to fix this if nothing else works, the only issue is that idk how well it'd be with how the cooldowns work as I have Cooldown Steps for the Skills too
Im not sure when youre running your script, but the error in the trace could as far as i can see can only be gotten by manually placing an invalid index into _cooldownTurns. something undefined, below 0, or above your maximum number of skills in the database would be the causes of that specific error. if 406 is a valid skill id, then do you run similar script anywhere else during battle?

that being said, it is possible that your script makes cooldowns become NaN, but if itd cause an error, itd be a different one
Im not sure when youre running your script, but the error in the trace could as far as i can see can only be gotten by manually placing an invalid index into _cooldownTurns. something undefined, below 0, or above your maximum number of skills in the database would be the causes of that specific error. if 406 is a valid skill id, then do you run similar script anywhere else during battle?

that being said, it is possible that your script makes cooldowns become NaN, but if itd cause an error, itd be a different one
Im... SO stupid

I finally figured it out thanks to this, I just accidentally added an extra 1 to the skill id in the script of one of the skills, thus making it invalid as the skill it was looking for was 4112 and not 412 and causing the game to break...

Thank you tho! You saying that a script just makes ones of the cooldowns become NaN helped me figure it out as I wouldnt never looked for the skill id number being wrong!

Original thread: https://forums.rpgmakerweb.com/threads/help-with-cooldown-across-all-party-members-yep-skill-cooldowns-solved.182891/