The 3rd Age

Formationmod

Formationmod

In this modification hord size and formation has been changed

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

Toggle Formations

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

Avatar of Kwen

Kwen

Category: Code
Level: Intermediate
Created: Wednesday August 26, 2009 - 18:41
Updated: Wednesday August 26, 2009 - 18:47
Views: 6436
Summary: Explains how to add toggling formations to your hordes.

Rating

Staff says

3.0

Members say

4.0

Average

3.6/5.0

5 votes

Formations are very common throughout bfme. They allow for differing positions of your units to give them a tactical advantage in certain situations.
Of course you know how these work if you play the game at all. But coding them in can be a trick.

In this tutorial I will explain how to add the porcupine formation to MordorPikeman (A new unit I added. Basically just a re-named Uruk Pikeman.) This is assuming you know the basics and be fully able to code in a functional Unit and Horde.

To do so you will have to edit the following files:

CommandSet.ini
MordorPikemanHorde.ini

The first thing you'll have to do is make absolutely sure your horde works to its fullest prior to doing this.

Then open evilfactionhordes.ini, Find IsengardPikemanHorde.

At the bottom of the horde you'll find this:

              
Code

ChildObject IsengardPikemanHordePorcupine IsengardPikemanHorde
    ; Note - for alternate formations, all info outside of the Contain Behavior module is ignored.
    ; Any modifications need to be done via the Attribute Modifiers in the contain module.
    Behavior = HordeContain ModuleTag_HordeContain
        ObjectStatusOfContained =
        InitialPayload = IsengardPikeman 10
        Slots = 10
        PassengerFilter = NONE +INFANTRY
        ShowPips = No

        ThisFormationIsTheMainFormation = No    ;Used to determine which armorset to use (and anything else we want!)
        
        ; Banner Carrier info        
        ;BannerCarriersAllowed    = IsengardBannerOrc                                        ; types of units that are allowed as banner carriers
        ;BannerCarrierPosition    = UnitType:IsengardPikeman        Pos:X:15.0 Y:0.0        ; (DEFAULT) position of banner carrier for fighter horde
        
    BannerCarriersAllowed    = IsengardBannerOrc            ; types of units that are allowed as banner carriers
    BannerCarrierPosition    = UnitType:IsengardBannerOrc    Pos:X:27.0 Y:5.0    ; (DEFAULT) position of banner carrier for fighter horde
            
    RankInfo = RankNumber:1 UnitType:IsengardPikeman Position:X:22 Y:-32    Position:X:22 Y:-10    Position:X:22 Y:10    Position:X:22 Y:32    
    RankInfo = RankNumber:2 UnitType:IsengardPikeman Position:X:2 Y:-32    Position:X:2 Y:-10    Position:X:2 Y:10    Position:X:2 Y:32    
    RankInfo = RankNumber:3 UnitType:IsengardPikeman             Position:X:-22 Y:-10    Position:X:-22 Y:10        

    ComboHorde = Target:IsengardFighterHorde Result:IsengardFighterPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody
    ComboHorde = Target:IsengardFighterHordeBlock Result:IsengardFighterPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody
    ComboHorde = Target:IsengardUrukCrossbowHorde Result:IsengardCrossbowPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody
    ComboHorde = Target:IsengardUrukCrossbowHordeWedgeFormation Result:IsengardCrossbowPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody

        AlternateFormation = IsengardPikemanHorde
        AttributeModifiers = IsengardPikemanHordePorcupineBonus
        UsePorcupineBody = Yes
        UseSlowHordeMovement = Yes
    End
End



This is a childobject of the original horde, but in a different arrangement, with a different speed, and with different stats. The rest is the same.

Copy this and put it at the bottom of MordorPikemanHorde.

Now, a lot of name changing. Use a find/replace to change all IsengardPikeman to MordorPikeman
(Do not change "AttributeModifiers = IsengardPikemanHordePorcupineBonus" unless you plan to make the bonus different.)

Essentially in the childobject, change all Isengard to Mordor. It should now look like:

              
Code

ChildObject MordorPikemanHordePorcupine MordorPikemanHorde ;(Must be the name of the original Horde.)
    ; Note - for alternate formations, all info outside of the Contain Behavior module is ignored.
    ; Any modifications need to be done via the Attribute Modifiers in the contain module.
    Behavior = HordeContain ModuleTag_HordeContain
        ObjectStatusOfContained =
        InitialPayload = MordorPikeman 10
        Slots = 10
        PassengerFilter = NONE +INFANTRY
        ShowPips = No

        ThisFormationIsTheMainFormation = No    ;Used to determine which armorset to use (and anything else we want!)
        
        ; Banner Carrier info        
        ;BannerCarriersAllowed    = MordorBannerOrc                                        ; types of units that are allowed as banner carriers
        ;BannerCarrierPosition    = UnitType:MordorPikeman        Pos:X:15.0 Y:0.0        ; (DEFAULT) position of banner carrier for fighter horde
        
    BannerCarriersAllowed    = MordorBannerOrc            ; types of units that are allowed as banner carriers
    BannerCarrierPosition    = UnitType:MordorBannerOrc    Pos:X:27.0 Y:5.0    ; (DEFAULT) position of banner carrier for fighter horde
            
    RankInfo = RankNumber:1 UnitType:MordorPikeman Position:X:22 Y:-32    Position:X:22 Y:-10    Position:X:22 Y:10    Position:X:22 Y:32    
    RankInfo = RankNumber:2 UnitType:MordorPikeman Position:X:2 Y:-32    Position:X:2 Y:-10    Position:X:2 Y:10    Position:X:2 Y:32    
    RankInfo = RankNumber:3 UnitType:MordorPikeman             Position:X:-22 Y:-10    Position:X:-22 Y:10        

