(passive skill/state) How to make each attack buff speed and how to ensure escaping from battles?

Hello, everyone. My questions are the following: How can I make each attack buff speed if the attacking actor has certain passive skill/state and how can I make the player party always escape from battles (that can be escaped) if one of the actors has certain passive skill/state?

Hope you can help me with this. Thanks a lot!
You don't say whether you currently have the plugins/know how to implement passive states. So you're going to need Yanfly's Buffs & States Core and Auto Passive States.

There's also no such thing as speed that can be buffed, so I presume you mean agility - if you meant something else, please clarify.

Then you can check the pinned thread of MV script calls to find the one for adding a buff, and check the Buffs & States documentation to find the correct notetag.

In your passive state's notes, put:
Code:
<Custom Initiate Effect>
if (this.isDamage())
    user.addBuff(6, x);
</Custom Initiate Effect>

where x is how many turns you want the buff to last.

For the guaranteed escape, copy the below into a text editor, save as a *.js and install as a plugin:
Code:
BattleManager.processEscape = function() {
    $gameParty.performEscape();
    SoundManager.playEscape();
    var success = this._preemptive ? true : $gameParty.aliveMembers().some(actor => actor.isStateAffected(x)) ? true : (Math.random() < this._escapeRatio);
    if (success) {
        this.displayEscapeSuccessMessage();
        this._escaped = true;
        this.processAbort();
    } else {
        this.displayEscapeFailureMessage();
        this._escapeRatio += 0.1;
        $gameParty.clearActions();
        this.startTurn();
    }
    return success;
};

where x is the ID of your passive state (no leading zeros).
You don't say whether you currently have the plugins/know how to implement passive states. So you're going to need Yanfly's Buffs & States Core and Auto Passive States.

There's also no such thing as speed that can be buffed, so I presume you mean agility - if you meant something else, please clarify.

Then you can check the pinned thread of MV script calls to find the one for adding a buff, and check the Buffs & States documentation to find the correct notetag.

In your passive state's notes, put:
Code:
<Custom Initiate Effect>
if (this.isDamage())
    user.addBuff(6, x);
</Custom Initiate Effect>

where x is how many turns you want the buff to last.

For the guaranteed escape, copy the below into a text editor, save as a *.js and install as a plugin:
Code:
BattleManager.processEscape = function() {
    $gameParty.performEscape();
    SoundManager.playEscape();
    var success = this._preemptive ? true : $gameParty.aliveMembers().some(actor => actor.isStateAffected(x)) ? true : (Math.random() < this._escapeRatio);
    if (success) {
        this.displayEscapeSuccessMessage();
        this._escaped = true;
        this.processAbort();
    } else {
        this.displayEscapeFailureMessage();
        this._escapeRatio += 0.1;
        $gameParty.clearActions();
        this.startTurn();
    }
    return success;
};

where x is the ID of your passive state (no leading zeros).
Yeah, you're right. I don't know why I didn't specify the things you said. I'll try to be more clear next time.

Anyway, thanks a lot for your help. You deserve a place in the credits, my friend.

Original thread: https://forums.rpgmakerweb.com/threads/passive-skill-state-how-to-make-each-attack-buff-speed-and-how-to-ensure-escaping-from-battles.153249/