The 3rd Age

Battles of Narnia

Battles of Narnia

A mod that will add the Narnian world to the BFME I game

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

2.02e Fuel the Fires

Tutorial for Battle for Middle-earth II BFME 2

No Avatar

Prolong

Category: Code
Level: Intermediate
Created: Sunday May 10, 2009 - 16:32
Updated: Tuesday May 26, 2009 - 17:06
Views: 4857
Summary: Alter Fuel the Fires to require the presence of a Fortress to function and to affect teammates

Rating

Staff says

3.3

Members say

4.0

Average

3.6/5.0

5 votes

Page 1 2
In the official versions of BFME II and RotWK, Fuel the Fires is an anomaly in that it is the only science power (other than Weathers) that functions after the destruction of the Fortress. This guide will show you how to "fix" Fuel the Fires to only affect Lumber Mills while the player has a Fortress on the map, as in the upcoming update to Unofficial Patch 2.02, the version of the game used in the only competitive RotWK league, ClanWars. Note that this version of Fuel the Fires will also affect the Lumber Mills of a player's allies in team games.

To start out with, we need to understand exactly how Fuel the Fires worked in 2.01 (or 1.06). When a player purchases Fuel the Fires, he uses a "purchase" commandbutton with a CommandTrigger line at the bottom. This line tells the game to immediately use Command_SpellBookFueltheFires (a second commandbutton) when you purchase the spell. (Scavenger and Elven Gifts, the game's other passive powers, work in this same way.) Command_SpellBookFueltheFires (remember: it is activated only once, right when Fuel the Fires is first purchased) triggers the following SpecialPower in system.ini:

              
Code
    Behavior = SpecialPowerModule        SpellBookFuelTheFires_ModuleTag
        SpecialPowerTemplate        = SpellBookFueltheFires
        ; Done in science check on the lumber mill, so that this global effect will work on future lumber mills
;        AttributeModifier            = SpellBookFueltheFires
;        AttributeModifierRange        = 999999
;        AttributeModifierAffects    = ANY +SUPPLY_GATHERING_CENTER
        UpdateModuleStartsAttack    = No
        AvailableAtStart            = No
        RequirementsFilterMPSkirmish = SPELL_BOOK_REQUIREMENTS_FILTER
        RequirementsFilterStrategic = SPELL_BOOK_REQUIREMENTS_FILTER_STRATEGIC
    End

Reading the code, you'll notice that at one point, before the lines were commented out, Fuel the Fires granted an AttributeModifier named SpellBookFueltheFires to all allied SUPPLY_GATHERING_CENTERs (Lumber Mills) within 999999 feet (the entire map). This was a bad thing, since Fuel the Fires is cast only once immediately after being purchased, and so this implementation of Fuel the Fires would only affect Lumber Mills already on the map when cast; in other words, it would not have affected any Lumber Mills built after the Fuel the Fires was purchased. (The weather powers Darkness and Freezing Rain suffer from a similar problem.) EA fortunately noticed this and removed the attributemodifier, so now this power does absolutely nothing from here. A note tells us that the previous functionality of the power is now handled in a "science check" on the Lumber Mill, "so that this global effect will work on future lumber mills."

A science check means that the Lumber Mill is constantly searching for the player to possess SCIENCE_FueltheFires. Once the player has SCIENCE_FueltheFires, the Lumber Mill knows - on its own - that it's supposed to give itself a production bonus; the power itself does nothing. This is bad, since you have SCIENCE_FueltheFires at all times after purchasing the science; you don't lose it when the Fortress dies, and for this reason the Fuel the Fires production bonus will continue to function even without a Fortress. Therefore, we need to change the functionality of this power so that it doesn't rely on a science check, and is also somehow dependent on the existence of a Fortress to function. We will accomplish this by removing the science check from the Lumber Mill, making Fuel the Fires into a PlayerUpgradeSpecialPower that grants a PLAYER-type upgrade to the caster, and giving the IsengardFortressCitadel an AttributeModifierAuraUpdate, triggered by this upgrade, that grants a production bonus attributemodifier to all allied Lumber Mills on the map.

Comments

Display order: Newest first

Sulherokhh (Team Chamber Member) - Thursday May 21, 2009 - 8:19

Great, but like in your other tutorial, replace the TAB characters with a single SPACE character to increase the visual accessibility of the tutorial. Same goes for use of the ';'. Make it's use uniformly the same for every instance.

Prolong - Sunday May 10, 2009 - 19:29

I was about five minutes away from finishing this guide, then accidentally navigated away from the page. On some other forums clicking the "back" button is enough to restore what you were writing; here it just brought me to a very unhappy looking "Empty Page", and I lost the entire second page of the guide. Guess I'll have to finish this later.

--------

Done. Don't know if anybody will really care to use this in his/her mod, but here it is if you want to.

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

 
11:27:30