The 3rd Age

Battle of the Pelennor Fields

Battle of the Pelennor Fields

Six new factions. Controle any of the races of man that participated in the War of the Ring.

Button for The 3rd AgeButton for The Dwarf HoldsButton for The Elven AllianceButton for Helm's Deep Last HopeButton for GothmogtheOrcButton for BFME+Button for The Four AgesButton for HDR HeadquartersButton for Middle Earth CenterButton for Project Perfect Mod

Become an affiliate!

   

Quick Lists

Top Rated Popular New Updated Last Comments Users

Register and log in to move these advertisements down

Custom Structures & AI for BFME1

Avatar of Hebblewhite

Hebblewhite

Category: Worldbuilder
Level: Expert
Created: Wednesday July 18, 2007 - 15:36
Updated: Friday July 20, 2007 - 6:01
Views: 6940
Summary: Getting the BFME1 AI system to construct and utilise your custom structures effectively at run time

Rating

Staff says

4.3

Members say

4.5

Average

4.4/5.0

10 votes

Page 1 2 3 4 5 6
              
Code

*** IF ***
Counter 'g_PREDBUILD_MONEY_NEEDED' IS Less Than counter 'g_Economy_Current_Money'
*AND* Counter 'g_PREDBUILD_MAX_INFANTRY' IS Greater Than counter 'g_PredBuild_My_Soldier_Building_Count'
*AND* Counter 'l_PredBuild_Infantry_Building_Priority' IS Not Equal To 0
*AND* Counter 'l_PredBuild_Infantry_Building_Priority' IS Greater Than or Equal To counter 'l_PredBuild_Archer_Building_Priority'
*AND* Counter 'l_PredBuild_Infantry_Building_Priority' IS Greater Than or Equal To counter 'l_PredBuild_Artillery_Building_Priority'
*AND* Counter 'l_PredBuild_Infantry_Building_Priority' IS Greater Than or Equal To counter 'l_PredBuild_Cavalry_Building_Priority'
*AND* Counter 'l_PredBuild_Infantry_Building_Priority' IS Greater Than or Equal To counter 'l_PredBuild_Economy_Building_Priority'
*AND* Counter 'l_PredBuild_Infantry_Building_Priority' IS Greater Than or Equal To counter 'l_PredBuild_Upgrade_Only_Building_Priority'

*** THEN ***
Run Subroutine 'g_PredBuild - Build Barracks Building'.
Run Subroutine 'g_PredBuild - Clear Pred Build Priorities'.



You can then add the reference to your new subroutine in the “[S A nd] [E N H]g_PredBuild - Run Build Scripts” with the following code in the action section of the script:

              
Code

Run Subroutine 'g_PredBuild - Barracks Building Is Highest Priority'.



Note that we are classing our Barracks as a type of infantry factory… this is by design as we don’t want to have to set up a whole new set of scripts, we can piggy-back on the infantry detection system.

Move on to the “[ns A]g_Predictive Monitoring” script folder, and take a look at the “[S A nd] [E N H]g_PredBuild - Monitor Buildings” script file. Note that the AI system is constantly keeping track of the number of factories and units of both itself and opponents during run time… this is the infantry detection system we are using since our Barracks is a type of “Infantry Factory”.

On a side note: The “Infantry Factory” object is available from “Object Lists” section of the system hierarchy. To use the infantry method correctly I have made sure that my “RohanBarracks” is declared as a factory, and any hordes that it can build are declared as infantry (NOT archers – they are different!) in “lib_object_lists.map”.

Finally, we need to write a script that will force the build priority of our Barracks in relation to other unit types during run time. Copy the “[S A nd] [E N H]g_PredBuild - Set Infantry Building Priority” script file and change the name to “[S A nd] [E N H]g_PredBuild - Set Barracks Building Priority”. Then modify the condition/action statements in accordance with the following:

Links / Downloads

 HitsAdded
Custom Structures & AI for BFME11934July 18, 2007 - 15:40

Comments

Display order: Newest first

Hebblewhite - Wednesday July 18, 2007 - 15:58

I've attached a pdf version for easier reading!


Cheers,

Hebblewhite

Go to top

 

"One site to rule them all, one site to find them,
one site to host them all, and on the network bind them."

 
0:09:36