Yanfly Skill Cooldowns - Reset Cooldown After Battle?

In my game, I'm using the titular plugin to give physical skills a cooldown. Also in my game, the party is fully healed and restored after every battle. I'd like this to apply to cooldowns as well.

However, it seems there's no option to set every skill's cooldown to 0 after a battle, only an option to reduce the cooldown by a set amount of turns. I could do this, especially I'm not planning on giving any particular skill a cooldown greater than 10 at the moment, but 1. this leads to skills for which I'm not giving cooldowns an internal cooldown of -10 and below. It's not noticeable for players, but it's certainly making me wary, and 2. On the off chance I'd want to give a skill a cooldown greater than 10, I'd have to adjust the parameter again.

So I'm trying to seek a way of ensuring all cooldowns are set to 0 after a battle, regardless of what their remaining turn count was.

My first attempt looked something like this:
Code:
for (var i = 0; i < $gameActors.actor(1)._cooldownTurns.length; ++i)
{
if ($gameActors.actor(1)._cooldownTurns[i] > 0)
{
$gameActors.actor(1)._cooldownTurns[i] = 0;
}
}

It didn't seem to do anything. It's not throwing any errors, but it doesn't affect the cooldowns at all. Furthermore, it told me that the length of the array I'm trying to reference is "undefined" (for the record, the actor in question had 6 skills). I haven't put this into an event or anything yet; this was done through the developer's tools window.

And this is where my lack of scripting experience starts showing itself. Would someone better versed in this than me provide some pointers as to what I'm doing wrong, please?
Leave it as -10, as it makes it where the skill loses it's cooldown post-battle, just as if it was 0. By default in the plugin if you have after battle cooldown over 0, ie 1 or more, it means that these cool downs will continue afterwards. By setting it to -10, it's insured
that it will never reach more than 1 unless you increase the after battle cooldowns by a lot.

Also note that after battle cooldowns are treated separately than in battle cooldowns. So you can have a skill that has a 1 turn cooldown in battle but an after battle cooldown of 3 turns after the battle. How long that cooldown is, dependent on how many steps a turn is equal to.

As to your code problem, skill cooldowns are not connected the actor but to the actor's skills. There could be more problems than that but that's the biggest problem.

For coding especially in relation. to plugin additions, go look into the plugins and see what it's affecting, typical the XXXX.protype will tell you what's it's affecting, for example if it's Game_Battler it affects battlers ie actors and enmies in battle. Also look in the XXX.protype =function(z,d) where the function protion tells you extra stuff that may be affected.
After spending a couple days looking over the Cooldown plugin's code, I found that I just couldn't make sense of it. What I was looking for was a way to reset the cooldowns while the party's not in battle, and it didn't help a whole lot there.

Ultimately, I settled for the less-Javascript heavy solution of just subtracting whatever the cooldown length was for the skills via the After Battle Cooldown tag. It works, and it means I won't have to mess with the plugin parameters in the event I want to make a skill with a greater-than-10 cooldown.

I do greatly appreciate the pointers, though!

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-skill-cooldowns-reset-cooldown-after-battle.87847/