Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ptanhkhoa

#91
AI Scripts / Re: Star IAI v1.0 (Protoss Only)
March 15, 2010, 01:34:29 AM
    I love your Ai, it can run Multi task at one and do it on its  own. Can I used it to develop my Cheating Ai script :P ? I let it have double mineral and gas, modified some process to use the resources well.  I have some problem in gas minerals, when expand a new town. It just placed a assimilator very far from the expanded town. Some time the Ai stop production, I don't know why yet ? So I just placed a While command for it to continue, it works some how.
   
t = 0;
    while ( t <= 100 )
        {
        if (tech_level>=3)
        {   
            // 1 transport
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_WarpPrism, c_techCountQueuedOrBetter ) < 1 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_WarpPrism, 1);     
            }
            // 2obs
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Observer, c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Observer, 1);     
            }
        }
        else if (tech_level>=6)
        {   
            // 2 transport
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_WarpPrism, c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_WarpPrism, 1);     
            }
            // 4obs
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Observer, c_techCountQueuedOrBetter ) < 4 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Observer, 1);     
            }
        }   
    if (IAI_AirGround) //Air1
    {   

    }
    else if (!(IAI_AirGround) &&(IAI_Ground == 1)) //Gnd1
    {   
        //Tech Level 0
        if (tech_level==0)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 16 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
        }
        //Tech Level 1
        else if (tech_level==1)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 20 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 4 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 50, 100) && (AITechCount(player, c_PU_Disruptor, c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Disruptor, 1);     
            }   
            if (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter )>=FixedToInt(0.7*4))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if (tech_level==2)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 25 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 6 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 50, 100) && (AITechCount(player, c_PU_Disruptor, c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Disruptor, 1);     
            }
            if (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter )>=FixedToInt(0.7*6))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if (tech_level==3)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 30 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 5 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if (AIHasRes( player, 50, 100) && (AITechCount(player, c_PU_Disruptor, c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Disruptor, 1);     
            }
            if (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter )>=FixedToInt(0.7*10))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if ((tech_level==4)||(tech_level==5))
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 30 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if (AIHasRes( player, 300, 200) && (AITechCount(player, c_PU_VoidRay , c_techCountQueuedOrBetter ) < 4 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_VoidRay , 1);     
            }
            if (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter )>=FixedToInt(0.7*30))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if ((tech_level==6)||(tech_level==7))
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 30 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if (AIHasRes( player, 200, 150) && (AITechCount(player, c_PU_VoidRay , c_techCountQueuedOrBetter ) < 4 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_VoidRay, 1);     
            }
            if (AIHasRes( player, 400, 300) && (AITechCount(player, c_PU_HighTemplar, c_techCountQueuedOrBetter ) < 3 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_HighTemplar , 1);     
            }
            if (AIHasRes( player, 50, 100) && (AITechCount(player, c_PU_Disruptor, c_techCountQueuedOrBetter ) < 1 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Disruptor, 1);     
            }
            if (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter )>=FixedToInt(0.7*30))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else
        {   
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 30 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if (AIHasRes( player, 200, 150) && (AITechCount(player, c_PU_VoidRay , c_techCountQueuedOrBetter ) < 4 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_VoidRay , 1);     
            }
            if (AIHasRes( player, 400, 400) && (AITechCount(player, c_PU_Colossus, c_techCountQueuedOrBetter ) < 1 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Colossus, 1);     
            }   
            if (AIHasRes( player, 500, 500) && (AITechCount(player, c_PU_Carrier, c_techCountQueuedOrBetter ) < 1 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Carrier, 1);     
            }
            if (AIHasRes( player, 200, 200) && (AITechCount(player, c_PU_DarkTemplar , c_techCountQueuedOrBetter ) < 3 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_DarkTemplar , 1);     
            }
            if (AIHasRes( player, 400, 300) && (AITechCount(player, c_PU_HighTemplar, c_techCountQueuedOrBetter ) < 3 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_HighTemplar , 1);     
            }
            if (AIHasRes( player, 500, 500) && (AITechCount(player, c_PU_Mothership , c_techCountQueuedOrBetter ) < 1 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Mothership , 1);     
            }
            if (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter )>=FixedToInt(0.7*30))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }           
        }

    }
    else if (!(IAI_AirGround) &&(IAI_Ground == 2)) //Gnd2
    {   
        //Tech Level 0
        if (tech_level==0)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 16 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
        }
        //Tech Level 1
        else if (tech_level==1)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 20 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 4 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 50, 100) && (AITechCount(player, c_PU_Disruptor, c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Disruptor, 1);     
            }   
            if (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter )>=FixedToInt(0.7*4))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if (tech_level==2)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 25 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 6 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 50, 100) && (AITechCount(player, c_PU_Disruptor, c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Disruptor, 1);     
            }
            if (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter )>=FixedToInt(0.7*6))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if (tech_level==3)
        {
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 30 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 12 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 5 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if(AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter )>=FixedToInt(0.7*5))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if ((tech_level==4)||(tech_level==5))
        {
            if (AIHasRes( player, 125, 125) && (AITechCount(player,  c_PU_DarkTemplar, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_DarkTemplar, 1);     
            }
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 20 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 15 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if (AIHasRes( player, 400, 400) && (AITechCount(player, c_PU_HighTemplar, c_techCountQueuedOrBetter ) < 3 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_HighTemplar , 1);     
            }
            if (AITechCount(player, c_PU_DarkTemplar, c_techCountQueuedOrBetter )>=FixedToInt(0.7*10))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else if ((tech_level==6)||(tech_level==7))
        {
            if (AIHasRes( player, 125, 125) && (AITechCount(player,  c_PU_DarkTemplar, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_DarkTemplar, 1);     
            }
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 20 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 15 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if (AIHasRes( player, 400, 400) && (AITechCount(player, c_PU_HighTemplar, c_techCountQueuedOrBetter ) < 3 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_HighTemplar , 1);     
            }
            if (AITechCount(player, c_PU_DarkTemplar, c_techCountQueuedOrBetter )>=FixedToInt(0.7*10))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }
        }
        else
        {   
            if (AIHasRes( player, 125, 125) && (AITechCount(player, c_PU_DarkTemplar , c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_DarkTemplar , 1);     
            }
            if (AIHasRes( player, 100, 0) && (AITechCount(player, c_PU_Zealot, c_techCountQueuedOrBetter ) < 20 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Zealot, 1);     
            }
            if (AIHasRes( player, 125, 50) && (AITechCount(player, c_PU_Stalker, c_techCountQueuedOrBetter ) < 15 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Stalker, 1);     
            }
            if (AIHasRes( player, 200, 100) && (AITechCount(player, c_PU_Immortal, c_techCountQueuedOrBetter ) < 10 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Immortal, 1);     
            }
            if (AIHasRes( player, 150, 150) && (AITechCount(player, c_PU_Phoenix , c_techCountQueuedOrBetter ) < 2 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Phoenix , 1);     
            }
            if (AIHasRes( player, 400, 400) && (AITechCount(player, c_PU_Colossus, c_techCountQueuedOrBetter ) < 1 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Colossus, 1);     
            }   
            if (AIHasRes( player, 500, 500) && (AITechCount(player, c_PU_Carrier, c_techCountQueuedOrBetter ) < 3 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Carrier, 1);     
            }
            if (AIHasRes( player, 200, 200) && (AITechCount(player, c_PU_HighTemplar, c_techCountQueuedOrBetter ) < 3 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_HighTemplar , 1);     
            }
            if (AIHasRes( player, 500, 500) && (AITechCount(player, c_PU_Mothership , c_techCountQueuedOrBetter ) < 1 ))
            {
                AITrain ( player, 1, c_townMain, c_PU_Mothership , 1);     
            }
            if (AITechCount(player, c_PU_DarkTemplar, c_techCountQueuedOrBetter )>=FixedToInt(0.7*10))
            {
                AIWaveMerge(player, c_waveMain, c_waveAttack);
                AISetAttackState(player, e_attackState_Attack);
            }           
        }
    }
    else if (!(IAI_AirGround) &&(IAI_Ground == 3)) //Gnd3
    {   
       
    }
        t = t+ 1;
        }