It depends on the song. If you are playing with people, just listen and ask yourself "What role can I play that will make the song sound its best?", and dont be afraid to try different things to hear what each sounds like. Crafting bass lines is best done through trial and error.