Jump to content


Photo

Accelerated AI Testing


24 replies to this topic

#1 quiet_man

quiet_man
  • Members
  • 33 posts

Posted 04 February 2005 - 11:01 PM

something to accelerate testing:

add "-dev" to the start bat
@w40k.exe -dev -modname dowai

add following to the "autoexec.lua"
(if you haven't, creat it in DoW folder, same as the above bat)

bind( "F1", "slow()" )
bind( "F2", "play()" )
bind( "F3", "fastForward()" )
bind( "F4", "test()" )

function slow()
setsimrate( 1.5 );
end

function play()
setsimrate( 8 );
end

function fastForward()
setsimrate( 32 );
end

function test()
local count = World_GetPlayerCount()
g_Player1 = World_GetPlayerAt(0);
if count > 1 then
g_Player2 = World_GetPlayerAt(1);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player2, 0);
end
if count > 2 then
g_Player3 = World_GetPlayerAt(2);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player3, 0);
end
if count > 3 then
g_Player4 = World_GetPlayerAt(3);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player4, 0);
end
if count > 4 then
g_Player5 = World_GetPlayerAt(4);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player5, 0);
end
if count > 5 then
g_Player6 = World_GetPlayerAt(5);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player6, 0);
end
if count > 6 then
g_Player7 = World_GetPlayerAt(6);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player7, 0);
end
if count > 7 then
g_Player8 = World_GetPlayerAt(7);
World_EnablePlayerToPlayerFOW(g_Player1, g_Player8, 0);
end

Player_SetResource(g_Player1, RT_Requisition, 10000);
Player_SetResource(g_Player1, RT_Power, 5000);
end


Regards,
quiet_man

Edited by quiet_man, 04 February 2005 - 11:03 PM.


#2 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 05 February 2005 - 12:04 AM

Actually I have my own custom .scar for that and 2-3 maps I test with.

The only thing I don't have in your list are those four BINDS. The first three deal with AI or Game speed settings (didn't know that was possible) while the fourth I'm not quite sure what yer trying to accomplish. Having a autoexec.lua makes a whole lot of sense.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#3 quiet_man

quiet_man
  • Members
  • 33 posts

Posted 05 February 2005 - 12:53 AM

@thudo
the first three are indeed for changing gamespeed, but it works only with the "-dev" option
very handy to watch animations in slow motion or to accelerate testing

number four removes selective the FOW between you and the other player, but not between them, so you can watch two AI battling while beeing sure that removed FOW does not influence them
it also gives you some resources

works with any map in skirmish and campain

quiet_man

#4 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 05 February 2005 - 01:15 AM

FastForward would be super-useful especially if your troubleshooting a Tier upgrade at a point where an AI execution error occurs. Nice.

As for FoW.. AIs are not encumbered by FoW hence the reason they ProRate themselves against enemies + when I move my armies they move to follow even though their half a map away. DoW's AI, like almost all Skirmish AI out there, sees the entire map regardless. Sad but true. Just by-design.

Still excellent tweaks to further increase testing. Thanks bud!
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#5 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 05 February 2005 - 11:24 AM

thanks, very helpfull.

Edited by LarkinVB, 05 February 2005 - 11:24 AM.


#6 quiet_man

quiet_man
  • Members
  • 33 posts

Posted 05 February 2005 - 02:16 PM

As for FoW.. AIs are not encumbered by FoW hence the reason they ProRate themselves against enemies + when I move my armies they move to follow even though their half a map away. DoW's AI, like almost all Skirmish AI out there, sees the entire map regardless. Sad but true. Just by-design.


ok, I realy expected this
a case of overengine... aae ... I wanted to train the "if" :grin:

you can replace all the FOW stuff with just "FOW_RevealAll()"

quiet_man

#7 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 05 February 2005 - 08:42 PM

I'd like to see the day when an AI actually send concealed scouts out to first determine its rate rather knowing before hand. When it is able to effectively determine its enemy by counting defenses/units and building types then it can start to rate itself. Guess thats for an RTS down the road.

I remember in AgeOfEmpires, Ensemble's AI coders designed the AI to first send either a scout or peasant to first find where the enemies are then all of a sudden the game would "slightly" slow down indicating the AI was "on the move". It was kinda funny as we would reply to our colleagues who 'got AI-spotted': "Ah man yer screwed now".

Still.. I do wish AI would blindly upgrade its troops but not determine how good itself is or how to counteract enemy movements half a map away. Still.. all our MP Skirmish games the AI is incredible unpredictable. Attacking one guy with two enemy players while then retreating then concentrating on another totally unexpectedly.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#8 giskard

