Jd Smith1
Hero
That is a good point, and a major feature of my campaigns.One of the things that I think unintentionally encourages murderhoboism is the tendency to handwave all the "boring" stuff. You don't have to roleplay every shopping trip or night at the tavern, but if you engage with some of these non-threatening and mundane activities, the players will feel like their characters are part of a more real world and will probably do less flagrant idiocy while in town. Probably.
And it is one of the many things I hate about D&D and its clones: there is insufficient wear and tear on PCs.
In my campaign, the PCs generally reach their destination tired, stressed, nursing wound effects, low on ammo, needing fuel, and so forth. One or more will generally be sick (flu), they're all filthy, and none have had a full night's sleep in weeks. They'll have loot to convert to cash, and a shopping list of stuff they want or need. Plus research to do on a variety of subjects.
All those situations can be quickly and easily resolved in a town (preferably city) of reasonable size, but it gives the PCs a very real reason to comport themselves like gentlemen. Even more so when they operate in a specific region for months at a time (although our current campaign is nomadic).
One of the reasons for misconduct, I have found, is idle PCs. I make sure that every PC has assigned duties when they get back to civilization, and a need for downtime to further their PC's improvement. Therefore, urban time is a busy time; in the twenty-odd minutes (at the table) it takes to sort through the admin stuff and get set up for RP'ing whatever investigation(s) are currently underway, everyone is engaged.