That doesn't explain the kind of AI you want. The above post was a pseudo high-level algorithm of how you would implement it.

What kind of RTS are you making? I presume that your RTS would be adversarial. If so, (and as a proof of concept) you want to break your "CPU" player to engage in at least 4 phases or you can have the CPU player organize its units to be cycle thru 4 states.

For the 4 phases, you can have your CPU player be Defensive (guards its base), Offensive (attacks the other players on the map), Resource collector or Discovery (sends scouts to discover enemy locations).

The states are similar to the phases.

Discovery state - your CPU player will have a unit or a group that will choose a random point on the map and see if there's an enemy in the radius of that location.

Defensive state - your CPU player will have a unit or group defend other units, groups or structures. This is synonymous with a attack-but-don't-follow "rule". If an enemy unit or group is within attack range of the CPU unit or group, the CPU unit or group will attack.

Offensive state - your CPU player will have a unit or group attack an enemy unit or group until death.

Resource gathering state - unit or group will gather resources that can be used to purchase materials or whatever you want.