In Western Europe during the 17th century (I’m mostly curious about the 30 years war) how did the pikemen fight in smaller groups away from the battlefield? Like if two small foraging parties clashed. Would even just a few pikemen stand side by side to fight with their pikes? Or did they use smaller weapons like swords and knives, and leave the pikes for larger set piece battles?
My historical expertise is focused primarily on the British Civil Wars rather than the Thirty Years War, but I think I can shed some light on the situation.
Let us look at areas where pikemen could reasonably be assumed to fight outside of a pike block vs pike block or pike block vs cavalry battle - this was garrison duty primarily. In this case, now this may be particular to the British example, but many garrisons laid in alternative arms for pikemen units required to man defensive positions such as wall or embrasures - usually some form of shorter polearm such as a bill or a halberd. These were rather more easily wielded for individuals, useful against scaling ladders, or in the confines of urban fighting. If a garrison unit was drawn out for field service, they would leave their alternatives behind, and march out as pikemen again. Pikemen were armed with a cheap sword, and all would have had some form of a knife or a dagger, so for storming parties or other close-quarter actions, the cumbersome pike would be dropped for close-in work
Note: Primarily, foraging parties were composed of mounted men, cavalry or dragoons/mounted musketeers, as they had the mobility to range far out from the line of march of an army to secure supplies from a wide area. Cavalry also stood a better chance against enemy foragers, could perform a scouting role, and cover more ground in less time than the infantry.
In short, the pikeman adapted to his need and his duty. Usually they were not dispersed in small groups where, you are quite correct, their main armament would be less effective. If you were throwing out small groups of infantry in such a way, far better to use musketeers who had the advantage of firepower, in additional to a sword in the same way pikemen did. As the wars progressed the pike was less as an offensive weapon (as had been used to such great effect in previous years) and more as a defensive one. They were there to protect the vulnerable musketeer, most often from enemy cavalry - you can see this in two ways. 1. The shift in ratio between Pike and shotte in infantry regiments who, by the end of the period preferred a 2:1 or more ratio of musketeers to pikemen. In some theatres, there was even a greater number of musketeers if the area of operations had fewer enemy cavalry. 2. The comparatively rapid exchange of the pike for the bayonet-armed musket when this was developed, particularly a socket-type rather than a plug-form.
The 17th century saw several significant improvements and simplifications in firearm design, notably lighter and cheaper, so a musketeer was more mobile and readily available than previously. Pikemen still carried the regard as a more noble form of fighting for many, but as the wars progressed the cavalryman, the dragoon, and the musketeer became the more useful soldier, so noted as eventually of all of these, the pikeman would be paid the least.
Happy to answer any further questions or to elaborate on any point you want clarification on.