April 10, 2021, 06:36:06 PM

Author Topic: [States Problem] AI stops executing ZergOpenGnd0 codes  (Read 459 times)

Kernel64

  • Sr. Member
  • ****
  • Posts: 207
    • View Profile
[States Problem] AI stops executing ZergOpenGnd0 codes
« on: March 22, 2010, 10:20:32 PM »
After 7 mins, the AI tends to slow down. I say this because

UIDisplayMessage(PlayerGroupAll(), 3, StringToText("status: " + CBlockStatus));

doesn't show up on the screen as fast as it did before this time. It slows down then takes some speed again.

Then, at 12 mins everything else stops besides this:

Quote
time = AIGetTime();
Itime = FixedToInt(time);
minutes = 0;
while (Itime >= 60) {
    Itime = Itime - 60;
    minutes = minutes + 1;
}
msgTime = IntToString(Itime);
minutesTime = IntToString(minutes);

UIDisplayMessage(PlayerGroupAll(), 2, StringToText("Time Elapsed:                " + minutesTime + ":" + msgTime));

Which shows the time.

What's happening here?

Obviously, some codes are executed. I still get this displaying "List Empty"  on the screen:

UIDisplayMessage(PlayerGroupAll(), 3, StringToText("status: " + CBlockStatus));

But then, all the other codes, like this one:

Quote
        if ( (TotalUnit(c_ZB_Spire, player) == 1) && //military manager muta prototype
             (TotalUnit(c_ZU_Drone, player) >= 14) &&
             (FreeFood(player) >= 4) &&
             (AIHasRes(player, 100,100)) &&
             (HowManyCanWeProduce(c_ZU_Mutalisk, 1, player) >= 1)){ //&&
             //(CBlockStatus != "InProgress") ) {
                QInUnitPB(c_ZU_Mutalisk, 1, MaxUnitFreeFood(c_ZU_Mutalisk, 2,player) , c_townOne);
            if(AIGetBuildingCountInTown (player, c_townTwo, c_ZB_Hatchery_Alias, c_techCountCompleteOnly) >=1 ) {
                QInUnitPB(c_ZU_Mutalisk, 1, MaxUnitFreeFood(c_ZU_Mutalisk, 2,player) , c_townTwo);
            }
        }

isn't getting passed by the AI.

Does the AI go somewhere after 12 mins? How do I keep the AI running  ZergOpenGnd0 stuff until 30 mins?

Astazha

  • Member
  • ***
  • Posts: 78
    • View Profile
Re: [States Problem] AI stops executing ZergOpenGnd0 codes
« Reply #1 on: March 22, 2010, 10:55:55 PM »
OpenGnd0 from Starcrack runs a function called GenericOpen() or something like that.  It's in MeleeStateHandler.galaxy and it eventually passes control into the mid & late game.

Kernel64

  • Sr. Member
  • ****
  • Posts: 207
    • View Profile
Re: [States Problem] AI stops executing ZergOpenGnd0 codes
« Reply #2 on: March 23, 2010, 02:08:28 AM »
What's a substate?

e_mainSubState_GndA I've seen this used through:

AISetMainState(player, state, e_mainSubState_GndA);

Is there a time limit for the AI?

Astazha

  • Member
  • ***
  • Posts: 78
    • View Profile
Re: [States Problem] AI stops executing ZergOpenGnd0 codes
« Reply #3 on: March 23, 2010, 02:28:17 AM »
I haven't messed with them.  In general though, the states are just player specific variables that can be set and checked in other code, and are retained between execution cycles (static).


I'm not using that stuff for the most part because some of the Blizzard code might take action based on it somewhere, and I don't want unknown/unexpected things happening.

Kernel64

  • Sr. Member
  • ****
  • Posts: 207
    • View Profile
Re: [States Problem] AI stops executing ZergOpenGnd0 codes
« Reply #4 on: March 23, 2010, 06:24:17 PM »
Thanks man. I just thought thing I knew about the states were all wrong.

Turns out something went messed up due in part of not having to exit SC2Launcher and run it again once changes have been made to the code.

So, it might be a good thing to keep this in mind -- that to test changes properly, one must at least be sure that everything has been loaded properly and all up to the current version of what's being worked on.

I'm currently looking for something that checks blocks of codes for simple errors like case-sensitivity, and all the minor stuff.

Again, thanks.