c_stockIdle vs c_stockAlways

Started by cvax, March 14, 2010, 03:58:05 PM

Previous topic - Next topic

cvax

Hi,

Does anyone know what the difference between c_stockIdle and c_stockAlways is? What about AISetStock() vs. AISetStockUnitNext()? Thanks.

Also, I currently have this as my build order.

AISetStock( player, 1, c_PB_Nexus );
AISetStock( player, 9, c_PU_Probe );
AISetStock( player, 1, c_PB_Pylon );
AISetStock( player, 10, c_PU_Probe );
AISetStockUnitNext( player, 1, c_PB_Gateway, c_stockAlways );
AISetStockUnitNext( player, 13, c_PU_Probe, c_stockAlways );

I want the gateway to build as soon as possible at 10 food, but it seems like the pylon is a split second slow in finishing for the gateway to be placed so instead of building the gateway the computer builds another probe and waits till almost 250 minerals before doing the gateway at 11 food. Any ideas?

Kernel64

This is why I add conditions before setstocks. From what I've seen, the engine chooses the cheapest in its stock and buys that instead. Or it's that buildings are not prioritized.

I believe setstock should be used only to give the AI what to maintain if it loses something. I don't think the engine works through its stock in a first in, first out, basis.

cvax


Reelix

"I believe setstock should be used only to give the AI what to maintain if it loses something. I don't think the engine works through its stock in a first in, first out, basis."

I tried a little

AISetStock(player, 6, "Zergling");
if (attackWave = 1)
{
AISetStock(player, 0, "Zergling");
doAttack...
}


Which, while technically works, gets overwritten by the above AISetStock :p

I hate using global variables....

bool canBuildZerglings = true; // Global Var

// Inside Function
if (canBuildZerglings)
{
   AISetStock(player, 6, "Zergling");
}
if (attackWave = 1)
{
  canBuildZerglings = false;
}


As this gets applied to every zerg AI (Problems with 2 Zerg AI's in 1 game) - So I have to make TvZ or PvZ to test :<

Kernel64

I left setstock for good, but may use it to store the state of a base once in a while.

I think what happens with that 6-0 thing is that, since, say, OpenGnd0 is like a while, looping until a new state is looped over and over, the engine is told to stock 6, then 0, then 6, then 0, then 6.

And after the state is exited, whoever the last number gets the attention gets the prize. It's like a lottery for both those setstocks.

So, I use AITrain/AIBuild/AIExpand instead.