The 3rd Age

RC Mod

RC Mod

This Mod makes many changes to the original game, adds a whole new BFME 1 mode and much more.

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

Combo Hordes

Tutorial for Battle for Middle-earth II BFME 2, Battle for Middle-earth II: Rise of the Witch-king ROTWK

No Avatar

MrFurious

Category: Code
Level: Intermediate
Created: Monday April 20, 2009 - 7:49
Updated: Saturday May 30, 2009 - 4:10
Views: 5695
Summary: How to add Combo Hordes into BFME2, and how make them recruitable at the barracks

Rating

Staff says

4.0

Members say

5.0

Average

4.4/5.0

5 votes

Page 1 2 3 4
Combo Hordes - BFME1 style.
On this page I'll explain how to make a standard combo horde. This is very easy, and very similar to how it works in BFME1.

Creating a now Horde.
First we have to create the horde itself. For this we have to open menhordes.ini. Our horde will consist of Gondor Soldiers and Gondor Archers. The Archers will be the one killing stuff, while the Soldiers stand in front of them to protect the Archers. So the attack AI should be that of an Archer Horde. We'll start with just copying the GondorArcherHorde. Paste it, and change it's name to GondorFighterArcherComboHorde. Now we'll work trough it from the top to the bottom. First we'll look at the weaponset:
              
Code
WeaponSet
    Conditions = None
    Weapon = PRIMARY GoodArcherMissileHordeRangefinder
    Weapon = TERTIARY GoodArcherMissileHordeRangefinderBombard
    AutoChooseSources = TERTIARY FROM_PLAYER FROM_SCRIPT    
End


Our new horde won't have the ability to Bombard an area. So we'll just remove the Tertiary weapon and it's autochoosesources.

Next is the KindOf:
              
Code
KindOf = SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT INFANTRY HORDE ARCHER ARMY_SUMMARY LARGE_RECTANGLE_PATHFIND


I don't know what it does, but there is a COMBO_HORDE KindOf, and it should be of some use, so we'll just add it. It'll be a combo horde after all.

Now we'll go to the Commandset. For this we'll have to create a new commandset for our horde. Go to CommandSet.ini, search the GondorArcherHordeCommandSet and copy/paste it. Change it's name to GondorFighterArcherComboHordeCommandSet, and replace the Bombard commandbutton with: Command_PurchaseUpgradeGondorForgedBlades This will allow us to buy the Forged Blades upgrade for our fellow soldiers.
              
Code
CommandSet GondorFighterArcherComboHordeCommandSet
    1     = Command_ToggleStance    
    2    = Command_ArcherBombard
    3     = Command_PurchaseUpgradeGondorForgedBlades
    4     = Command_PurchaseUpgradeGondorHeavyArmor
    5     = Command_PurchaseUpgradeGondorBasicTraining
    12     = Command_CaptureBuilding
    13     = Command_AttackMove
    14     = Command_Stop
    16     = Command_SetStanceBattle
    17     = Command_SetStanceAggressive
    18     = Command_SetStanceHoldGround
End


Go back to menhordes.ini, and change the commandset to the one we just made.
              
Code
CommandSet = GondorFighterArcherComboHordeCommandSet


Now up to the most important part of the combo horde: the HordeContain module. Currently, it looks like this:
              
Code
Behavior = HordeContain ModuleTag_HordeContain
    FrontAngle = 270
    FlankedDelay = 2000
    ObjectStatusOfContained =
    InitialPayload = GondorArcher GOOD_MEN_GIANT_HORDE_SIZE
    Slots = 15
    PassengerFilter    = NONE +INFANTRY
    ShowPips = No
    ThisFormationIsTheMainFormation = Yes
    RandomOffset=X:0 Y:0
    MeleeBehavior = Amoeba
    End

    // Banner Carrier info        
    BannerCarriersAllowed    = GondorInfantryBanner    
    BannerCarrierPosition    = UnitType:GondorArcher    Pos:X:70.0 Y:0.0
        
    RankInfo = RankNumber:1 UnitType:GondorArcher Position:X:50 Y:0            Position:X:50 Y:20        Position:X:50 Y:-20        Position:X:50 Y:40        Position:X:50 Y:-40
    RankInfo = RankNumber:2 UnitType:GondorArcher Position:X:30 Y:0 Leader 1 0    Position:X:30 Y:20 Leader 1 1    Position:X:30 Y:-20 Leader 1 2    Position:X:30 Y:40 Leader 1 3    Position:X:30 Y:-40 Leader 1 4
    RankInfo = RankNumber:3 UnitType:GondorArcher Position:X:10 Y:0 Leader 2 0    Position:X:10 Y:20 Leader 2 1    Position:X:10 Y:-20 Leader 2 2    Position:X:10 Y:40 Leader 2 3    Position:X:10 Y:-40 Leader 2 4
        
    RanksToReleaseWhenAttacking = 1 2 3


    MeleeAttackLeashDistance = 1            
    BackUpMinDelayTime         = 1    
    BackUpMaxDelayTime         = 3000    
    BackUpMinDistance         = 1    
    BackUpMaxDistance         = 3    
    BackupPercentage         = 80%    
