Crowd control chance base on a certain parameters

Hi all, I am new to RPG Maker community. Currently, I am using MV version.

I looking forward to modify how cc chance be calculated. Let's say a skill XYZ has 50% stun chance. If the user has 20% crowd control stat, this stun rate will increase by 20% => 50%*0.2 = 60% chance. On the other hand, if the target has 60% of resistance chance. Then the result will be 50*0.2/0.6 = 17%. But the chance never exceed 100%.

I am following an idea that use random number and check if it smaller the calculated rate or not then apply the cc to the target. But I have no idea where to get the value of skill's base control rate.

Could you please help me out with this question. I am really stuck with it for days. Lol...

Thank you a lot!

I can say I have a little experience in JavaScript but not much, and.
Currently, I am using ICF Soft plug in for extra parameters. I think he made it works well with scripting.
I am sorry the formula seems wrong. Idk why I can make a typo such like this haha. But that's all about the idea I want to describe. Thanks again.
The base rate of applying states (such as Paralysis, Poison, or Charm) depends on the content that you've entered for the Skill (that applies the state) in its Features box. For example, if you choose "Add State - Sleep 50%", then there is a 50% chance that the skill will put the target to sleep when it is used.

This rate is then modified by any State Rate features that the target has (for example, if the target has "State Rate Sleep 80%", then the actual chance to inflict it will be 0.50 * 0.80 = 0.40 or 40% chance), and finally adjusted very slightly based on the difference between the user's LUK stat and the target's LUK stat.

Applying effects to change the user's chance to inflict states is actually quite hard to do without a Plugin. However, if you want a certain battler to, for example, be immune to CC when they are a target, all you need to do is give them State Rate 0% (or State Resist) features for the CC states.

By the way, the Game Mechanics Design board is for engine-neutral design discussion, not for how-to implementation questions. Since it sounds like you may need a Plugin to do the types of things you want, I'll go ahead and move this over to Plugin Requests.
I am sorry for bumping, anybody have any idea for this. Do RPG MV have any script to make a target get a certain status? Like target.States=1 or something else...
target.addState(stateId)

Original thread: https://forums.rpgmakerweb.com/threads/crowd-control-chance-base-on-a-certain-parameters.117187/