Is there a way to raise a chance for the player to be surprised?

Hi! Good afternoon!

So, some context!

I'm making a game that begins with a little prologue quiz to assess the player character's personality and skills, and storing the obtained values in some variables, right? And one of these variables is survival skills! Basically, how attuned to danger the player's avatar is.

I wanted to make it like a spectrum, that goes like very bad → bad → normal → good → very good, with each of them (except normal) giving a passive skill that raises/lowers defense and, in the more extreme ends of that spectrum, raising/lowering the chance for them to be surprised!

It's that last part that's giving me trouble. Is there any way for me to actively raise the chance for the player to be surprised? The engine's only letting me nullify that chance for the player and raise it for their enemy!

Thank you for your time!
The surprise rate is hardcoded at 3% if the party's average agility is higher than that of the troop, and 5% otherwise, so you would need a plugin for this that allows you to override the hardcoded percentage.
Oh, that's... inconvenient. Know any good plugins that change that?
Yanfly's force advantage allows you to set surprises or advantages for each encounter, but I don't remember being able to adjust the individual rates.
Code:
Game_Party.prototype.ratePreemptive = function(troopAgi) {
    var rate = this.agility() >= troopAgi ? 0.05 : 0.03;
    if (this.hasRaisePreemptive()) {
        rate *= 4;
    }
    return rate;
};

Game_Party.prototype.rateSurprise = function(troopAgi) {
    var rate = this.agility() >= troopAgi ? 0.03 : 0.05;
    if (this.hasCancelSurprise()) {
        rate = 0;
    }
    return rate;
};

Those are the default functions. Just copy them into a text editor, save as a *.js file, include as a plugin.

Change the math however you like. where you see ? 0.05 : 0.05 that's what Trihan was talking about a 5% chance of a preemptive attack if the party's agility is higher than the troop's, otherwise a 3% chance. Those numbers are swapped for surprise.

So you can throw in stuff about variables, manipulate it however you like - the last line, "return rate" is sending back a rate in decimal format. e.g. 1 is 100%, guaranteed, 0.5 is 50%.
Yanfly's force advantage allows you to set surprises or advantages for each encounter, but I don't remember being able to adjust the individual rates.
Yeah, that's just an on or off thing. I don't actually know any current MV plugins that allow a custom surprise/pre-emptive rate, which is kinda weird when I think about it.
special armor that allow less surprise, like base is 10%, while with armor,
you could drop it to 3% or less so you are more focused, for primitive
the other way around, more focused, more upperhand 🙂

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-raise-a-chance-for-the-player-to-be-surprised.162089/