End


Let's look here first:
              
Code
InitialPayload = GondorArcher GOOD_MEN_GIANT_HORDE_SIZE
Slots = 15


It says that the horde originally contains 15 (GOOD_MEN_GAINT_HORDE_SIZE is 15) GondorArchers, and that the horde has 15 slots. We want our horde to contain both an Archer horde and an Soldier horde. We'll need to add an extra InitialPayload, and to alter the amount of slots:
              
Code
InitialPayload = GondorArcher GOOD_MEN_GIANT_HORDE_SIZE
InitialPayload = GondorFighter GOOD_MEN_GIANT_HORDE_SIZE
Slots = 30


Now we'll look at the ranks:
              
Code
RankInfo = RankNumber:1 UnitType:GondorArcher Position:X:50 Y:0            Position:X:50 Y:20        Position:X:50 Y:-20        Position:X:50 Y:40        Position:X:50 Y:-40
RankInfo = RankNumber:2 UnitType:GondorArcher Position:X:30 Y:0 Leader 1 0    Position:X:30 Y:20 Leader 1 1    Position:X:30 Y:-20 Leader 1 2    Position:X:30 Y:40 Leader 1 3    Position:X:30 Y:-40 Leader 1 4
RankInfo = RankNumber:3 UnitType:GondorArcher Position:X:10 Y:0 Leader 2 0    Position:X:10 Y:20 Leader 2 1    Position:X:10 Y:-20 Leader 2 2    Position:X:10 Y:40 Leader 2 3    Position:X:10 Y:-40 Leader 2 4        


There are 3 ranks, which all contain 5 archers. We want 6 ranks, the first 3 with soldiers, and the last 3 with archers. We'll change it into this:
              
Code
RankInfo = RankNumber:1 UnitType:GondorFighter Position:X:50 Y:0            Position:X:50 Y:20                Position:X:50 Y:-20                Position:X:50 Y:40                Position:X:50 Y:-40
RankInfo = RankNumber:2 UnitType:GondorFighter Position:X:30 Y:0 Leader 1 0    Position:X:30 Y:20 Leader 1 1    Position:X:30 Y:-20 Leader 1 2    Position:X:30 Y:40 Leader 1 3    Position:X:30 Y:-40 Leader 1 4
RankInfo = RankNumber:3 UnitType:GondorFighter Position:X:10 Y:0 Leader 2 0    Position:X:10 Y:20 Leader 2 1    Position:X:10 Y:-20 Leader 2 2    Position:X:10 Y:40 Leader 2 3    Position:X:10 Y:-40 Leader 2 4
RankInfo = RankNumber:4 UnitType:GondorArcher Position:X:-10 Y:0 Leader 3 0    Position:X:-10 Y:20 Leader 3 1    Position:X:-10 Y:-20 Leader 3 2    Position:X:-10 Y:40 Leader 3 3    Position:X:-10 Y:-40 Leader 3 4
RankInfo = RankNumber:5 UnitType:GondorArcher Position:X:-30 Y:0 Leader 4 0    Position:X:-30 Y:20 Leader 4 1    Position:X:-30 Y:-20 Leader 4 2    Position:X:-30 Y:40 Leader 4 3    Position:X:-30 Y:-40 Leader 4 4
RankInfo = RankNumber:6 UnitType:GondorArcher Position:X:-50 Y:0 Leader 5 0    Position:X:-50 Y:20 Leader 5 1    Position:X:-50 Y:-20 Leader 5 2    Position:X:-50 Y:40 Leader 5 3    Position:X:-50 Y:-40 Leader 5 4


