Escape only one party member

Hello, im trying to figure out how i can make a party member have a 5% chance to run away from battle for example but i want the rest of the members to continue the figth, also the same but to make a character have a 5% chance of skiping a turn.
make a copy of the escape skill in the database and change the values to the ones you like
But that would make the entire party escape...
no, the escape skill is originally for enemies and only removes the actor using it
I'm not talking about the escape function in the battle menu, I'm talking about the skill in the database skill tab.
I tried with passive states from Yep, but didnt seem to work.
<Custom Passive Condition>condition = user.hp / user.mhp < 1.0; // Check if HP is less than 100%</Custom Passive Condition><Custom Apply Effect>if (Math.random() < 1.0) { // 100% chance user.forceAction(6, user); // Skill ID 6 (Escape skill) BattleManager.forceAction(user); // Ensures the action is executed}</Custom Apply Effect>
Be very careful with the escape skill though. If one person flees and the rest of the party is KOd you will get a Game Over.

This is because it does the escape by removing them from the battle party then the engine sees a battle party of no one left alive so it runs a Game Over event.
I tried with passive states from Yep, but didnt seem to work.
Yanfly's passives dont trigger their apply effects when their conditions are met where they previously werent

if you already have the passive, you can drop the apply effect and use
Code:
<Custom Action Start Effect>
user.currentAction().setSkill(6)
</Custom Action Start Effect>
paired with the passive, it would make it so that when the passive is active, the actor will ignore whatever was commanded of them and flee. you could continue with the idea you had, but turn your apply effect into a turn end effect so that theyll run at the end of the turn
I tried with passive states from Yep, but didnt seem to work.
Also, just as a note, that code is mostly illegible. Please use line breaks and the CODE tags (the </> on the edit bar) so we can understand what you've written.
Found the solution using note

<Passive State: 11> on character and then

<Custom Turn Start Effect>

if (Math.random() < 0.02) { // 2% chance (0.02)

// Set up face graphic display

$gameMessage.setFaceImage(this.faceName(), this.faceIndex()); // Display character's face

$gameMessage.add("Um momento, gente!"); // Add the message



// Ensure the message is displayed before the action is forced

BattleManager.refreshStatus();

setTimeout(() => {

this.forceAction(6, this);

BattleManager.forceAction(this);

}, 1000); // Delay for 1000 milliseconds (1 second) before forcing action

}

</Custom Turn Start Effect>

Original thread: https://forums.rpgmakerweb.com/threads/escape-only-one-party-member.170996/