giskard
  • Members
  • 155 posts

Posted 06 February 2005 - 03:17 PM

I couldnt use this fast forward feature in my mod, the AI would wipe me out if i did ;)

Its very cool and its all down to resources and power.

Talking of AIs i noticed the AI builds towards it closest threat at the start of the game but has a stab at every threat in the game with ground troops.

As the game draws to a close the AI reduces it s attack strength in line with the enemys ability to defend it self.

In fact if you just sat there and waited on the AI after building up to your cap, the difficulty settings on their own would ensure the AI could never reach the required strenght to allow it to attack you using the default AI code.

It would sit outside your base with a massive Army and do nothing.

Youd have to bait it into attacking you.

Which is a problem with the default AI, another FIX i need to make but i can do that for hard, harder and advanced by setting the "build up to" part to 1.0 :laugh:

Giskard

#9 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 06 February 2005 - 05:49 PM

Agreed. The AI tends to buildup a sizable force, camp out many grids away from your closest base defenses or gathered units and just wait. Now that thats a real bad thing but I believe its totally based on its attack_rating vs you and whether it has a good chance of overcoming your defenses. I suppose the AI is conservative like any of us might be..

However, imagine coding a "Personality" that is randomized each game based on four templates:

o Attacker/Rusher - Fearless AI that just goes for the throat
o Defender - builds up, secures chokepoints with defenses, waits to attack until ready
o Sieger - moves like a Titan across the map with Siege units leading the way bombarding from afar - takes pot shots at defenses
o Balanced - Mixes up some of these elements so its further randomized.

Personality AIs are an incredible objective and are, in essence, the MAX HOLY GRAIL objective of them all including squad-level super-tactics.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#10 quiet_man

quiet_man
  • Members
  • 33 posts

Posted 06 February 2005 - 07:49 PM

@giskard
you have to be carefull ;) you can adjust the speed of the "fastfoward", 32 is realy fast


yes, I also recognized, the AI has big problems in 1-1 if you:
build two fighting units and ~4 builder
take ~4 Resource points, build 1-2 turrets on the exposed ones
max out resources Trier 1, build some more turrets
go Trier 2, max out resources
build uber units and win

Turrets are strong agains light forces and repair cost nothing
so the AI has heavy loses early and when you start producing heavy units it can't keep up
and using this tactic the ai defences are useless

@thudo
it also should be able to switch strategy in game
A simple decision tree:
Start -> IF Random == Rush THEN goto "Attack", goto "Standard build up"
Standard build up -> IF enemy Contact THEN goto "Attack"
Attack -> IF lose and enemy has units THEN goto "Defend", IF lose and enemy has few units THEN goto "Research"
Defend -> build defences, Research
Research -> research next Trier, IF enemy has few units OR reached next Trier goto "Attack"

quiet_man

#11 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 06 February 2005 - 09:25 PM

If you give the AI the ability to build 2 Marine Squads+FC (SM example used) near game start then we'll see whose gonna win that game on HARDER+ Skill.

Right now, HARDER+ buildorder is:

               { "flag_capture" }, { "post_builder" },
                { "flag_capture" }, { "post_builder" },
                { "building", "space_marine_generator" },
                { "building", "space_marine_turret_bolter" },
              --{ "building", "space_marine_generator" },
                { "squad", "space_marine_squad_scout" },
                { "squad", "space_marine_squad_scout" },
                { "squad", "space_marine_squad_servitor" },
                { "building", "space_marine_barracks", true },
                { "building", "space_marine_turret_bolter" },
                { "squad", "space_marine_squad_tactical" },
                { "squad", "space_marine_squad_force_commander", true },
                { "building", "space_marine_generator", true },
                { "building", "space_marine_armoury" },
                { "building", "space_marine_turret_bolter" },
                { "building", "space_marine_turret_bolter" },
                { "building", "space_marine_turret_bolter" },
                { "building", "space_marine_turret_bolter" },
which works real well although I could add a second marine squad to the mix but right now the AI will go right to build troops to ensure he's not behind. Surprised how well this system works even in 1vs1. Now on maps with such low stratpoints to capture.. well.. its about hard for everyone in general. Fortunately, few maps have such low # of stratpoints.

We'll have to work on that "decision tree" maybe in the next public release.

Having a RANDOM PERSONALITY/STRATEGY MATRIX is the ultimate for any Skirmish AI ! It makes what you face totally different and unpredictable per game. Again, its not always numbers of units that win BUT HOW THEY ARE USED. ;)

Edited by thudo, 06 February 2005 - 09:26 PM.

Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#12 Corsix

