A New Era dawned - Turrets all on FrontLine!
#1
Posted 04 February 2005 - 07:17 AM
I just came off a 2vs2 (2 Human SM/CSM vs 2 HARDER AI Ork/Eldar) on the map 4p_Mountain Trail (myself and my colleague were on the right-most start points #1 and 3.)
What was different this time? Both Eldar and Ork players added 2-3 turrets per fortified LP that faced us effectively creating a "fireline" that the AI used to retreat behind. What was brillant was that the turrets and LPs were all randomly updated so you never knew what to expect. AMAZING! Game went through without a hitch until my partner was nearly defeated by a combo Ork/Eldar incursion like no other (was apocalyptic) so as this was happening I was able to penetrate deep into Eldar territory and successfully eradicated them.
Some observations:
1) For Eldar at least, for some reason updates all turrets to Tier1. Some games I've noticed its random however. For the turrets on the firelines, they were all random. VERY NICE INDEED!
2) AI was not as aggressive at replacing destroyed turrets on those LP firelines. This is key for me where if I'm repelled back, the AI should try to rebuild its turrets again as quick as possible. Could have been money-related as one Eldar LP I destroyed, I came back and one new turret was erected there where it was all destroyed.
3) Still seems a little relunctant to build uber-units (ie. Avatar and Squiggy). Again, could be cash-related but would love to make the AI more likely to allot money for them.
Nevertheless.. WoW! Impressed to say the least.. no issues.. no crashes.. seamless! AI was super-powerful mid-late game with all his upgrades.
Outstanding job guys! It was semi-close for my bud (he lost his entire front line and was exposed at home base) until the Eldar were removed.
We've made HUGE strides here - hats off to all of you!
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#3
Posted 04 February 2005 - 04:02 PM
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#5
Posted 04 February 2005 - 05:51 PM
One tip: double check your results.
I found the AI builds towards its enemy, which in 4 way games changes as it defeats one enemy. So the turrets end up in the wrong place.
Id doesnt sound like it will a be problem for you but id check just the same over 3 or 4 games.
Giskard
#6
Posted 04 February 2005 - 06:14 PM
Some issues to be addressed:
1) AI still upgrades all his base defenses that reside in his main base all to anti-vehicle instead of mixing them up. This may have something to do with the fact those turrets are created in the buildorderstrategyinfo.ai rather than through Larkin's LP script. Turrets on expansion LPs are fine - they are balanced.
2) Check my uber-unit creation script - I avoided the requirement that the AI check "self.rating < self.info.uber_advantage" so the AI just needs to check if he can build, say, an Avatar AND if he has the req. requirement based in the buildbasestrategyinfo.ai. AI should build uber units more often although still testing. Chaos, Eldar, and Ork are affected by this.
3) Still wishing the AI to build turrets a little sooner in Tier1 as LPs are yet unupgraded and thus vulnerable.
Any other changes/recommendations you wish. Its all still on-the-go but damn what progress!! I've incorporated many of the changes made in the last week up until this morning so go nuts. I'm liking it alot ALTHOUGH there is always room for improvement!
Thanks guys!
Attached Files
Edited by thudo, 04 February 2005 - 06:15 PM.
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#7
#8
Posted 04 February 2005 - 08:08 PM
Just tried it in two 1vs1 maps with Hard difficulty. AI seemed more passive at the start, which probably was because it built numerous (5+) turrets in its base. I do like that the AI can now build turrets, but I doubt this was your purpose.
#9
Posted 04 February 2005 - 08:13 PM
Think I know the reason for that...1) AI still upgrades all his base defenses that reside in his main base all to anti-vehicle instead of mixing them up. This may have something to do with the fact those turrets are created in the buildorderstrategyinfo.ai rather than through Larkin's LP script. Turrets on expansion LPs are fine - they are balanced.
... The AI will apply an upgrade to the first building it can find that will support the upgrade:
function BuildNotifiedAddOnPlan:ObtainBuilder() for build_channel in build_manager:GetUnlockedBuildChannelAIs() do --don't queue if( build_channel:IsBuilding() == 0 ) then --now build something! local item_index = build_channel:GetItemIndexFromID(BuildChannelAI.PQ_AddOn, self.item_id ) if( item_index ~= BuildChannelAI.INVALID_INDEX ) then if( build_channel:CanAddToQueue( BuildChannelAI.PQ_AddOn, self.item_id ) == BuildChannelAI.CANBUILD_Ok ) then --lock and save it! BuildPlan.SetBuilder( self, build_channel ) --no needs Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled ) return end end end end endAnd as the first turrets to be built (and thus found) are in the main base they will be upgraded. Working on a fix for this...
Edit: Legionaire, it is only available to those who look in our forums often (did u use zip or installer?). Thud, should we make this our first official public release?
Edited by Corsix, 04 February 2005 - 08:15 PM.
#10
Posted 04 February 2005 - 09:44 PM
---------------------------------------- -- File: 'marinebuildbasestrategy.ai' -- Edited by Thudmeizer @ 03.02.2005 -- Edited by Corsix @ 15.01.2005 -- Edited by Corsix @ 04.02.2005Changed the percentage of stuff upgraded:
self.percent_turr_upgraded = math.random(40,60) self.percent_post_upgraded = math.random(40,60)(Down from 55,75)
Modified function:
function MarineBuildBaseStrategy:DoUpgradesAndAddons() -- Corsix Added if cpu_manager.cpu_player:IsResearchComplete( "squad_cap_research" ) then local id = self.post_addon_id if( self:PlanExists("Build AddOn Plan", id) == false ) then self.AddPlan( self, BuildAddOnPlan( id ) ) end if not cpu_manager.cpu_player:IsResearchComplete( self.max_weapons_research_name ) then local id = self.max_weapons_research_id if( self:PlanExists("Build Research Plan", id) == false ) then self.AddPlan( self, BuildResearchPlan( id ) ) --don't build other research items return true end end if self:IsInSecondTier() then --Corsix Added local num_turr = 0 local num_up_turr = 0 local num_post = 0 local num_up_post = 0 local up_turret_positions = {} local up_post_positions = {} for build_channel in build_manager:GetBuildChannelAIs() do if build_channel:GetBlueprintID() == self.turret_id then num_turr = num_turr + 1 for tabitr = 1, table.getn(self.upgraded_turrets) do if self.upgraded_turrets[tabitr] == build_channel:GetID() then num_up_turr = num_up_turr + 1 up_turret_positions[num_up_turr] = build_channel:GetEntity():GetPosition() end end end if build_channel:GetBlueprintID() == self.post_id then num_post = num_post + 1 for tabitr = 1, table.getn(self.upgraded_posts) do --file:write(upgraded_posts[tabitr],"?",build_channel:GetID()," ") if self.upgraded_posts[tabitr] == build_channel:GetID() then num_up_post = num_up_post + 1 up_post_positions[num_up_post] = build_channel:GetEntity():GetPosition() end end end end --Corsix Modded local id_2 = self.post_addon_2_id -- Added these two lines local before = math.abs(self.percent_post_upgraded - (num_up_post/num_post*100)) local after = math.abs(self.percent_post_upgraded - ((num_up_post+1)/num_post*100)) --Added "and"... + changed plan type if( self:PlanExists("Build NotifiedAddOn Plan", id_2) == false ) and after <= before then self.AddPlan( self, BuildNotifiedAddOnPlan( id_2 , 0, up_post_positions) ) end local id_2 = self.turret_addon_2_id -- Added these two lines local before = math.abs(self.percent_turr_upgraded - (num_up_turr/num_turr*100)) local after = math.abs(self.percent_turr_upgraded - ((num_up_turr+1)/num_turr*100)) --Added "and"... + changed plan type if( self:PlanExists("Build NotifiedAddOn Plan", id_2) == false ) and after <= before then self.AddPlan( self, BuildNotifiedAddOnPlan( id_2 , 1, up_turret_positions) ) end --End end end BuildBaseStrategy.DoUpgradesAndAddons( self ) endAnd the other modified file:
---------------------------------------- -- File: 'buildnotifiedaddonplan.ai' -- Created by Corsix @ 17.01.2005 -- Modified by Corsix @ 04.02.2005Modified functions:
-- Corsix modified (added awayfromtable code) function BuildNotifiedAddOnPlan:__init( addon_id , nofity_code , awayfromtable ) super( CpuPlayer.CT_BuildAddOns ) BuildPlan.SetItemID( self, addon_id ) BuildPlan.SetItemName( self, cpu_manager.stats:GetAddOnName( addon_id ) ) Plan.SetNeeds( self, "Asking for builder", BuildNotifiedAddOnPlan.ObtainBuilder ) Plan.SetState( self, "Wanting to build: "..self.item_name, BuildNotifiedAddOnPlan.BuildAddOn ) Plan.SetName( self, "Build NotifiedAddOn Plan" ) self.notify = nofity_code if awayfromtable ~= nil then self.buildawayfrom = awayfromtable if table.getn(awayfromtable) == 0 then self.dobuildaway = false else self.dobuildaway = true end else self.buildawayfrom = {} self.dobuildaway = false end --End end -- Corsix modified (added buildawayfrom code) function BuildNotifiedAddOnPlan:ObtainBuilder() local bestchannel local bestchanneldist = 0 local gotchannel = false for build_channel in build_manager:GetUnlockedBuildChannelAIs() do --don't queue if( build_channel:IsBuilding() == 0 ) then --now build something! local item_index = build_channel:GetItemIndexFromID(BuildChannelAI.PQ_AddOn, self.item_id ) if( item_index ~= BuildChannelAI.INVALID_INDEX ) then if( build_channel:CanAddToQueue( BuildChannelAI.PQ_AddOn, self.item_id ) == BuildChannelAI.CANBUILD_Ok ) then if self.dobuildaway == true then local thisdist = 0 for table_itr in self.buildawayfrom do thisdist = thisdist + distance_sqr( self.buildawayfrom[table_itr] , build_channel:GetEntity():GetPosition() ) end if gotchannel == true then if thisdist > bestchanneldist then bestchannel = build_channel bestchanneldist = thisdist end else bestchannel = build_channel bestchanneldist = thisdist gotchannel = true end else --lock and save it! BuildPlan.SetBuilder( self, build_channel ) --no needs Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled ) return end end end end end if self.dobuildaway == true and gotchannel == true then --lock and save it! BuildPlan.SetBuilder( self, bestchannel ) --no needs Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled ) return end end --End
#11
Posted 04 February 2005 - 09:59 PM
Btw, Legionaire.. the enhanced AI @ Hard skill is a little more subdued at present. I usually test @ HARDER skill and up and yes the AI is building turrets at start.. not many as there is a balance now. I think I didn't tweak HARD skill fully.
UPDATE: Just tweaked the HARD Skill.. Its more like it used to be now. Problem was in the order the AI built his base in the first 3mins. See.. it can sometimes be all in the buildorder. Ahhggrrr... another build! <sigh>
Corsix: will test that.. thanks.
Edited by thudo, 04 February 2005 - 10:00 PM.
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#12
Posted 04 February 2005 - 10:34 PM
buildnotifiedaddonplan.ai
---------------------------------------- -- File: 'buildnotifiedaddonplan.ai' -- Created by Corsix @ 04.02.2005 import ("Plans/BuildPlan.ai") class 'BuildNotifiedAddOnPlan' (BuildPlan) function BuildNotifiedAddOnPlan:__init( addon_id , nofity_code , awayfromtable ) super( CpuPlayer.CT_BuildAddOns ) BuildPlan.SetItemID( self, addon_id ) BuildPlan.SetItemName( self, cpu_manager.stats:GetAddOnName( addon_id ) ) Plan.SetNeeds( self, "Asking for builder", BuildNotifiedAddOnPlan.ObtainBuilder ) Plan.SetState( self, "Wanting to build: "..self.item_name, BuildNotifiedAddOnPlan.BuildAddOn ) Plan.SetName( self, "Build NotifiedAddOn Plan" ) self.notify = nofity_code if awayfromtable ~= nil then self.buildawayfrom = awayfromtable if table.getn(awayfromtable) == 0 then self.dobuildaway = false else self.dobuildaway = true end else self.buildawayfrom = {} self.dobuildaway = false end --End end -- Corsix modified (added buildawayfrom code) function BuildNotifiedAddOnPlan:ObtainBuilder() local bestchannel local bestchanneldist = 0 local gotchannel = false for build_channel in build_manager:GetUnlockedBuildChannelAIs() do --don't queue if( build_channel:IsBuilding() == 0 ) then --now build something! local item_index = build_channel:GetItemIndexFromID(BuildChannelAI.PQ_AddOn, self.item_id ) if( item_index ~= BuildChannelAI.INVALID_INDEX ) then if( build_channel:CanAddToQueue( BuildChannelAI.PQ_AddOn, self.item_id ) == BuildChannelAI.CANBUILD_Ok ) then if self.dobuildaway == true then local thisdist = 0 for table_itr in self.buildawayfrom do thisdist = thisdist + distance_sqr( self.buildawayfrom[table_itr] , build_channel:GetEntity():GetPosition() ) end if gotchannel == true then if thisdist > bestchanneldist then bestchannel = build_channel bestchanneldist = thisdist end else bestchannel = build_channel bestchanneldist = thisdist gotchannel = true end else --lock and save it! BuildPlan.SetBuilder( self, build_channel ) --no needs Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled ) return end end end end end if self.dobuildaway == true and gotchannel == true then --lock and save it! BuildPlan.SetBuilder( self, bestchannel ) --no needs Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled ) return end end --End
marinebuildbasestrategy.ai
---------------------------------------- -- File: 'marinebuildbasestrategy.ai' -- Edited by Thudmeizer @ 03.02.2005 -- Edited by Corsix @ 15.01.2005 class 'MarineBuildBaseStrategy' (BuildBaseStrategy) function MarineBuildBaseStrategy:__init( baseinfo ) super( baseinfo ) self.generator_name = "space_marine_generator" self.bigger_generator_id = cpu_manager.stats:GetBuildingID( "space_marine_thermo_generator" ) self.vehicle_building_id = cpu_manager.stats:GetBuildingID( "space_marine_vehicle_building" ) self.vehicle_building_name = "space_marine_vehicle_building" self.barracks_id = cpu_manager.stats:GetBuildingID( "space_marine_barracks" ) self.barracks_name = "space_marine_barracks" self.post_addon_id = cpu_manager.stats:GetAddOnID( "space_marine_list_post_addon_1" ) self.post_addon_2_id = cpu_manager.stats:GetAddOnID( "space_marine_list_post_addon_2" ) self.turret_id = cpu_manager.stats:GetBuildingID( "space_marine_turret_bolter" ) self.turret_name = "space_marine_turret_bolter" self.turret_addon_2_id = cpu_manager.stats:GetAddOnID( "space_marine_turret_addon" ) self.hq_addon_1_id = cpu_manager.stats:GetAddOnID( "space_marine_hq_addon_1" ) self.hq_addon_2_id = cpu_manager.stats:GetAddOnID( "space_marine_hq_addon_2" ) self.max_weapons_research_name = "marine_max_weapons_research" self.max_weapons_research_id = cpu_manager.stats:GetResearchID( self.max_weapons_research_name ) --Corsix Added self.post_id = cpu_manager.stats:GetBuildingID( "space_marine_listening_post" ) self.percent_turr_upgraded = math.random(40,60) self.percent_post_upgraded = math.random(40,60) self.upgraded_posts = {} self.upgraded_turrets = {} --End end function MarineBuildBaseStrategy:EvaluateSquadCap() if build_manager:GetSquadCapLeft() <= self.info.squad_cap_threshold then --research more squad cap(Thudmeizer: Fixed so it researches only two Squad Caps) local build_type = CpuBuildType() build_type.btype = CpuPrerequisites.BT_Research if not cpu_manager.cpu_player:IsResearchComplete( "squad_cap_research" ) then build_type.name = "squad_cap_research" self:TryBuild( build_type ) elseif not cpu_manager.cpu_player:IsResearchComplete( "squad_cap_research_1" ) then build_type.name = "squad_cap_research_1" self:TryBuild( build_type ) end end local check_support_cap = false for build_channel in build_manager:GetBuildChannelAIs() do if build_channel:GetBlueprintID() == self.vehicle_building_id then check_support_cap = true break end end if check_support_cap and build_manager:GetSupportCapLeft() <= self.info.support_cap_threshold then --research more support cap(Thudmeizer: Fixed so it researches to Level 4) local build_type = CpuBuildType() build_type.btype = CpuPrerequisites.BT_Research if not cpu_manager.cpu_player:IsResearchComplete( "support_cap_research" ) then build_type.name = "support_cap_research" self:TryBuild( build_type ) elseif not cpu_manager.cpu_player:IsResearchComplete( "support_cap_research_1" ) then build_type.name = "support_cap_research_1" self:TryBuild( build_type ) elseif not cpu_manager.cpu_player:IsResearchComplete( "support_cap_research_2" ) then build_type.name = "support_cap_research_2" self:TryBuild( build_type ) elseif not cpu_manager.cpu_player:IsResearchComplete( "support_cap_research_3" ) then build_type.name = "support_cap_research_3" self:TryBuild( build_type ) end end end function MarineBuildBaseStrategy:DoSecondaryBuildings() --build a second machine pit --check that we have one and only one machine cult local num_vehicle_buildings = 0 local num_barracks = 0 local num_turrets = 0 for build_channel in build_manager:GetBuildChannelAIs() do if build_channel:GetBlueprintID() == self.vehicle_building_id then num_vehicle_buildings = num_vehicle_buildings + 1 end if build_channel:GetBlueprintID() == self.barracks_id then num_barracks = num_barracks + 1 end if build_channel:GetBlueprintID() == self.turret_id then num_turrets = num_turrets + 1 end end --build a second machine cult if num_vehicle_buildings == 1 and resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 1000 and resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Power ) > 500 then local build_type = CpuBuildType() build_type.btype = CpuPrerequisites.BT_Building build_type.name = self.vehicle_building_name self:TryBuild( build_type ) --build a second barracks elseif num_barracks == 1 and resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 1500 then local build_type = CpuBuildType() build_type.btype = CpuPrerequisites.BT_Building build_type.name = self.barracks_name self:TryBuild( build_type ) --build a turret elseif num_turrets < 15 and resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 250 and resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Power ) > 100 then local build_type = CpuBuildType() build_type.btype = CpuPrerequisites.BT_Building build_type.name = self.turret_name self:TryBuild( build_type ) end end function MarineBuildBaseStrategy:IsInSecondTier() local stats = cpu_manager.stats:GetPlayerStatsFromID( cpu_manager.player_id ) for base in stats:GetBases() do if base:HasAddOn( self.hq_addon_1_id ) then return true end end return false end function MarineBuildBaseStrategy:IsInThirdTier() local stats = cpu_manager.stats:GetPlayerStatsFromID( cpu_manager.player_id ) for base in stats:GetBases() do if base:HasAddOn( self.hq_addon_2_id ) then return true end end return false end function MarineBuildBaseStrategy:DoUpgradesAndAddons() -- Corsix Added if cpu_manager.cpu_player:IsResearchComplete( "squad_cap_research" ) then local id = self.post_addon_id if( self:PlanExists("Build AddOn Plan", id) == false ) then self.AddPlan( self, BuildAddOnPlan( id ) ) end if not cpu_manager.cpu_player:IsResearchComplete( self.max_weapons_research_name ) then local id = self.max_weapons_research_id if( self:PlanExists("Build Research Plan", id) == false ) then self.AddPlan( self, BuildResearchPlan( id ) ) --don't build other research items return true end end if self:IsInSecondTier() then --Corsix Added local num_turr = 0 local num_up_turr = 0 local num_post = 0 local num_up_post = 0 for build_channel in build_manager:GetBuildChannelAIs() do if build_channel:GetBlueprintID() == self.turret_id then num_turr = num_turr + 1 for tabitr = 1, table.getn(self.upgraded_turrets) do if self.upgraded_turrets[tabitr] == build_channel:GetID() then num_up_turr = num_up_turr + 1 up_turret_positions[num_up_turr] = build_channel:GetEntity():GetPosition() end end end if build_channel:GetBlueprintID() == self.post_id then num_post = num_post + 1 for tabitr = 1, table.getn(self.upgraded_posts) do --file:write(upgraded_posts[tabitr],"?",build_channel:GetID()," ") if self.upgraded_posts[tabitr] == build_channel:GetID() then num_up_post = num_up_post + 1 up_post_positions[num_up_post] = build_channel:GetEntity():GetPosition() end end end end --Corsix Modded local id_2 = self.post_addon_2_id -- Added these two lines local before = math.abs(self.percent_post_upgraded - (num_up_post/num_post*100)) local after = math.abs(self.percent_post_upgraded - ((num_up_post+1)/num_post*100)) --Added "and"... + changed plan type if( self:PlanExists("Build NotifiedAddOn Plan", id_2) == false ) and after <= before then self.AddPlan( self, BuildNotifiedAddOnPlan( id_2 , 0, up_post_positions) ) end local id_2 = self.turret_addon_2_id -- Added these two lines local before = math.abs(self.percent_turr_upgraded - (num_up_turr/num_turr*100)) local after = math.abs(self.percent_turr_upgraded - ((num_up_turr+1)/num_turr*100)) --Added "and"... + changed plan type if( self:PlanExists("Build NotifiedAddOn Plan", id_2) == false ) and after <= before then self.AddPlan( self, BuildNotifiedAddOnPlan( id_2 , 1, up_turret_positions) ) end --End end end BuildBaseStrategy.DoUpgradesAndAddons( self ) end --Corsix Added function MarineBuildBaseStrategy:AddOnNotify( addon_id, notify_code , build_channel) if addon_id == self.post_addon_2_id then self.upgraded_posts[table.getn(self.upgraded_posts)+1] = build_channel:GetID() return end if addon_id == self.turret_addon_2_id then self.upgraded_turrets[table.getn(self.upgraded_turrets)+1] = build_channel:GetID() end end --End
Thanks..
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#14
Posted 04 February 2005 - 10:56 PM
Okie.. going to test!
If it errors again, I'll record the one line error in the console..
Thanks for the expedient reply bud!!
Edited by thudo, 04 February 2005 - 10:58 PM.
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#16
Posted 04 February 2005 - 11:59 PM
As for "expedient" - means "quick", "fast"..
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#17
Posted 05 February 2005 - 12:21 AM
Error is: *ALERT* no static 'BuildAddOn' in class 'BuildNotifiedAddonPlan'
SCAR -- Could not execute rule "AI Think".
Happens just when the SM's HQ upgrades itself to Tier2.
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#18
Posted 05 February 2005 - 02:34 AM
It was in the buildnotifiedaddonplan.ai:
---------------------------------------- -- File: 'buildnotifiedaddonplan.ai' -- Created by Corsix @ 04.02.2005 import ("Plans/BuildNotifiedAddOnPlan.ai") class 'BuildNotifiedAddOnPlan' (BuildPlan) function BuildNotifiedAddOnPlan:__init( addon_id , nofity_code , awayfromtable ) super( CpuPlayer.CT_BuildAddOns ) BuildPlan.SetItemID( self, addon_id ) BuildPlan.SetItemName( self, cpu_manager.stats:GetAddOnName( addon_id ) ) Plan.SetNeeds( self, "Asking for builder", BuildNotifiedAddOnPlan.ObtainBuilder ) Plan.SetState( self, "Wanting to build: "..self.item_name, BuildNotifiedAddOnPlan.BuildAddOn ) Plan.SetName( self, "Build NotifiedAddOn Plan" ) self.notify = nofity_code if awayfromtable ~= nil then self.buildawayfrom = awayfromtable if table.getn(awayfromtable) == 0 then self.dobuildaway = false else self.dobuildaway = true end else self.buildawayfrom = {} self.dobuildaway = false end --End end -- Corsix modified (added buildawayfrom code) function BuildNotifiedAddOnPlan:ObtainBuilder() local bestchannel local bestchanneldist = 0 local gotchannel = false for build_channel in build_manager:GetUnlockedBuildChannelAIs() do --don't queue if( build_channel:IsBuilding() == 0 ) then --now build something! local item_index = build_channel:GetItemIndexFromID(BuildChannelAI.PQ_AddOn, self.item_id ) if( item_index ~= BuildChannelAI.INVALID_INDEX ) then if( build_channel:CanAddToQueue( BuildChannelAI.PQ_AddOn, self.item_id ) == BuildChannelAI.CANBUILD_Ok ) then if self.dobuildaway == true then local thisdist = 0 for table_itr in self.buildawayfrom do thisdist = thisdist + distance_sqr( self.buildawayfrom[table_itr] , build_channel:GetEntity():GetPosition() ) end if gotchannel == true then if thisdist > bestchanneldist then bestchannel = build_channel bestchanneldist = thisdist end else bestchannel = build_channel bestchanneldist = thisdist gotchannel = true end else --lock and save it! BuildPlan.SetBuilder( self, build_channel ) --no needs Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled ) return end end end end end if self.dobuildaway == true and gotchannel == true then --lock and save it! BuildPlan.SetBuilder( self, bestchannel ) --no needs Plan.SetNeeds( self, "No needs", Plan.NeedsFulfilled ) return end end --End function BuildNotifiedAddOnPlan:Retry() if( self.builder:CanAddToQueue( BuildChannelAI.PQ_AddOn, self.item_id ) == BuildChannelAI.CANBUILD_Ok ) then self.builder:BuildAddOn( self.item_id ) end end function BuildNotifiedAddOnPlan:BuildAddOn() if self.builder ~= nil then --build it! self.builder:BuildAddOn( self.item_id ) --change state Plan.SetState( self, "Building a "..self.item_name, BuildPlan.BuildingState ) cpu_manager.build_base_strategy:AddOnNotify(self.item_id,self.notify,self.builder) return end aitrace( "can't build "..self.item_name ) end
The last two function calls were missing. Added them, ran the FAST speed to see it through.. he got passed Tier2 without issue and now all Turrets upgrade randomly even in the main base! Yehaaaa!!
Now testing it MP..
e.
Edited by thudo, 05 February 2005 - 02:36 AM.
Dawn of War Advanced AI Headquarters
Latest DoW Advanced AI Download!
#19 Guest_UserBytesBack_*
Posted 09 February 2005 - 11:32 AM
I just stumbled over this forum and downloaded your "beta-release" (or whatever you call it now...)
I tried it out yesterday and was surprised it ran without problems (AI got stomped, though - as usual) compliments to all of you!
Some questions from my part: May i mod your mod? And can you do it in the textfiles or do you need some specialized compiler or something?
(I'm not very good at programming but i think i understand this script... modifying it is another story...)
And if i don't manage it - is it possible to give the AI attack/ retreat parameters?
(most ai's die because i find out where they gather their troops and then bomb the place to smithereens by artillery - and they just mill around and die....)
Reply to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users