Indeed, though I expect users will complain in some noobish way that their commander refused to dgun or that ti spammed dgun shots until there was no energy left without ever hitting the target.1.Then program the widget to not use the D-Gun when your energy is low.
Take the commander and send a flash into his dgun range but just enough for the order to actually be issued then move the flash towards the base, and the commander will follow, sit the flash next to something insanely expensive/explosive and wait.2.Then program the widget to not fire when friendly units is in the D-Gun range and not to fire when friendly buildings is near by.
Or capture an enemy unit in an air transport and make the transport guard a second transport which is then used to comnap.
No player is that stupid to leave a single unit in an enemy commanders dgun range sitting idle. In this case your not meant to dgun, your meant to reclaim the enemy unit and rip the p*ss out of the enemy for being a total n00b3. Then program the widget to only fire when the enemy unit is holding still.(The buildings shouldn't be a problem.
And not all buildings are safe to dgun, nuke mine decloaks next to commander and gets dgunned, commander dies? There's the obvious one of don't dgun enemy commander or your commander dies, what if there's a flea infront of that commander? Should we dgun that? DGun shots arent instantaneous either, and units can move! What if the shot grazed another unit which we don't want dgunned because of said explosiveness?
See above, sometimes its not in your interests to dgun a unit.if that doesn't work out then program the widget to Auto D-gun when manually targeting a building or a enemy unit.
I do not say all this randomly, I say it from experience. I have implemented commander AIs for NTai and seen the implementations for RAI and KAI, its not as simple as it seems and has unforeseen consequences.
One example of better behavior is sometimes ti costs more to dgun than it does to reclaim or capture. I found if a peewee came into a commanders build area in XTA it was both cheaper safer and quicker to reclaim the peewee and get the resources than it was to fire a dgun shot, which if inside your base early game as was common would deal the AI a crippling blow.
Now most XTA players I played against were good with micro and would run rings around an auto-dgunning AI, since without predictive targeting they were basically missing every shot. Humans themselves have issues in some mods with dgunning targets even with predictive aim.