This is just a small matter. Not important, but also easy to implement I think.
Right now, when you switch away from a soldier, whatever weapon you had selected at the moment, the AI will keep using. This can lead to absurd situations, like engineers running around with hammers the whole battle. Even if it’s just pistols, at least the AI can still fight but it’s far from ideal. And when you do have to get back to that soldier in a hurry, you might have to switch your weapon at an inopportune time.
Sure, you can just always switch to your main weapon before selecting another soldier and I do try to do that every time, but wouldn’t it be easier if the AI just automatically took out the primary weapon, once it it takes control of a soldier? Of course only if the gun has ammo.
Even this does not always work. The numberof times I have finished building something with an engineer, swapped to their main weapon and then swapped to another soldier, only to later swap back to the engineer to find him running around with his hammer out.
AI’s should switch to whatever weapon is better for the situation… like take the flametroopers or bombers for example your AI wont ever switch to your PIAT or Flamethrower which leads to awkward situations like the AI for the bomber running strait into a tank shooting it with their primary weapon instead of whipping out the PIAT and nailing the fucker
This. The primary weapon isn’t always the best for the situation. AI should switch weapon based on range and weapon type, from different range increments, when it detects an enemy.
Plus 1, although it might be hard to implement that
Sure. But that requires more work to implement. But now, that I think about it, it should also just be a couple lines of code. Like, when a target is required, ask: Is target armoured? If yes, does soldier carry AT weapon? If yes, is it in range of the weapon? If yes, then switch to AT weapon.
I don’t want the idiotic AI to wield flamethrowers, though.
Anyways, I don’t just want my bots to put their hammers, knives etc. away, once they have aquired a target. I want them to do it right as they take control of that soldier. And in that case, the main weapon should be the default choice.
this actually works for some.
Engineers and Bombers
no Flamethrowers because it wouldn’t work so it go to primary weapon.
Engineers’ Hammer out
Bombers Piat weapon if player’s hot swap soldiers
and i think Mortar too but i haven’t used it for long while.
Pre-determine weapon slots available, primary, secondary, sidearm
Each would have preset ranges set to determine their ideal use range - pistols and shotguns, 0-25m, SMGs, 0-50m. Bolt-action rifles, 50m or more. Self-loading rifles and LMGs, any range. Melee, 0-5m
Select in order of primary → secondary → pistol → melee in preference.
On detection of enemy - measure distance. If the distance is outside the present preference distance of the equipped weapon, compare to weapons in order of equip as above. If range is between values (bolt action to SMG or melee, for instance), double the maximum range increment of all weapons in the calculation, and reselect. If no weapon matches, default to primary if it has ammo. If primary lacks ammo, cycle to next weapon in order that still has ammo available.
I’m not sure exactly how hard this should be to implement in code, but it seems like it should be straightforward in theory, if nothing else, on the logic end.