Changing extra parameters via scripts

I want to make a mechanic when you equip a certain weapon you gain crit and hit rate depending on your attack.
But I noticed that you can only change extra parameters in traits.
Is it possible to change extra parameters such as hit rate or crit rate via script calls or eventing?
You can have weapons change your HIT and CRI. In the weapon's Traits box, go to the "Param" tab and look under Ex-Parameter.

Or have I misunderstood what you're trying to do?
You can have weapons change your HIT and CRI. In the weapon's Traits box, go to the "Param" tab and look under Ex-Parameter.

Or have I misunderstood what you're trying to do?
I'm trying to make hit rate and crit depending on actors attack stat
Like
HIT = atk / 2
CRT = atk / 2
So when character with 34 attack equip that weapon he will get 17 hit rate and crit
Oh, I see. I think that the easiest way to do this is by using Yanfly's Extra Parameter Formula plugin.

If that doesn't work for you for some reason, or you have a need to learn how to change it from scratch rather than using a premade plugin, then just say so and hopefully someone around can show you how. 🙂
I figured out I can do it through this code
$gameActors._data[8]._xparam[1] = $gameActors.actor(8).hit + $gameActors.actor(8).atk / 100;
$gameActors._data[8]._xparam[2] = $gameActors.actor(8).cri + $gameActors.actor(8).atk / 100;

Original thread: https://forums.rpgmakerweb.com/threads/changing-extra-parameters-via-scripts.113501/