Help with making a certain custom attack formula

I'm trying to make a pretty unorthodox enemy attack. 


This attack does damage to a single target that ignores defense. (formula for this part being a.atk * 4)


However in addition to dealing damage, I also want it to add a state to a specific party member 5% of the time, if this attack targeted that specific party member. Only a specific party member though, and her actor id is 4. It does that damage to everyone else including her, it's just if it targeted her, it has a 5% chance of giving her a state. I know this part of the formula would involve something with "if b.id == 4" and "b.add_state(25)", 25 being the id of the specific state I want it to add, but I don't know what I'm supposed to do with those things, especially because I want it to give her this state only 5% of the time. How would I do this? 
I feel like you could just do something like...


if b.id == 4 && rand(99) > 94; b.add_state(25); end; damage


But, personally, I've never found the right syntax for if-and statements in vx ace - I'm pretty sure what I typed wouldn't work as is.  Maybe someone else can touch that up for me. :|
I think what Rhaeami suggested should work.  If it doesn't try:


if b.id == 4 && rand(99) > 94; b.add_state(25); else; 0; end; damage
I tested the skill by first making a dummy enemy that only knows that skill and made my party only contain that one character it's supposed to give the state to. After many turns, just when I was about to give up and say it didn't work, she got the state. Then I did the same but put a different character as my only party member, and after many, many turns, he never got the state. So it worked, thank you!
I tested the skill by first making a dummy enemy that only knows that skill and made my party only contain that one character it's supposed to give the state to. After many turns, just when I was about to give up and say it didn't work, she got the state. Then I did the same but put a different character as my only party member, and after many, many turns, he never got the state. So it worked, thank you!



Glad to hear it!  Though for testing purposes, maybe next time you could just tweak the numbers to have a higher chance so you can see that it works, before suffering through 20+ tries. 😉

Original thread: https://forums.rpgmakerweb.com/threads/help-with-making-a-certain-custom-attack-formula.73635/