Well here's an example that I've done to make a wild Rotom appear in its' Oven form.
Events.onWildPokemonCreate+=proc {|sender,e|
pokemon=e[0]
if $game_switches[78]
pokemon.pbLearnMove(:OVERHEAT)
pokemon.formNoCall=1
end
}
The first part stays the same, but then I set the switch number that I want to use (In my case it was the Switch number 78). Then because this was Rotom, I made it learn the move Overheat. The next line about
pokemon.formNoCall=1 makes it change form, and you can add even more modifications if you wanted to be really specific about ability, gender, or whatever.