I changed the SoB Tech tree and now i'm struggling with adding the changes to the AI so it recognizes changes of Tier Level.
Quick summary of what i changed:
T2 Addon moved to infantry building.
T3 Addon also moved to infantry building
T4 Addon for HQ
I compared to other races buildbasestrategy.ai files and changed the "function SistersBuildBaseStrategy:UpdateTierLevel()" about 20 times but i just can't get it to work properly.
So this is the function I ended up with:
-- Reset tier level
self.tierLevel = 1
-- Prepare
local iInfantryAddon1ID = cpu_manager.stats:GetAddOnID("addon_sisters_convent_1")
local iInfantryAddon2ID = cpu_manager.stats:GetAddOnID("addon_sisters_convent_2")
local iHQAddonID = cpu_manager.stats:GetAddOnID("addon_sisters_inquisition_hq")
local oStats = cpu_manager.stats:GetPlayerStatsFromID( cpu_manager.player_id )
-- Check for addons
for oBase in oStats:GetBases() do
-- Check for valid building
if (oBase:IsValid() and not oBase:IsListeningPost()) then
-- Check for Infantry Addon 2
if (oBase:HasAddOn(iInfantryAddon2ID)) then
-- We still have the HQ Addon
if (oBase:HasAddOn(iHQAddonID)) then
self.tierLevel = 4
return
else
self.tierLevel = 3
return
end
-- Check for Infantry Addon 1
elseif (oBase:HasAddOn(iInfantryAddon1ID)) then
self.tierLevel = 2
end
end
end
end