We still need to add 2 very important lines, and change 1 line. Just under the ranks you'll see this line:
              
Code
RanksToReleaseWhenAttacking = 1 2 3


We also want our archers to attack. Just adding rank 4 to 6 to this line doesn't work, but we'll do it anyway. Additionally, we'll add 2 lines:
              
Code
RanksToReleaseWhenAttacking = 1 2 3 4 5 6
RanksToJustFreeWhenAttacking = 1 2 3 4 5 6
RanksThatStopAdvance = 3


RanksToJustFreeWhenAttacking enables our combo horde to attack, without this they just wont attack. The third line tells the archers behind rank 3 to not position themselves in the first 3 ranks. If they did, they would prevent Soldiers from respawning at that position, and after a while the whole horde would contain just archers.

If you scroll down a bit, you'll see 2 StatusBitsUpgrades. Remember we added the Forged Blades upgrade to their commandset? Now we'll add another statusbitsupgrade to enable the use of Forged Blades. Add this code after the seconds statusbitsupgrade:
              
Code
Behavior = StatusBitsUpgrade ModuleTag_ProductionLegality3
    TriggeredBy = Upgrade_GondorForgedBlades
End


Our combo horde is ready, but right now we have no way to create the horde. For this we need to add a few lines to GondorFighterHorde and GondorArcherHorde. First go to the HordeContain Behavior in GondorFighterHorde, and add this line after the rankinfo:
              
Code
ComboHorde = Target:GondorArcherHorde                Result:GondorFighterArcherComboHorde


This will tell our fighter horde that it can combo with an archer horde, and that this results in a Combo Horde being created.

The Fighter horde can change it's formation, and when it does, it changes into another (child)object. If we just add 1 line, the archer horde won't be able to combine with this childobject. Therefor we need to use 2 lines:
              
Code
ComboHorde = Target:GondorFighterHorde                Result:GondorFighterArcherComboHorde
ComboHorde = Target:GondorFighterHordeBlock                Result:GondorFighterArcherComboHorde


Finally we should go to the experiencelevels.ini. At the top, you'll see a line that starts with "#define GOOD_TROOPS". For our combo horde to level, we need to add "GondorFighterArcherComboHorde" after this. This allows our combo horde to level just like any other horde.
              
Code
#define GOOD_TROOPS GondorFighterArcherComboHorde RohanSpearmen RohanSpearmenHorde ...


So now we have a combo horde, and we can create it by making separate Fighter and Archer hordes and combine them. However, building the combo horde at the barracks won't work. For this we need additional code. I'll explain why this doesn't work, and how we can work around this on the next page.

Links / Downloads

 HitsAdded
Combo Hordes for BFME11332April 20, 2009 - 8:15

Comments

Display order: Newest first

Sulherokhh (Team Chamber Member) - Monday May 4, 2009 - 15:28

That's normal when combining. Think of it as guards for the archers. What is actually causing this is that a single horde (even a combo horde) can only have a single rangefinder active. The rangefinder triggers the weapon. In this case the rangefinder has approximately the same range as that of the archers themselves and therefor they fire. Any targets are acquired by the fighters, but their melee weapons simply don't have enough range for an actual attack to occur. And the horde will not seperate for it to happen. If you shorten the range of the rangefinder, even the archers will close to melee range.

drogoth232 - Monday May 4, 2009 - 14:18

Really good Tut. But I have a problem. Only my archers atttack and my fighters just stay there until a unit gets close enough for them to attack.

MrFurious - Wednesday April 29, 2009 - 1:48

I've deleted the whole code page, as it was full of errors, because it was the code I used for testing, not for creating this tutorial. Maybe I'll have another look at the whole tutorial, and make some additions, or recreate the code page with the right code.

Sulherokhh (Team Chamber Member) - Wednesday April 29, 2009 - 1:23

Your tut could use some reformatting, especially in the code sections, to make it more readable. There is one more 'end' than needed in the 'commandset.ini'-section on page 4.
You might also go into some detail regarding the advantages and disatvantages of using Eggs (CommandPoints, AI-recruitment, etc.)

Otherwise it's good.

MrFurious - Friday April 24, 2009 - 9:58

I found a new, easier way to recruit the horde, so I've updated the guide accordingly.

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."

 
14:00:32