I take invega, (paliperidone) seroxat and modafinil. I want to join the army but will these medicines be detected by medical investigation (urine test, drug test etc?

Whoa. If you are on medication for mental / emotional illness, do not conceal this from your recruiter. You'd be making a terrible mistake and be setting yourself up for grave problems once you're in. It may still be possible for you to serve.
Careful! Conditions for which this constellation of medications can be used would almost certainly be medically disqualifying for enlistment. DO NOT try to deceive the government. You could end up being separated for a fraudulent enlistment or face serious charges that may follow you for the rest of your life.