MV [SOLVED] (YEP Skill Cooldown) Cooldown for multiple Actors?

I have this Armor that, when equipped, will give the Actor wearing the Armor a Skill.

This Skill has a Cooldown tied to it BUT when unequipped and given to a DIFFERENT Actor to wear, the Cooldown is reset and the Skill can be used again no matter how much of the Cooldown was left before.

Does anyone know how to change this so that unequipping and then equipping the Armor to another Actor will keep the Skill's Cooldown if it was used previously and still on Cooldown? Maybe having it tied to a Variable somehow if that's possible?



I would just make it so the Skill gives a State that makes the Armor locked until the Cooldown is up, but I really wanted to make it so you can swap out this Armor to ur liking and waiting that long to swap it out with another Actor feels not as fun
I only skimmed the plugin, so don't know if this causes some problems, but I think this should work. Put in an after battle common event and replace armor id and skill ids:

const armorActor = $gameParty.battleMembers().find(member => member.hasArmor($dataArmors[X]));

if (armorActor) {
$gameParty.allMembers().forEach(member => {
if (member._cooldownTurns === undefined) {member.clearCooldowns()};
member._cooldownTurns[skillId] = armorActor._cooldownTurns[SkillId];
})
}

EDIT: Oh yeah, if your cooldowns are changing when walking around, you need additional stuff. Like maybe run it before battles. (EDIT2: Or just make the cooldown update function check for that stuff.)
I only skimmed the plugin, so don't know if this causes some problems, but I think this should work. Put in an after battle common event and replace armor id and skill ids:

const armorActor = $gameParty.battleMembers().find(member => member.hasArmor($dataArmors[X]));

if (armorActor) {
$gameParty.allMembers().forEach(member => {
if (member._cooldownTurns === undefined) {member.clearCooldowns()};
member._cooldownTurns[skillId] = armorActor._cooldownTurns[SkillId];
})
}

EDIT: Oh yeah, if your cooldowns are changing when walking around, you need additional stuff. Like maybe run it before battles. (EDIT2: Or just make the cooldown update function check for that stuff.)
Sorry im a bit dumb so lemme see if I understood correctly, so basically I put in this code here in a common event that plays after a battle? Right?

Also yes the cooldowns do change when walking around, only really going down in turns tho, so how do I make the cooldown update function check for that? I dont really know how to do that...
Yeah, I've no motivation to try and figure out anything more complex, but I think it works if you just put what I wrote above as a parallel common event. Just change the 'battleMembers' to 'allMembers' and replace X and skillIds. Or wait and see if someone else wants to edit the plugin for you.
Yeah, I've no motivation to try and figure out anything more complex, but I think it works if you just put what I wrote above as a parallel common event. Just change the 'battleMembers' to 'allMembers' and replace X and skillIds. Or wait and see if someone else wants to edit the plugin for you.
Oh ok! And also yeah no worries! I'll see if it works, thank you!

EDIT: Sadly it doesnt work for me, still thank you regardless!
Yeah, not saying it's a perfect solution, but I tested it quickly and it seems to work for me.

(Though it doesn't account for cases like during cooldown remove the equip, add new party member to party, equip them with it and go to battle.)
A quick thought - if the player only gets a single copy of the armor or youre using yanfly's item core independent item system, then you could probably get away with using Waynee95's equip eval plugin to save the actor's current CD for the skill into somewhere (like a game variable or the armor itself if using the item core) when unequipped and to set the CD back using the stored value when its equipped.
@Robro33 They'd also have to account for the cooldown going down when they walk around the map.

EDIT: You can also save the steps and then reduce the turns depending on that when re-equipping.

EDIT2: Oh and also account for the cooldown rate, if necessary.
@Robro33 They'd also have to account for the cooldown going down when they walk around the map.
i believe it should, unless you mean the singular shared cooldown should continue to tick down even if nobody has it equipped? if thats the case then yeah, id imagine an edit or an extension would be a better way to go about it. I reset all my CDs after battle, so id have to look into it later when I have the time if i do.

Pre-post edit:
EDIT: You can also save the steps and then reduce the turns depending on that when re-equipping.
EDIT2: Oh and also account for the cooldown rate, if necessary.
good call. that might be much easier than what I was thinking of. Ill give it a shot, but i wouldnt be able to start looking into it for a couple more days
Yeah, the cooldown ticks down when walking even if you don't have it equipped.

But I guess if you just save the actor (instead of CD) with that Waynee plugin you suggested, then you don't have to account for anything, just set the new equip actor's CD to same as the old equip actor's.
A quick thought - if the player only gets a single copy of the armor or youre using yanfly's item core independent item system, then you could probably get away with using Waynee95's equip eval plugin to save the actor's current CD for the skill into somewhere (like a game variable or the armor itself if using the item core) when unequipped and to set the CD back using the stored value when its equipped.
In my game you only get a single copy of the armor im trying to have this all work with.

but there are 7 other armors that I'd like to work the same way as well, though they are different from each other and each give a different skill so idk if that changes anything or not? They all equip to the same armor slot but you can only have 1 equipped per actor.
I only skimmed the plugin, so don't know if this causes some problems, but I think this should work. Put in an after battle common event and replace armor id and skill ids:

const armorActor = $gameParty.battleMembers().find(member => member.hasArmor($dataArmors[X]));

if (armorActor) {
$gameParty.allMembers().forEach(member => {
if (member._cooldownTurns === undefined) {member.clearCooldowns()};
member._cooldownTurns[skillId] = armorActor._cooldownTurns[SkillId];
})
}

EDIT: Oh yeah, if your cooldowns are changing when walking around, you need additional stuff. Like maybe run it before battles. (EDIT2: Or just make the cooldown update function check for that stuff.)
IM SO DUMB, okay so I think I messed something up the first time trying this code out bc I tried it this time and did some testing and it works exactly the way I wanted it too! Thank you! Sorry for messing it up and wasting time for no reason tho... but at least it works now!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-yep-skill-cooldown-cooldown-for-multiple-actors.178744/