Could use some help...

Started by hd, March 03, 2010, 06:44:16 AM

Previous topic - Next topic

hd

Update: found aitechcount

So, I've been working on an AI and as of right now, I have it able to beat the 5.5 AI before late game kicks in.

But, unfortunately I can't seem to find information I need to make it more advanced.

If anyone can find a function for unit counting for the AI (especially counting a specific type) that'd be great. It would probably look something like AIGetUnitCount(int player, unit type); where type being left null will count all units. I know there's a function for counting peons (workers [scvs, drones, probes]).

We should probably compile a list of all the AI functions we can find.

Kernel64


hd

Quote from: Kernel64 on March 03, 2010, 07:09:18 AM
have you tried techcount?

Actually, was just about to update the thread saying that AITechCount returns an integer of the amount of the passed unit type.

AITechCount(int player, unit type, int flag)

The only flags that seem to be available are c_techCountInProgressOrBetter and c_techCountCompleteOnly where InProgressOrBetter counts those currently being built + those finished being built and CompleteOnly will only count those built but not in progress.

Kernel64

#3
Quote from: hd on March 03, 2010, 07:36:36 AM
Quote from: Kernel64 on March 03, 2010, 07:09:18 AM
have you tried techcount?

Actually, was just about to update the thread saying that AITechCount returns an integer of the amount of the passed unit type.

AITechCount(int player, unit type, int flag)

The only flags that seem to be available are c_techCountInProgressOrBetter and c_techCountCompleteOnly where InProgressOrBetter counts those currently being built + those finished being built and CompleteOnly will only count those built but not in progress.

InProgressOrBetter returns true in an IF() statement even if there is zero of the unit type.

I'm testing c_techCountQueuedOrBetter.

edit:
"c_techCountQueuedOrBetter" seems to mean items in the AI's build queue or ordered to be produced already.

Aeg1s

If you want to check queued units TechTreeUnitCount will work:
[/code]TechTreeUnitCount(player, c_PB_WarpGate, c_techCountQueuedOrBetter);


or you can use AIKnownUnitCount:
[code]AIKnownUnitCount(player, player, c_PU_Zealot);