Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.
You know which other move has a varying percentage chance of having its additional effect? Chatter. You know which function code is all about lowering the target's Special Attack by 1 stage? Number 45 (Struggle Bug, Snarl, Mist Ball). You know which moves check what the weather is? Weather Ball, for one. Why not have a go at combining the relevant parts of each of them? Note the additional effect chance defined for Chatter in moves.txt, by the way.
I'm making several assumptions here. Your new function code is for a damaging move, it lowers the target's Special Attack, and it's lowered by 1 stage. You should get into the habit of providing information like this.