;(Comment these out. They define combo-hordes.)

;    ComboHorde = Target:IsengardFighterHorde Result:IsengardFighterPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody
;    ComboHorde = Target:IsengardFighterHordeBlock Result:IsengardFighterPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody
;    ComboHorde = Target:IsengardUrukCrossbowHorde Result:IsengardCrossbowPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody
;    ComboHorde = Target:IsengardUrukCrossbowHordeWedgeFormation Result:IsengardCrossbowPikemanComboHorde InitiateVoice:UrukPikemanVoiceJoinAnybody

        AlternateFormation = MordorPikemanHorde
        AttributeModifiers = IsengardPikemanHordePorcupineBonus
        UsePorcupineBody = Yes
        UseSlowHordeMovement = Yes
    End
End


Make sure this line states: "AlternateFormation = MordorPikemanHorde"
Now, in the MordorPikemanHorde make sure the alternate formation states: "AlternateFormation = MordorPikemanHordePorcupine"
This is important so the code will recognize that the two are interchangeable.

Now. The coding in the Horde code is done.

Open up CommandSet.ini

Find CommandSet IsengardPikemanHordeCommandSet
Copy the line     2 = Command_ToggleFormationPikeman

Add it to MordorPikemanHordeCommandSet.

Now, test.

There you go. Your Unit should now be able to toggle formation.

Comments

Display order: Newest first

Alaric - Friday April 13, 2012 - 13:50

Nice article. But I have an idea. What about add other formation for a Hord?

E. G.:
The Gondor Soldiers have Block formation already. I want add new formation for attack (let´s say Rush formation) with different bonus/ desrease. I must create new childobject for Rush formation and changing some stats trought by AttributeMofifier.ini. Then I need new button for toggle this formation.

How I create this one without substitution with button for original Block formation? I thing I need CommandSet.ini and CommandButton.ini in this case...

maby like that:

CommandButton code:
CommandButton Command_ToggleFormationGondorFighterRush ;;add by me
    Command            = HORDE_TOGGLE_FORMATION    ;;Gondor Soldier
    Options            = TOGGLE_IMAGE_ON_FORMATION OK_FOR_MULTI_SELECT
    ButtonImage = UCFormation_Block UCFormation_Line
    ButtonBorderType = ACTION ; Identifier for the User as to what kind of button this is
    TextLabel = CONTROLBAR:ToggleRushFormation    CONTROLBAR:ToggleLineFormation
    DescriptLabel = CONTROLBAR:ToolTipToggleGFighterLineToRushFormation    CONTROLBAR:ToolTipToggleGFighterRushToLineFormation
    InPalantir        = Yes
    DoubleClick        = Yes
    UnitSpecificSound = GondorSoldierVoiceBlockFormationOn GondorSoldierVoiceLineFormation
End

;CommandButton Command_SetFormationGondorFighterRush ;;add by me
;    Command            = HORDE_SET_FORMATION
;    Options            = OK_FOR_MULTI_SELECT
;    Object            = GondorFighterHordeRush
;    ButtonImage = UCFormation_Block
;    ButtonBorderType = ACTION ; Identifier for the User as to what kind of button this is
;    TextLabel = CONTROLBAR:ToggleRushFormation
;    DescriptLabel = CONTROLBAR:ToolTipToggleRushFormation
;    InPalantir        = Yes
;    DoubleClick        = Yes
;    UnitSpecificSound    = GondorSoldierVoiceBlockFormationOn
;End

;CommandButton Command_SetFormationGondorFighterLine ;;add by me
;    Command            = HORDE_SET_FORMATION
;    Options            = OK_FOR_MULTI_SELECT
;    Object            = GondorFighterHorde
;    ButtonImage = UCFormation_Line
;    ButtonBorderType = ACTION ; Identifier for the User as to what kind of button this is
;    TextLabel = CONTROLBAR:ToggleLineFormation
;    DescriptLabel = CONTROLBAR:ToolTipToggleLineFormation
;    InPalantir        = Yes
;    DoubleClick        = Yes
;    UnitSpecificSound    = GondorSoldierVoiceLineFormation
;End

CommandSet.ini code:

CommandSet GondorFighterHordeCommandSet
    1 = Command_Guard
    2 = Command_ToggleFormationGondorFighter
    3 = Command_ToggleFormationGondorFighterRush    ;;add by me
    4 = Command_PurchaseUpgradeGondorForgedBlades
    5 = Command_PurchaseUpgradeGondorHeavyArmor
    6 = Command_PurchaseUpgradeGondorBasicTraining
    13 = Command_AttackMove
    14 = Command_Stop
15 = Command_Guard
End

But this not working. Any Idea what´s wrong?

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

 
13:37:13