New abilities can be easier or harder to define depending on what they are, but are generally easier to define if they're similar to a pre-existing ability. To start, go to the abilities file in PBS, then define the ID, name, and description using the same format as the other abilities.
For the actual coding, next go to into your scripts and go to the Battle_AbilityEffects tab. From here, you can find how most abilities were coded and use them to code your own. For an example of a simple one, I'm planning on adding an ice-type version of Sandygast to my game. Sandygast normally has an ability called Water Compaction which raises its Defense by two stages when it's hit by a water-type move. Since giving it Water Compaction as an ability no longer makes sense, I want to give it an ability called Refreeze that's functionally identical but triggers when it's hit by a fire-type move. To do so, I should first look at how Water Compaction is coded:
Battle::AbilityEffects::OnBeingHit.add(:WATERCOMPACTION,
proc { |ability, user, target, move, battle|
next if move.calcType != :WATER
target.pbRaiseStatStageByAbility(:DEFENSE, 2, target)
}
)
Since this one's simple, all I need to do is change WATERCOMPACTION to REFREEZE, and WATER to FIRE. Here's my result:
Battle::AbilityEffects::OnBeingHit.add(:REFREEZE,
proc { |ability, user, target, move, battle|
next if move.calcType != :FIRE
target.pbRaiseStatStageByAbility(:DEFENSE, 2, target)
}
)
Now all I need to do is apply it to a Pokemon in the pokemon text file, and it see if it works when tested (which it did).
Obviously most new abilities are going to be a lot more complicated. I'm still pretty new to this myself, so I'm not an expert at making them. If there are any particular abilities you struggle with, you can always make another post asking for help. One final tip is that you can also look in the scripts for how certain moves are coded which can also help with making new abilities. For example, if you want an ability that triggers if the user wasn't hit this turn, try looking at the code for Focus Punch.
Feel free to ask if you have any questions.