Corsix

    Code Monkey

  • Hosted
  • 290 posts
  • Location:Berkeley, UK
  • Projects:DoW AI, DoW Mod Studio
  •  Blue Text :)

Posted 06 February 2005 - 09:29 PM

You can't have a next public release until you finish this one...
Posted Image

#13 LarkinVB

LarkinVB

    title available

  • Members
  • 1,488 posts

Posted 06 February 2005 - 09:45 PM

I think the static build order is much too long and restrictive. I use I different, much shorter one. Even better it should be variable, depending on map size and number of players. But I already said that to no effect. Hope the first build release will stirr up enough feedback.

#14 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 06 February 2005 - 09:59 PM

I'm quite sure the first public release will. Its important to have a dynamic build-list based on the map conditions. Until we can determine how thats done, then for now, we'll keep it this way then make changes. Most of the maps I've played on based on this buildorder work and damn its hard as nails.

I think we're done with the first public release. I believe its time to release it, let the public make comments, then tweak for the next one based on comments.

Its beta after all..

Corsix.. I'll be providing the FINAL RELEASE CODE to you with a changelog, and perhaps a text file setting expectations with the AI and what to/not expect with it.

I'll be so glad to see it go out.

Then we'll have our first true template to import other races into it.
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#15 quiet_man

quiet_man
  • Members
  • 33 posts

Posted 06 February 2005 - 10:29 PM

yes, don't do to much at once

the new AI is already pretty nice and even if its not "super" on any map, at least now you have a "real" base to destroy :laugh:

at my first skirmish against the original AI I was searching the enemy base until I checked the map and recognized that I had rolled over its starting position long ago ;)

quiet_man

#16 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 07 February 2005 - 01:24 AM

I am super-pleased beyond words with the effort the team has put out in the last month! WoW! To from what we had to random turret upgrades (both in-base to expansions) to random turret defenses on those expansions, to reliably getting the AI to research the tech tree and build HQ addons and a nifty intimidating base, to overall AI squad aggressiveness I think we all did a swank job!

I know we're all a globe apart - I think everyone knows I'm in Central Canada (20mins North of Lake Ontario) in good olde North Toronto/Vaughan and to get LUA coders/scripters interested in this project was such a boon.

I'd love to expand our team and get people funneling in more ideas even while some of us are busy with "life stuff" but we have a solid group of 4-5 lads @ present in different timezones. I think most of you are +5-6 hours ahead of me so while I'm staying up drinking vino <oh and a little ale> yer all having your breakie!

Anyway, thanks fellows for your time, patience, LUA experience, and hope to have tonnes more fun in Feb-Apr as new War40lk civ mods start appearing..

I want to get people interested in War40k civ AI integration with, say, the Tau and Daemonhunters mod teams when they come asking in a big way. Its real easy to transplant AI brains in the doc I'm creating but the mod team whose civ mod is being done needs to give you alll the details about their units/buildings/addons/research/abilities items in order to accomplish it seamlessly. Plus it has to be playtested to ensure the new civ mod's AI doesn't crash the game. UltDrake, who did the Cadian Inquisition mod will help with this as he did it seamlessly. With his help, the "AI transplant doc" can go ahead as I have first draft done (second draft commencing).

Thanks guys!
Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#17 giskard

giskard
  • Members
  • 155 posts

Posted 07 February 2005 - 04:31 AM

quiet_man: Yes i agree the AI is like that.

Thats exactly why i changed it. Now it can take on player turrets, masses of turrets in fact and win. The rusher game doesnt need turrets really but a base builder game demands good battle follow and DOW just didnt provide that by default. You spend an hour building your base and secure points on the map only to have a 10 minute fight at the end.

My changes make the AI a real threat. For example in last nights game that i finally got to play thanks to a tip Thudo gave to me that Corsix gave to me about the version number line on modules not liking characters, the AIs base was wiped out before it finished building its base up so it rebuilt it else where. My team mate then ran right in to it and lost 5 of is 9 dreadnaughts taking on the new AI base.

Note to Thudo: regarding my pms, the AI does rebuild a base if its still building its original base up when you destroy it. IT only stops if you let it finish upgrading and then destroy it. Its like theres an off switch somewhere thats flipped when it reaches that point.

Anyway quiet_man, the smaller the map the less the AI has to play with. The Biffys map is perhaps the smallest map id consider for my AI. It seems to produce a good force on that map and build those big generators too.

Thudo: if you test my mod, remember my AI is very simply compared to yours. Much of the code you changed is still default in my AI so you will see how the AI benefits from the attack strat changes and the increased resources on their own.

