DarkBlizz

Game On => Land of AI => STARCRAFT II: WINGS OF LIBERTY => AI Development => Topic started by: hd on March 03, 2010, 06:44:16 AM

Title: Could use some help...
Post by: hd on March 03, 2010, 06:44:16 AM
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.
Title: Re: Could use some help...
Post by: Kernel64 on March 03, 2010, 07:09:18 AM
have you tried techcount?
Title: Re: Could use some help...
Post by: 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.
Title: Re: Could use some help...
Post by: Kernel64 on March 03, 2010, 09:59:10 AM
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.
Title: Re: Could use some help...
Post by: Aeg1s on March 03, 2010, 02:01:55 PM
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);