Make a success rate dependent on a stat?

Ok let me just rush into what i want

I wish to know how to use a stat to determine a success rate of an attack/skill such as:

using a money gain skill could use the characters luck stat / 4 

and the game determines the success of the attack from there.

Note: Eventing or scripting? which is requierd or can both be used
you can make it via either one really... but if you're using CE, you would need to set the caster to a variable first so that you can get the right character in your event commands...

or if it's just a skill to give gold, the formula bar might even be enough

for these things, I suggest doing it like this:

Can you use the damage formula bar? If yes, use it

if not

Can you use pure events for it? if yes, use it

if not

Can you use scripts for it? if yes, use it

if not

maybe it's not really possible

btw, if it's doable via formula bar, but you will be using it more than once (meaning not only 1 skill with use it), then proceed to the common event or scripts path...
the gold thing was an Example (hence the 'such as:') but what im looking for is something that might be difficult i have a skill that adds buffs and states but doesnt use the dammage formula, I wanted to know if there was a way to use variables to mark their stat without having to go through every actor and check and then use a chance rolling command (probably not in the events) and set the percent as the variable divided by 4 or 3 or 2 Etc. I have a picture of the skill page attached please veiw it and see if you can find out how to do it wothout the dammage formula and going through every actor (almost all of my actors will have access to this class at some point because of yanfly's class and subclass script and i dont feel like eventing all of them and there probably is no chance rolling command in the tabs)

Problem one.png

Yes i realize i have some mistakes DONT JUDGE ME! im trying to do things one at a time
W8, you don't want it to loop thru each actor but it is meant to effect all allies?

anyway, is the luk chance based on caster or each target?

if it's based on the caster, just save the chance into $game_variables[whatever index ur not using]

$game_variables[1] = a.luk/4
then using the common events, check if that chance allows the effect to go on and apply state to whole party
well only one character is meant to use it but it affects all (weird now that i type it out) but i mean i dont want it to have to scan for each and every actors individual luck stat i want it to look through the casters luck and determine it (makes more sense)

Edit: glad you posted that edit but where do i put this, in the common events? Or somewhere in the skill im missing? I read the common event part but not understanding...
The variable setting is on the formula bar... then you add states via common events (which means you make the skill run the common event thru the common event box in the skills tab)

btw, make the skill just set targets to The User instead of all allies... it will just make the formula to be run for every target... and you won't need the scope since the CE will add the state to whole party anyway

Original thread: https://forums.rpgmakerweb.com/threads/make-a-success-rate-dependent-on-a-stat.17604/