Results 1 to 12 of 12

AI coding question !!!!

  1. #1

    AI coding question !!!!

    hi everyone ! i'm trying to edit something for the ai.i want to make the ai sapm more heavy unit like m26 pershing or tiger.but i dont know the number demand_incrase like below.i need to put higher number or lower number to make them build more this unit ?
    here is the code in the ai_purchasing rule :
    if (unitPBG == SBP.ALLIES.M26_PERSHING) then
    local count = UtilPBG_CountAlive( SBP.ALLIES.M26_PERSHING )
    if (armor_enemy == true or veh_enemy == true) then
    if (count < 1) then
    demand_increase = 120
    elseif (count < 2) then
    demand_increase = 80
    else
    demand_increase = 40
    end
    elseif (count < 1) then
    demand_increase = 70
    elseif (count < 2) then
    demand_increase = 40
    else
    demand_increase = 15
    end
    return demand_increase
    end
    sorry my bad english

  2. #2
    T-T please some one help me !!!

  3. #3
    Member CoDiEx's Avatar
    Join Date
    Feb 2012
    Location
    Fighting in Europe
    i have one way, but it is just a copy paste thing.
    Data\ai\personality\buildorder_lib.ai

    then paste this: {"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
    in every build list
    and under each other like:
    Code:
    allied_buildorder = {
    	
    	-- this build-order isn't optimal for Allies, but will add some flavor and randomness, even for Hard/Expert.
    	{
    		name = "Early Support Weapons Then Sniper",	
    		fuel_mult = 1.5,
    		vp_mult = 0.5,
    		list = {
    			{"produce", PITEM_Spawn, SBP.ALLIES.ENGINEER, maxlimit = 2 },
    			{"building", EBP.ALLIES.ARMORY, maxlimit = 1, bs_style = BS_OuterBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.SNIPER, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.HEAVYMG, maxlimit = 3 },
                            {"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
                            {"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
                            {"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
                            }
    },

  4. #4
    thanks for helping me !
    but i did what you said but it's still the same,only build 2 pershing and wait until it die.it build sherman alot.
    here it's the code :
    Code:
    -- Armor
    	{	name = "Armor_only",
    		filters = { {OnlyOnThisDoctrine, 2 } },
    		list = {
    			{"produce", PITEM_Spawn, SBP.ALLIES.ENGINEER, maxlimit = 2 },
    			{"building", EBP.ALLIES.BARRACKS, maxlimit = 1, bs_style = BS_OuterBase },
    			{"building", EBP.ALLIES.TRIAGE, maxlimit = 2, bs_style = BS_NearBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RIFLEMEN, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.HEAVYMG, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.MORTAR, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RIFLEMEN, maxlimit = 3 },
    			{"building", EBP.ALLIES.ARMORY, maxlimit = 1, bs_style = BS_NearBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.JEEP_RECOILLESS, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.SNIPER, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RANGER_TEAM, maxlimit = 2 },
    			{"building", EBP.ALLIES.MOTORPOOL, maxlimit = 1, bs_style = BS_OuterBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M16_HALFTRACK, maxlimit = 3 },
    			{"produce", PITEM_Upgrade, UPG.ALLIES.MOTORPOL_UPGRADE, maxlimit = 1 },
    			--{"produce", PITEM_Spawn, SBP.ALLIES.GREYSTUART, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.GREYHOUND, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M21_MORTAR_HALFTRACK, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M16_HALFTRACK, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RANGER_TEAM_AT, maxlimit = 2 },
    			--{"produce", PITEM_Spawn, SBP.ALLIES.GREYSTUART, maxlimit = 3 },
    			--{"produce", PITEM_Spawn, SBP.ALLIES.GREYSTUART, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.GREYHOUND, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.GREYHOUND, maxlimit = 2 },
    			{"building", EBP.ALLIES.QUARTER_MASTER, maxlimit = 1, bs_style = BS_NearBase },
    			--{"building", EBP.ALLIES.TANK_DEPOT, maxlimit = 1, bs_style = BS_OuterBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
    		}

  5. #5
    Member CoDiEx's Avatar
    Join Date
    Feb 2012
    Location
    Fighting in Europe
    is that a custom one?

    make sure there is no requirement that says only 2 unit of that type on the battlefield.
    but try reduce this:
    Code:
    -- Armor
    	{	name = "Armor_only",
    		filters = { {OnlyOnThisDoctrine, 2 } },
    		list = {
    			{"produce", PITEM_Spawn, SBP.ALLIES.ENGINEER, maxlimit = 2 },
    			{"building", EBP.ALLIES.BARRACKS, maxlimit = 1, bs_style = BS_OuterBase },
    			{"building", EBP.ALLIES.TRIAGE, maxlimit = 2, bs_style = BS_NearBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RIFLEMEN, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.HEAVYMG, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.MORTAR, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RIFLEMEN, maxlimit = 3 },
    			{"building", EBP.ALLIES.ARMORY, maxlimit = 1, bs_style = BS_NearBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.JEEP_RECOILLESS, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.SNIPER, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RANGER_TEAM, maxlimit = 2 },
    			{"building", EBP.ALLIES.MOTORPOOL, maxlimit = 1, bs_style = BS_OuterBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M16_HALFTRACK, maxlimit = 3 },
    			{"produce", PITEM_Upgrade, UPG.ALLIES.MOTORPOL_UPGRADE, maxlimit = 1 },
    			--{"produce", PITEM_Spawn, SBP.ALLIES.GREYSTUART, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.GREYHOUND, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M21_MORTAR_HALFTRACK, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M16_HALFTRACK, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.RANGER_TEAM_AT, maxlimit = 2 },
    			--{"produce", PITEM_Spawn, SBP.ALLIES.GREYSTUART, maxlimit = 3 },
    			--{"produce", PITEM_Spawn, SBP.ALLIES.GREYSTUART, maxlimit = 3 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.GREYHOUND, maxlimit = 2 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.GREYHOUND, maxlimit = 2 },
    			{"building", EBP.ALLIES.QUARTER_MASTER, maxlimit = 1, bs_style = BS_NearBase },
    			--{"building", EBP.ALLIES.TANK_DEPOT, maxlimit = 1, bs_style = BS_OuterBase },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 1 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 2 }, -- im reducing these number
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 3 }, -- this will maybe help
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 4 },
    			{"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 5 },
    		}

    Code:
    {"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 2 }, -- im reducing these number
    Code:
    maxlimit = 2 }, -- im reducing these number
    instead of:

    Code:
    maxlimit = 1 }, -- it is this number you should try reduce and see what happens
    EDIT:

    we are actually setting the maxlimit with that.

  6. #6
    oh,it't still the same,it only build 2 or 3 pershing.not spam like other vehicles.maybe i edit some value in purchasing_rule in my frist post,but i dont know lower demand value or higher value make the ai build more pershing.i also remove the limit of pershing cap.and this is actually ai code form blitzkrig mod.im trying to make the ai more challenge since i only play w computer.

  7. #7
    Member CoDiEx's Avatar
    Join Date
    Feb 2012
    Location
    Fighting in Europe
    try set the AI priority up, in the Attrib files

  8. #8
    Code:
    {"produce", PITEM_Spawn, SBP.ALLIES.M26_PERSHING, maxlimit = 2 }, -- im reducing these number
    Code:
    maxlimit = 2 }, -- im reducing these number
    instead of:

    Code:
    maxlimit = 1 }, -- it is this number you should try reduce and see what happens
    These are parts of Build orders, build orders are active max for starting 3-6 mins of game later they don't make anything.
    I don't have code in front of me currently so i will just write what i remember.
    In rules_unit_purchase.ai there are some units lines with AI limits on some units declared as tables like

    Code:
    axis_purchase_limits = { SBP.AXIS.SOMTHING = 3 }
    You can do it that way or you can make new if loop in function for purchasing CT units, something like:
    Code:
    if(unit_pbg == SBP.ALLIES.PERCHING) then
       if (CountAliveOrProduced(SBP.ALLIES.PERCHING) == 1) then
          return DemandNeverBuild
       else
          return 40
       end
    end
    Hope it helps.

  9. #9
    the code is acttually like my first post what should i put to make the ai produce more perching ?
    @codiex : where is ai priority ? i cant find it

  10. #10
    Member CoDiEx's Avatar
    Join Date
    Feb 2012
    Location
    Fighting in Europe
    in the sbps files: "squad_ai"

  11. #11
    which priority should i set up ? there are some priority in the squad_ai : attack_priority ;defend_priority....

  12. #12
    Member CoDiEx's Avatar
    Join Date
    Feb 2012
    Location
    Fighting in Europe
    class_priority

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •