Calculating AI attack probability

TC01

Deity
Joined
Jun 28, 2009
Messages
2,216
Location
Irregularly Online
Is there a way in python to calculate whether the AI would attack? Or retreat?

What I'm trying to do is, for my Cloaking Devices modcomp, script it so that whenever an AI unit moves and is cloaked (invisible), the AI checks if it is capable of beating a unit within it's movement range. If it would attack, I can trigger a "decloak" function to make it become visible. (This would all be done in python in onUnitMove- it would be scripting, not actual AI coding, just to make that clear).

Whereas, if it would retreat, then I would keep the unit cloaked (invisible).

Is this doable? Or would I have to get combat odds and then manually decide what the threshold for an AI unit attacking would be?
 
Top Bottom