Check for a Skill - Custom Confirm Effect

Hello!
I'm new to JS and I'm trying during the "Custom Confirm Effect" of a passive state to make the game check if the character affected by that state is using a certain Skill (in that case, it's Skill 318).

So here's what I tried:
if (this.Skillid() === 318) {
}
////
if (this.action.skillId() === 318) {
}
////
And after searching on google I still can't find the right code
Thanks for any upcoming help!! ^^
Are you using a plugin?
Yes!
in that case Yanfly's Buffs&StateCore.
(And they all work fine, the issue has to come from my code)
A bit late (maybe you've already found the answer), but try this:
JavaScript:
if (this.isSkill() && this.item().id === 318) {
  // stuff
}
I.e. "if this action is a skill and its ID is 318, then do stuff". It's item because skills and usable items are treated mostly the same when used. 🙂

(Also, note that the this keyword changes meaning depending on where it's used: Yanfly's Custom Confirm Effects are evaluated in a Game_Action context...basically that means that this conveniently returns the current action.)
Hey! This looks great! Thanks 😀
And also thanks for the little tutoriel!
I've found another, way longer solution.
So, knowing this will save me a lot of time if I try to do something similar!

Do you know if i can trigger common events with Yanfly's Custom Confirm Effects?
Great! For common events you could try this:
JavaScript:
$gameTemp.reserveCommonEvent(123);
Just replace 123 with the ID of the event you want to start. 🙂
Works as well! Perfect ^^

Original thread: https://forums.rpgmakerweb.com/threads/check-for-a-skill-custom-confirm-effect.121837/