Take always a critical hit when you are in a state?

This one is simple, i want to know how to make an status effect like freezing from Shin Megami Tensei Nocturne. In that game, when you are freezed, all the incoming physical attacks will always crit you.
I would like to know how to make something like that.

I tried to reduce the critical evasion drastically, but that don´t seem to work.
The post I linked below might help you get started, though it probably needs a modification to only work when you get hit with a physical attack. JS is not my forté though, so if the code does work at all, you'll need to call on someone else to modify it for your exact needs.

Are you asking this question and actually using MZ's battle system?
For the Crit Evasion approach you'd need the item/skill to be capable of causing crits, and the subject to have non-zero Crit Rate. That's not specific to Physical Hit, though.

(Funny thing: by default, if the target has > 100% Crit Evasion and the subject has < 0% Crit Rate, crits become possible again.)

The plugin in the thread Sword_of_Dusk linked is a big ol' override, so it might conflict with other plugins. The condition to check is this.isPhysical(), so you could just add it in there:
JavaScript:
target.isStateAffected(ADD_ID_OF_STATE_HERE) && this.isPhysical()

Alternatively (briefly tested):
Spoiler: plugin code
JavaScript:
/*:
 * @target MV MZ
 * @plugindesc <take physical crit> notetag for trait-bearing objects.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/162437/
 * @help Actor/Class/Enemy/State/Weapon/Armor notetag:
 *     <take physical crit>
 *       Turns all incoming physical hits into crits.
 *
 * Free to use and/or modify for any project, no credit required.
 */
;void (function(alias) {
  const TAG_PHYS = "take physical crit";
  Game_Action.prototype.itemCri = function(target) {
    if (this.isPhysical() && target.traitObjects().some(o => o.meta[TAG_PHYS]))
      return 1;
    return alias.apply(this, arguments);
  };
})(Game_Action.prototype.itemCri);
itemCri returns the chance of a crit: 1 = 100%. This will make tagged targets receive a crit from any physical hit, regardless of whether it could possibly have crit them otherwise.
Are you asking this question and actually using MZ's battle system?
Even better, he's using ChronoEngine but a change to damage formula or state should work.
@Vladar458 A reminder for any future support topics you make: do be sure to let people know you're using Chrono Engine. Some solutions that work with the default battle system won't work with Chrono Engine outright. You'll save people time and yourself from potentially trying things that will fail.
Even better, he's using ChronoEngine but a change to damage formula or state should work.
No, actually this question is for a turn based system. Visustella plugins. I´m just testing things there for a possible future project.
Then right in the instructions for the VisuStella Battle Core is a section on controlling critical hits.
Then right in the instructions for the VisuStella Battle Core is a section on controlling critical hits.
I saw those, and it seems that critical control only affects Items and skills. Like create a skills that always crits or a skill that deals more critical damage than a regular critical.
Right, because the skill is what critically hits, an actor doesn't.

So you'd just take one of those provided notetags and check for the state.

Code:
<JS Critical Rate>
if (target.isStateAffected(69))
    rate = 1;
</JS Critical Rate>

Replace 69 with the ID of your state. Copy and paste into skills.
You can modify the whole critical formula in Battlecore -> Damage Settings -> Critical Hits: JS:Rate Formula

Then add under the 'Declare Constants' section the script you were given above (replace State Id with the Id you want):

if (target.isStateAffected(State Id) && this.isPhysical()) { return 1; }

(Not 100% sure, if 'this' works correctly in that spot, but that's the idea 😀 )
Not 100% sure, if 'this' works correctly in that spot
I obviously don't know what VisuStella's code is, but if that parameter is overwriting Game_Action.itemCri() then yes, "this" would be correct.
You can modify the whole critical formula in Battlecore -> Damage Settings -> Critical Hits: JS:Rate Formula

Then add under the 'Declare Constants' section the script you were given above (replace State Id with the Id you want):

if (target.isStateAffected(State Id) && this.isPhysical()) { return 1; }

(Not 100% sure, if 'this' works correctly in that spot, but that's the idea 😀 )
It works like i wanted! Thank you. Two questions: If i want more than one state i have to put (7, 14)? Because i put just the number and it worked, but when i put (7, 14) the crit trigger in the state 7, but not in the 14. And second: One of the ailments is rage, where you can attack anyone, even yourself. The thing is, i hitting yourself have no much sense, and also you crit yourself. How i could make it to hit every any enemy or ally, but not yourself?
If i want more than one state i have to put (1, 2, 3)?
No, that's not correct JavaScript syntax. You have to put the complete function each time separated by the OR operator.
Code:
target.isStateAffected(1) || target.isStateAffected(2)

If you have a long list of states that should cause automatic crits (why?), you can shorten that with:
Code:
[1, 2, 3].some(state => target.isStateAffected(state))
No, that's not correct JavaScript syntax. You have to put the complete function each time separated by the OR operator.
Code:
target.isStateAffected(1) || target.isStateAffected(2)

If you have a long list of states that should cause automatic crits (why?), you can shorten that with:
Code:
[1, 2, 3].some(state => target.isStateAffected(state))
Ok, thank you. Now it works with two different ailments. I just wanted two: Rage and freeze.
About your second question, the 'attack anyone' not targeting the user, in the base game I think you could modify the Game_Action.prototype.confusionTarget function (or add checks to some functions it calls), by filtering out the user. But I don't know the syntax for that, or if VS Battle Core modifies the confusion targets function as well.

Original thread: https://forums.rpgmakerweb.com/threads/take-always-a-critical-hit-when-you-are-in-a-state.162437/