The 3rd Age

Last Alliance Battle Mod

Last Alliance Battle Mod

The final battle between the Alliance of Men and Elves and Mordor.

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: 5680
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
Recruitable Combo Hordes.
Before I go into what we need to change, let's first have a look at what we did on the last page. The HordeContain module currently looks like this:
              
Code
Behavior = HordeContain ModuleTag_HordeContain
    FrontAngle = 270
    FlankedDelay = 2000
    ObjectStatusOfContained =
    InitialPayload = GondorArcher GOOD_MEN_GIANT_HORDE_SIZE
    InitialPayload = GondorFighter GOOD_MEN_GIANT_HORDE_SIZE
    Slots = 30
    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: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

    RanksToReleaseWhenAttacking = 1 2 3 4 5 6
    RanksToJustFreeWhenAttacking = 1 2 3 4 5 6
    RanksThatStopAdvance = 3

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


These lines cause the big problem:
              
Code
InitialPayload = GondorFighter GOOD_MEN_GIANT_HORDE_SIZE
InitialPayload = GondorArcher GOOD_MEN_GIANT_HORDE_SIZE
Slots = 30

The first 2 lines tell that when this horde is created, it contains 15 GondorFighters, and 15 GondorArchers. But the barracks can only create one type of unit per horde. The 3rd line tells that the horde can contain a maximum of 30 units, exclusive banner carrier. However, when the horde is created, they always create the maximum number of units possible. If we say that they should create 15 fighters, and that the horde can contain 30 units, they'll just create 30 fighters. We don't want that. However, when we create the horde in any other way, everything will work fine. To do this, we'll use the ObjectCreationList. We'll recruit another object, that immediately dies, but when it dies, it spawns our horde.

First we'll create this object. It's a very basic object, and we'll create it in goodfactionsubobjects.ini. If you scroll down, you'll find more of these "eggs". Our object code looks like this:
              
Code
Object GondorFighterArcherComboHordeEgg
    
    Draw = W3DScriptedModelDraw ModuleTag_Draw        
        DefaultModelConditionState
            Model = None
        End
    End

    BuildCost = 300
    BuildTime = 20
    
    KindOf = INERT IMMOBILE UNATTACKABLE

    CommandPoints = 60
    
    Body = ActiveBody ModuleTag_MakesKillWork
        MaxHealth = 1
    End
    
    Behavior = LifetimeUpdate ModuleTag_HatchTrigger
        MinLifetime = 0.0
        MaxLifetime = 0.0
    End
    
    Behavior = SlowDeathBehavior ModuleTag_HatchProcess
        DestructionDelay = 4000    
        OCL        = FINAL OCL_SpawnGondorFighterArcherHorde        
    End
End


Basically it has no model, it can't move or be attacked, and it dies immediately. When it dies, it is destroyed after 4 seconds, and triggers the "OCL_SpawnGondorFighterArcherComboHorde". Note that you have to define the build cost and time here, as this is the object we'll recruit from the barracks. Also add the commandpoints here, or the horde won't stop building when you've reached your commandpointlimit.

Now we need to define this OCL, therefore we'll go to objectcreationlist.ini (just after the object folder). We'll create the following objectcreationlist:
              
Code
ObjectCreationList OCL_SpawnGondorFighterArcherHorde
    CreateObject
        ObjectNames = GondorFighterArcherComboHorde
        Count = 1
        FadeIn = Yes
        FadeTime = 2000
        Offset = X:100.0 Y:100.0 Z:0.0
    End
End


This ObjectCreationList spawns our horde, that fades in in 2 seconds. It has an offset to create it outside our barracks.

Now we just have to create a commandbutton and alter the commandset for our barracks:

commandbutton.ini:
              
Code
CommandButton Command_ConstructGondorFighterArcherComboHorde
    Command                = UNIT_BUILD
    Object                = GondorFighterArcherHordeEgg
    Options                = CANCELABLE
    TextLabel            = CONTROLBAR:ConstructGondorFighterHorde
    ButtonImage            = BGBarracks_Soldiers
    ButtonBorderType = BUILD
    DescriptLabel = CONTROLBAR:ToolTipBuildGondorFighterHorde
    Radial                = Yes
    InPalantir            = Yes
    ShowProductionCount    = Yes
End


commandset.ini:
              
Code
CommandSet GondorBarracksCommandSet
    1    = Command_ConstructGondorFighterHorde
    2    = Command_ConstructGondorTowerShieldGuardHorde
    3    = Command_ConstructGondorFighterArcherComboHorde
    4    = Command_PurchaseTechnologyGondorBasicTraining
    5    = Command_PurchaseUpgradeGondorBarracksLevel2
    6    = Command_Sell
End

CommandSet GondorBarracksCommandSetLevel2
    1    = Command_ConstructGondorFighterHorde
    2    = Command_ConstructGondorTowerShieldGuardHorde
    3    = Command_ConstructGondorFighterArcherComboHorde
    4    = Command_PurchaseTechnologyGondorBasicTraining
    5    = Command_PurchaseUpgradeGondorBarracksLevel3
    6    = Command_Sell
End

CommandSet GondorBarracksCommandSetLevel3
    1    = Command_ConstructGondorFighterHorde
    2    = Command_ConstructGondorTowerShieldGuardHorde
    3    = Command_ConstructGondorFighterArcherComboHorde
    4    = Command_PurchaseTechnologyGondorBasicTraining
    6    = Command_Sell
End


Now our barracks can produce combo hordes!
But the AI doesn't use them. On the next page, we will solve this final problem.

Links / Downloads

 HitsAdded
Combo Hordes for BFME11326April 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."

 
16:09:03