The 3rd Age

BFME+

BFME+

A mod that intends to bring back the fun to BFME1

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

How To Make The AI Build Pre-Upgraded Units

Avatar of Ganon

Ganon

Category: Code
Level: Beginner
Created: Thursday June 2, 2016 - 1:58
Updated: Thursday June 2, 2016 - 4:17
Views: 7453
Summary: A quick and simple way to increase the difficulty of the AI.

Rating

Staff says

-

Members say

-

Average

-

0 votes

Page 1 2 3
First, you'll need to open your "upgrade.ini" file, and add a simple generic upgrade like this:

              
Code
Upgrade Upgrade_GenericUpgrade1
    Type = OBJECT
End


Now for this tutorial, I'll make the Gondor soldiers have their upgrades. I shouldn't need to edit the individual unit's file. And in other cases I wouldn't. But for some silly reason, EA decided to code the Forged Blades WeaponSetUpgrade differently for the Gondor soldiers, than any other unit in the game.

First, open up the code for the "GondorFighter". This is the code for the individual soldier. Then search for this bit:

              
Code
Behavior = WeaponSetUpgrade WeaponSetUpgradeModuleTag
        TriggeredBy = Upgrade_GondorForgedBlades Upgrade_TechnologyGondorForgedBlades
        RequiresAllTriggers = Yes
End


Now remove the "Upgrade_TechnologyGondorForgedBlades". Then remove the line that starts with "RequiresAllTriggers".
It should look like this:

              
Code
    Behavior = WeaponSetUpgrade WeaponSetUpgradeModuleTag
        TriggeredBy = Upgrade_GondorForgedBlades
    End


Now they're ready for the upgrade code. You won't have to do that part with any other unit, like I said they were coded uniquely different than any other unit.

In this next part, you need to open the Gondor soldier's horde code. The object name is "GondorFighterHorde". Then for simplicity's sake, scroll down until you find code like this:

              
Code
    Behavior = StatusBitsUpgrade ModuleTag_ProductionLegality2
        TriggeredBy = Upgrade_GondorHeavyArmor Upgrade_TechnologyGondorHeavyArmor
        RequiresAllTriggers = Yes
    End


You don't need to change anything there, in fact you shouldn't. But directly below that, copy and paste in this code:

              
Code
    ;;; HARD AI JUST CHEATS FOR THEIR UPGRADES ;;;
    Behavior = ObjectCreationUpgrade ModuleTag_HardAICheat1
        TriggeredBy        = Upgrade_HardAIMultiPlayer
        Delay            = 8.0
        GrantUpgrade    = Upgrade_GenericUpgrade1
    End
    
    Behavior = LevelUpUpgrade ModuleTag_HardAIJumpstart
        TriggeredBy = Upgrade_GenericUpgrade1
        LevelsToGain = 4
        LevelCap = 5
    End
    Behavior = ObjectCreationUpgrade ModuleTag_HardAICheat2
        TriggeredBy        = Upgrade_GenericUpgrade1
        Delay            = 2.0
        GrantUpgrade    = Upgrade_GondorHeavyArmor
    End
    Behavior = ObjectCreationUpgrade ModuleTag_HardAICheat3
        TriggeredBy        = Upgrade_GenericUpgrade1
        Delay            = 4.0
        GrantUpgrade    = Upgrade_GondorForgedBlades
    End
    
    ;;; END OF HARD AI CHEATS ;;;


And with that, you're effectively done. With this specific code, the Gondor soldiers will come to life at Rank 5 with Forged Blades and Heavy Armor. Obviously if you wanted them to be rank 10 instead, then you would just change "LevelsToGain" to 9, and "LevelCap" to 10.

Also, if you're editing some other unit, like "Yeoman Archers", I shouldn't have to tell you that you'll need to change the faction specific upgrades that are being granted in this code. You would want "Upgrade_RohanFireArrows", and "Upgrade_RohanHeavyArmor" for them, instead.

I guess I should explain the purpose for the "Delay" lines. The first one is an 8 second delay. It's good to have that so that each soldier has a chance to get out of the Barracks before they rank up. Otherwise you would have a Banner Carrier appear outside the building before the first guy even gets out. It looks silly, and may cause bugs. Keep in mind, larger hordes may need a longer delay.

Now the next two delays are purely for cosmetics. Without those two, the unit would get all of its upgrades at once. Instead, we get Heavy Armor 2 seconds after ranking up. Then we get our Forged Blades 2 seconds after that. It's just nicer to look at.


On the next page I'll show how to make these soldiers come out of the Barracks fully upgraded for everyone, and not just the Hard AI.

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

 
5:00:59