You need to learn theory and also be able to hear it in your head. If you play chord notes only, you will sure not make a mistake but will be playing boring bass. Take the chord notes (especially root notes) as major points and try to create bass lines that lead your EARS from one chord note to the next. Think in scales and passing notes rather than chord notes only. Think melodically and rhytmically. SING the bassline first, then find it on the bass. Record several ideas if you can, then listen to them. If you like something, keep it, if you don't - change it. Try to explain yourself why you like or dislike a certain phrase (eg - 'It's too dull, I should add a bit more melody' or 'That's cool, I like that rhythm'). Learn from your mistakes and victories. If you can't hear what the guitarist is playing, ask him and learn the chord progression by heart, then follow it while playing. You will need to find a good teacher to teach you harmony and train your ears. Using your EARS and KNOWING what you are playing is the key here. Never stop learing...and don't forget to enjoy it meanwhile! Godd luck & have fun!