Just make an item and under "Classification" or whatever, make it a "Switch." That way when you use the item, a switch will go on. Call it "Capture" or something.
Now go into the M.Groupstab in your database. At the bottom find the "Battle Events." Double click the |...| button and check "Switch" and find "Capture." Now double click the "<>" in the white box.
Here's where you need to understand variables. Variables are numbers. That's it. Numbers. Simple! These numbers can represent whatever you want them to. A number of your choice, the monster's HP, your screen coordinates, whatever you want really. Moving on.
Now click "Variable Operations." Click the |...| at the top of the new window and find a blank variable slot. Name it "Monster HP." Hit OK. Now find the section called "Operand." This is where you set what number the variable will be. Check "Monster," select the enemy pokemon, and make sure "HP" is selected from the drop-down box to the right. Hit okay. Now, when you use the Pokeball item, it will turn on the switch Capture, which will set a number to the enemy's HP. Moving on.
Double click the next "<>" and find Conditional Branch or Fork Condition. Click it. Now select the second item, Variable. Click the |...| button and find the variable "Enemy HP." Next to where it says Number, type the number 30. Now find the drop-down box where it says "Equal to." Select "Less than" from the list. Make sure "Execute Custom Handler" is selected at the bottom. Next step.
Right under this, inbetween the command "Conditional Branch" and "Else Handler," use commands to show your Pokeball animation and whatever. Then add it to your party using the "Change Party" command. Capture sucessful!
Now, under "Else Handler," enter your commands for if it failed. (Aww... it was so close to!")
Now, when you use the pokeball, it will turn on the switch "Capture" which will save the opponents HP in a variable. If it's HP is less than 30, you will catch it.
That's the watered down version. Of course the formula's much more complicated, but that'll get you through for now until you understand random range variables ;)
Lemme know if there's anything you don't understand.