You may not need some of the changes you made now you guys have the bigger listening posts. As for the big generators, id expect them to built more often because of the increased income too. You may find that problem solved for you in the AI mod.

The AI copes very well with long build lists, it certainly doesnt slow it down in my game but my build list is close to the default size but with turrets and listening post additions.

Its all down to those bigger listening posts you guys talked about. It makes all the difference.

Also on the subject of the AI not attacking with a large force, thats down to the difficulty levels. The AI isnt allowed to build the same number of units as the player. On insane its set to build up 0.9 of the players strenght (1 being the players strength). I didnt change that but i think i might set hard to 1, harder to 1.1 and insane to 1.2 and test it.

See the AI files in the strategies folder listed under difficulty eg easy, standard etc etc.

Giskard

#18 Corsix

Corsix

    Code Monkey

  • Hosted
  • 290 posts
  • Location:Berkeley, UK
  • Projects:DoW AI, DoW Mod Studio
  •  Blue Text :)

Posted 07 February 2005 - 06:02 PM

If anybody wants to know:
Posted Image

Also, its my birthday today so my sister baked me a cake:
Posted Image

And thudo, email for the files: cor__remove_this__six@gmail.com
Posted Image

#19 thudo

thudo

    Wacko AI Guy!

  • Division Leaders
  • 12,164 posts
  • Location:Lemonville North, Canada
  • Projects:DoW AI Scripting Project
  • Division:DoW
  • Job:Division Leader

Posted 07 February 2005 - 07:02 PM

My gawd man LOOK AT THAT BIG "ME and ARROW" on the Atlantic slamming into the SW English shoreline! OH THE HUMANITY! :grin: :p ;)

OH And... H A P P Y B I R T H D A Y Buuuuddy! ! Congrads on making it through another milestone. If you were around the bend, I'd buy ya some fine English ale!

Hmm.. it seems most War40k people live in Europe/overseas. I guess us N. Americans love our dumbnuts brain-dead mindless entertainment (aka.. American SuperBowl -> inferior version of the same Canadian game! :p ). Good to see we know where all the global coders are located. European beer so rocks.. Canadian beer rocks too but nothing is likely going to Belgium/Germany for up to !! 600 !! varieties of beer. <sighhhhhhh>. In the States, they have, ahheeemm, "moose piss"! HAHAHAHAHAH!

Anyway, I'll be giving ya the code real soon now.

The problem I want to resolve is to get the AI to reliably build uber units.. Here are the scripts I made for each of the three sides (SM doesn't have to worry as LandRaiders/Terminators allways get built).

chaosbuildbasestrategy.ai
function ChaosBuildBaseStrategy:__init( baseinfo ) super( baseinfo )

	self.blood_research_name = "chaos_bloodthirster_research"
	self.blood_research_id = cpu_manager.stats:GetResearchID( self.blood_research_name )


function ChaosBuildBaseStrategy:DoUpgradesAndAddons()


                --Bloodthirster cost req= 850 / power= 1010
  if resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 900 and
  resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Power ) > 1060 and

         	 not cpu_manager.cpu_player:IsResearchComplete( self.blood_research_name ) then
 	 --self.rating < self.info.uber_advantage then
 	 
 	 local build_type = CpuBuildType()
 	 build_type.btype = CpuPrerequisites.BT_Research
 	 build_type.name = self.blood_research_name
 	 self:TryBuild( build_type )

eldarbuildbasestrategy.ai
function EldarBuildBaseStrategy:__init( baseinfo ) super( baseinfo )

	self.avatar_name = "eldar_squad_avatar"
	self.avatar_id = cpu_manager.stats:GetSquadID( self.avatar_name )

function EldarBuildBaseStrategy:DoBuildUnits()

	BuildBaseStrategy.DoBuildUnits( self )
	
        --Avatar cost req= 865 / power= 1030
          if resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 900 and
   resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Power ) > 1070 and

  build_manager:CanBuildSquad( self.avatar_id ) then
 	 
  --aitrace("trying to build avatar")
  
  local build_type = CpuBuildType()
  build_type.btype = CpuPrerequisites.BT_Squad
  build_type.name = self.avatar_name
  self:TryBuild( build_type )

orkbuildbasestrategy.ai
function OrkBuildBaseStrategy:__init( baseinfo ) super( baseinfo )

	self.squiggoth_name = "ork_squad_squiggoth"
	self.squiggoth_id = cpu_manager.stats:GetSquadID( self.squiggoth_name )

