If you're just starting out with code, it's probably best to learn the basics of Ruby, the language RMXP uses. If you've done that, you should be able to "translate" Ruby into "English". With that I mean, being able to understand in a sentence what a line of code does, that will really help in the future. You want an ability that activates when a Pokémon is switched in, for which is already a method inside PokeBattle_Battler that's called "def pbAbilitiesOnSwitchIn". Whenever a Pokémon is switched in, it will look through all the lines below it and check if the Pokémon that's switched in meets any of the statements. If your Pokémon has the ability "CUSTOMABILITY", it will check to see if the first opponent can be poisoned and if so, poison it. If there is a second opponent and it can be poisoned, it will poison that as well. There are also other handy methods in PokeBattle_Battler, "def pbEffectsOnDealingDamage", which activates whenever a Pokémon is hit.
As for the actual script you wanted, here it is (Paste underneath Intimidate in PokeBattle_Battler):
Code:
# CUSTOMABILITY
if self.hasWorkingAbility(:CUSTOMABILITY) && onactive
if pbOpposing1.pbCanPoison?(nil,false)
pbOpposing1.pbPoison(pbOpposing1,_INTL("{1} was poisoned!",pbOpposing1))
end
if pbOpposing2.pbCanPoison?(nil,false)
pbOpposing2.pbPoison(pbOpposing2,_INTL("{1} was poisoned!",pbOpposing2))
end
end
In the future, you could look at other pieces of abilities or code in general and copy what you need and copy things from other abilities to get something that works.