Some guinea pigs may litter train, but don't expect this as a rule. The best way to keep from being peed on is to watch their body language. Most guinea pigs will get fidgity and may circle or back up before peeing. This is the time to put them back if you want to avoid getting wet. As for potty training in a room, they are unlikely to train to a litter box in that room. I have a cage setup where they can come and go at will (there is a cage with a blocked/off hallway- they can go up the ramp to the cage at any time while wandering around. I have found my pigs do go back to the cage to pee. I didn't teach them this. My first pair seemed to figure it out on their own, and then subsequent generations of pigs seem to have copied the 'rules' of the older pigs. That said, I doubt they would go to a litter box that wasn't their permanent home and the likelihood is that you will have pee accidents from time to time when guinea pigs are roaming free. They are not 'trainable' like a cat, for instance.
As for pellets, you cannot substitute horse feed (or rabbit feed, or rat feed, etc.) for guinea pigs. They have specific nutritional requirements, including the need to take in vitamin C from diet rather than manufacturing it themselves (just like humans!) Pigs with inadequate vitamin C in their diet will get scurvy. Besides the guinea pig pellet, you can also give foods rich in vitamin C or a supplement if needed. I give a vitamin C fortified pellet, foods like peppers with vitamin C content, and use vitamin C drops administered directly for pigs that are ill and need a boost.