function OrkBuildBaseStrategy:DoUpgradesAndAddons()

	if self:IsInSecondTier() then

                --Squiggoth cost req= 960 / power= 1145 
  if resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 1000 and
  resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Power ) > 1175 and

 	 build_manager:CanBuildSquad( self.squiggoth_id ) then
 	 --self.rating < self.info.uber_advantage then
 	 
 	 local build_type = CpuBuildType()
 	 build_type.btype = CpuPrerequisites.BT_Squad
 	 build_type.name = self.squiggoth_name
 	 self:TryBuild( build_type )

Note the code changes above compared to the original. Now I have uber units created based on req/power + preq. requirements rather than the self.info.uber_advantage (can't find the location where self.info.uber_advantage is managed).

It generally works but no idea why it doesn't for Eldar. Chaos/Ork seem fine. If I can force the AI to allot money to build an uber-unit from time-to-time that would be superb. Fortunately, the Eldar AI is so brutal just creating units regardless I can see why he has no time for an Avatar. Still.. would like to see this done OR create a second aspect building (to create infantry/Avatar from).

Further, I put a, for example, "eldar_squad_avatar = 1," in the buildbasestrategyinfo.ai under the teams being created. Did this for all 3 civs.. Eldar still not creating Avatar. More tweaking needed I guess.

Edited by thudo, 07 February 2005 - 07:07 PM.

Advanced Skirmish AI Team Lead for the coolest Warhammer40k PC RTS out there:

Dawn of War Advanced AI Headquarters

Latest DoW Advanced AI Download!

#20 Corsix

Corsix

    Code Monkey

  • Hosted
  • 290 posts
  • Location:Berkeley, UK
  • Projects:DoW AI, DoW Mod Studio
  •  Blue Text :)

Posted 07 February 2005 - 07:47 PM

Untested; should work: (build 2 aspect portals)
EldarBuildBaseStrategy.ai:
function EldarBuildBaseStrategy:__init( baseinfo ) super( baseinfo )

	self.generator_name = "eldar_warp_generator"
	self.bigger_generator_id = cpu_manager.stats:GetBuildingID( "eldar_advanced_warp_generator" )

	self.soul_shrine_name = "eldar_soul_shrine"
	self.soul_shrine_id = cpu_manager.stats:GetBuildingID( self.soul_shrine_name )
  self.aspect_name = "eldar_aspect_portal" -- added code here
  self.aspect_id = cpu_manager.stats:GetBuildingID( self.aspect_name ) -- and here
	
	self.post_addon_id = cpu_manager.stats:GetAddOnID( "eldar_list_post_addon_1" )
        self.post_addon_2_id = cpu_manager.stats:GetAddOnID( "eldar_list_post_addon_2" )

        self.turret_id = cpu_manager.stats:GetBuildingID( "eldar_support_platform_scatterlaser" )
        self.turret_name = "eldar_support_platform_scatterlaser"
        self.turret_addon_2_id = cpu_manager.stats:GetAddOnID( "eldar_support_platform_addon" )
	
	self.avatar_name = "eldar_squad_avatar"
	self.avatar_id = cpu_manager.stats:GetSquadID( self.avatar_name )

  --Corsix Added
  self.post_id = cpu_manager.stats:GetBuildingID( "eldar_listening_post" )
  self.percent_turr_upgraded = math.random(55,75)
  self.percent_post_upgraded = math.random(55,75)
  self.upgraded_posts = {}
  self.upgraded_turrets = {}
  --End
	
end

-- THESE ARE TWO SEPERATE FUNCTIONS - THERE IS CODE BETWEEN THEME

function EldarBuildBaseStrategy:DoSecondaryBuildings()

        local num_turrets = 0
        local num_aspect = 0 -- added this bit here

	for build_channel in build_manager:GetBuildChannelAIs() do

  if build_channel:GetBlueprintID() == self.turret_id then
     num_turrets = num_turrets + 1
  end
  
  --added these 3 lines of code
  if build_channel:GetBlueprintID() == self.aspect_id then
     num_aspect = num_aspect + 1
  end

	end

	--and i added this little section - change the 2 to a 3 to make it build 3 aspect
	--build a second aspect portal (cost: 100 req)
	if num_aspect < 2 and 
  resource_manager:GetResourceAmount():Get( ResourceAmount.RT_Requisition ) > 150 then
  local build_type = CpuBuildType()
  build_type.btype = CpuPrerequisites.BT_Building
  build_type.name = self.aspect_name
  self:TryBuild( build_type )
	end
	
	
        if 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

Edited by Corsix, 07 February 2005 - 07:47 PM.

Posted Image



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users